Skip to content

Commit f08ffb3

Browse files
idc: check if secondary core is down before sending IDC
If for any reason a secondary core is down, IDC message has no chance to be processed. This may lead to process hang in case of blocking calls and to undefined actions in case of non blocking. This commit adds a check and error log message in case of target core is down. Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
1 parent 1b81841 commit f08ffb3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/idc/zephyr_idc.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@
3030
#include <rtos/alloc.h>
3131
#include <rtos/spinlock.h>
3232
#include <ipc/topology.h>
33+
#include <sof/trace/trace.h>
34+
#include <sof/lib/uuid.h>
35+
36+
LOG_MODULE_REGISTER(zephyr_idc, CONFIG_SOF_LOG_LEVEL);
37+
38+
/* 5f1ec3f8-faaf-4099-903c-cee98351f169 */
39+
DECLARE_SOF_UUID("zephyr-idc", zephyr_idc_uuid, 0x5f1ec3f8, 0xfaaf, 0x4099,
40+
0x90, 0x3c, 0xce, 0xe9, 0x83, 0x51, 0xf1, 0x69);
41+
42+
DECLARE_TR_CTX(zephyr_idc_tr, SOF_UUID(zephyr_idc_uuid), LOG_LEVEL_INFO);
3343

3444
/*
3545
* Inter-CPU communication is only used in
@@ -119,6 +129,10 @@ int idc_send_msg(struct idc_msg *msg, uint32_t mode)
119129
work->handler = idc_handler;
120130
work->sync = mode == IDC_BLOCKING;
121131

132+
if (!cpu_is_core_enabled(target_cpu)) {
133+
tr_err(&zephyr_idc_tr, "Core %u is down, cannot sent IDC message", target_cpu);
134+
return -EACCES;
135+
}
122136
if (msg->payload) {
123137
idc_send_memcpy_err = memcpy_s(payload->data, sizeof(payload->data),
124138
msg->payload, msg->size);

0 commit comments

Comments
 (0)