Skip to content

Commit b9ebeb7

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 10e69b5 commit b9ebeb7

File tree

3 files changed

+50
-1
lines changed

3 files changed

+50
-1
lines changed

src/audio/base_fw.c

Lines changed: 15 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,18 @@ __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 char *data)
701+
{
702+
struct ipc4_notification_mask_info *mask_info;
703+
704+
assert_can_be_cold();
705+
706+
mask_info = (struct ipc4_notification_mask_info *)data;
707+
ipc4_update_notification_mask(mask_info->ntfy_mask, mask_info->enabled_mask);
708+
709+
return IPC4_SUCCESS;
710+
}
711+
699712
__cold static int basefw_astate_table(void)
700713
{
701714
assert_can_be_cold();
@@ -757,6 +770,8 @@ __cold static int basefw_set_large_config(struct comp_dev *dev, uint32_t param_i
757770
assert_can_be_cold();
758771

759772
switch (param_id) {
773+
case IPC4_NOTIFICATION_MASK:
774+
return basefw_notification_mask_info(data);
760775
case IPC4_ASTATE_TABLE:
761776
return basefw_astate_table();
762777
case IPC4_DMA_CONTROL:

src/include/ipc4/notification.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,5 +297,6 @@ bool send_gateway_overrun_notif_msg(uint32_t resource_id);
297297

298298
void send_mixer_underrun_notif_msg(uint32_t resource_id, uint32_t eos_flag, uint32_t data_mixed,
299299
uint32_t expected_data_mixed);
300+
void ipc4_update_notification_mask(uint32_t ntfy_mask, uint32_t enabled_mask);
300301

301302
#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

@@ -43,6 +70,12 @@ static bool send_resource_notif(uint32_t resource_id, uint32_t event_type, uint3
4370
return true;
4471
}
4572

73+
void ipc4_update_notification_mask(uint32_t ntfy_mask, uint32_t enabled_mask)
74+
{
75+
notification_mask &= enabled_mask | (~ntfy_mask);
76+
notification_mask |= enabled_mask & ntfy_mask;
77+
}
78+
4679
bool send_copier_gateway_underrun_notif_msg(uint32_t pipeline_id)
4780
{
4881
return send_resource_notif(pipeline_id, SOF_IPC4_GATEWAY_UNDERRUN_DETECTED,

0 commit comments

Comments
 (0)