idc: Add secondary core crashed notification

Added a new notification about the crash of the secondary core. It is
directed to the primary core. Only failure detected by watchdog is
supported at this moment.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
This commit is contained in:
Adrian Warecki 2023-01-16 15:07:04 +01:00 committed by Kai Vehmanen
parent dbeb0b9fdd
commit 21f1aec447
2 changed files with 40 additions and 0 deletions

View File

@ -19,6 +19,7 @@
#include <sof/lib/notifier.h>
#include <sof/lib/pm_runtime.h>
#include <sof/lib/uuid.h>
#include <sof/lib/watchdog.h>
#include <sof/platform.h>
#include <rtos/wait.h>
#include <sof/schedule/edf_schedule.h>
@ -273,6 +274,25 @@ static void idc_prepare_d0ix(void)
platform_pm_runtime_prepare_d0ix_en(cpu_get_id());
}
/**
* \brief Handle IDC secondary core crashed message.
* \param[in] header IDC message header
*/
static void idc_secondary_core_crashed(const uint32_t header)
{
const uint32_t core = (header >> IDC_SCC_CORE_SHIFT) & IDC_SCC_CORE_MASK;
const uint32_t reason = (header >> IDC_SCC_REASON_SHIFT) & IDC_SCC_REASON_MASK;
(void)core;
switch (reason) {
#if IS_ENABLED(CONFIG_LL_WATCHDOG)
case IDC_SCC_REASON_WATCHDOG:
watchdog_secondary_core_timeout(core);
break;
#endif
}
}
/**
* \brief Executes IDC message based on type.
* \param[in,out] msg Pointer to IDC message.
@ -312,6 +332,9 @@ void idc_cmd(struct idc_msg *msg)
case iTS(IDC_MSG_PREPARE_D0ix):
idc_prepare_d0ix();
break;
case iTS(IDC_MSG_SECONDARY_CORE_CRASHED):
idc_secondary_core_crashed(msg->header);
break;
default:
tr_err(&idc_tr, "idc_cmd(): invalid msg->header = %u",
msg->header);

View File

@ -93,6 +93,23 @@
#define IDC_MSG_PREPARE_D0ix IDC_TYPE(0x9)
#define IDC_MSG_PREPARE_D0ix_EXT IDC_EXTENSION(0x0)
/** \brief IDC secondary core crashed notify message. */
#define IDC_MSG_SECONDARY_CORE_CRASHED IDC_TYPE(0xA)
#define IDC_MSG_SECONDARY_CORE_CRASHED_EXT(x) IDC_EXTENSION(x)
/** \brief IDC_MSG_SECONDARY_CORE_CRASHED header fields. */
#define IDC_SCC_CORE_SHIFT 0
#define IDC_SCC_CORE_MASK 0xff
#define IDC_SCC_CORE(x) (((x) & IDC_SCC_CORE_MASK) << IDC_SCC_CORE_SHIFT)
#define IDC_SCC_REASON_SHIFT 8
#define IDC_SCC_REASON_MASK 0xff
#define IDC_SCC_REASON(x) (((x) & IDC_SCC_REASON_MASK) << IDC_SCC_REASON_SHIFT)
/** \brief Secondary core crash reasons. */
#define IDC_SCC_REASON_WATCHDOG 0x00
#define IDC_SCC_REASON_EXCEPTION 0x01
/** \brief Decodes IDC message type. */
#define iTS(x) (((x) >> IDC_TYPE_SHIFT) & IDC_TYPE_MASK)