Skip to content

Commit 1de5933

Browse files
committed
ipc4: notification: Add filtering feature
Adding a handler for retrieving info about the IPC4 notification mask out of the LargeConfig. The notification mask is then used for filtering IPC4 notifications sent by the FW. This feature allows muting notifications of a given kind to enhance readability of logs during debugging. Also, this feature enhances reliability of certain tests run on FPGA-based setups where the FW notifications are too overwhelming for those setups. Signed-off-by: Wojciech Jablonski <wojciech.jablonski@intel.com>
1 parent d69eea8 commit 1de5933

File tree

3 files changed

+49
-1
lines changed

3 files changed

+49
-1
lines changed

src/audio/base_fw.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <ipc4/base_fw_vendor.h>
1212
#include <ipc4/pipeline.h>
1313
#include <ipc4/logging.h>
14+
#include <ipc4/notification.h>
1415
#include <ipc/topology.h>
1516
#include <ipc/compress_params.h>
1617
#include <sof_versions.h>
@@ -696,6 +697,17 @@ __cold static int basefw_get_large_config(struct comp_dev *dev, uint32_t param_i
696697
data_offset, data);
697698
};
698699

700+
__cold static int basefw_notification_mask_info(const void *data)
701+
{
702+
const struct ipc4_notification_mask_info *mask_info = data;
703+
704+
assert_can_be_cold();
705+
706+
ipc4_update_notification_mask(mask_info->ntfy_mask, mask_info->enabled_mask);
707+
708+
return IPC4_SUCCESS;
709+
}
710+
699711
__cold static int basefw_astate_table(void)
700712
{
701713
assert_can_be_cold();
@@ -757,6 +769,8 @@ __cold static int basefw_set_large_config(struct comp_dev *dev, uint32_t param_i
757769
assert_can_be_cold();
758770

759771
switch (param_id) {
772+
case IPC4_NOTIFICATION_MASK:
773+
return basefw_notification_mask_info(data);
760774
case IPC4_ASTATE_TABLE:
761775
return basefw_astate_table();
762776
case IPC4_DMA_CONTROL:

src/include/ipc4/notification.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,5 +295,6 @@ bool send_gateway_xrun_notif_msg(uint32_t resource_id, enum sof_ipc_stream_direc
295295

296296
void send_mixer_underrun_notif_msg(uint32_t resource_id, uint32_t eos_flag, uint32_t data_mixed,
297297
uint32_t expected_data_mixed);
298+
void ipc4_update_notification_mask(uint32_t ntfy_mask, uint32_t enabled_mask);
298299

299300
#endif /* __IPC4_NOTIFICATION_H__ */

src/ipc/ipc4/notification.c

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,38 @@
1414

1515
#include <rtos/symbol.h>
1616

17+
static uint32_t notification_mask = 0xFFFFFFFF;
18+
19+
static bool is_notif_filtered_out(uint32_t event_type)
20+
{
21+
uint32_t notif_idx;
22+
23+
switch (event_type) {
24+
case SOF_IPC4_GATEWAY_UNDERRUN_DETECTED:
25+
notif_idx = IPC4_UNDERRUN_AT_GATEWAY_NOTIFICATION_MASK_IDX;
26+
break;
27+
case SOF_IPC4_MIXER_UNDERRUN_DETECTED:
28+
notif_idx = IPC4_UNDERRUN_AT_MIXER_NOTIFICATION_MASK_IDX;
29+
break;
30+
case SOF_IPC4_GATEWAY_OVERRUN_DETECTED:
31+
notif_idx = IPC4_OVERRUN_AT_GATEWAY_NOTIFICATION_MASK_IDX;
32+
break;
33+
default:
34+
return false;
35+
}
36+
37+
return (notification_mask & BIT(notif_idx)) == 0;
38+
}
39+
1740
static bool send_resource_notif(uint32_t resource_id, uint32_t event_type, uint32_t resource_type,
1841
void *data, uint32_t data_size)
1942
{
20-
struct ipc_msg *msg = ipc_notification_pool_get(IPC4_RESOURCE_EVENT_SIZE);
43+
struct ipc_msg *msg;
44+
45+
if (is_notif_filtered_out(event_type))
46+
return true; //silently ignore
2147

48+
msg = ipc_notification_pool_get(IPC4_RESOURCE_EVENT_SIZE);
2249
if (!msg)
2350
return false;
2451

@@ -59,6 +86,12 @@ static enum sof_ipc4_resource_event_type dir_to_xrun_event(enum sof_ipc_stream_d
5986
SOF_IPC4_GATEWAY_OVERRUN_DETECTED;
6087
}
6188

89+
void ipc4_update_notification_mask(uint32_t ntfy_mask, uint32_t enabled_mask)
90+
{
91+
notification_mask &= enabled_mask | (~ntfy_mask);
92+
notification_mask |= enabled_mask & ntfy_mask;
93+
}
94+
6295
bool send_copier_gateway_xrun_notif_msg(uint32_t pipeline_id, enum sof_ipc_stream_direction dir)
6396
{
6497
return send_resource_notif(pipeline_id, dir_to_xrun_event(dir), SOF_IPC4_PIPELINE, NULL,

0 commit comments

Comments
 (0)