diff --git a/src/arch/xtensa/include/arch/wait.h b/src/arch/xtensa/include/arch/wait.h index e1cca01c32d8..857b50e09560 100644 --- a/src/arch/xtensa/include/arch/wait.h +++ b/src/arch/xtensa/include/arch/wait.h @@ -29,6 +29,9 @@ */ #include +#include +#include + #if defined(PLATFORM_WAITI_DELAY) @@ -36,6 +39,10 @@ static inline void arch_wait_for_interrupt(int level) { int i; + /* can only eneter WFI when at runlevel 0 i.e. not IRQ level */ + if (arch_interrupt_get_level() > 0) + panic(SOF_IPC_PANIC_WFI); + /* this sequnce must be atomic on LX6 */ XTOS_SET_INTLEVEL(5); @@ -55,7 +62,11 @@ static inline void arch_wait_for_interrupt(int level) static inline void arch_wait_for_interrupt(int level) { - asm volatile("waiti 0"); + /* can only eneter WFI when at runlevel 0 i.e. not IRQ level */ + if (arch_interrupt_get_level() > 0) + panic(SOF_IPC_PANIC_WFI); + + asm volatile("waiti 0"); } #endif diff --git a/src/include/uapi/ipc.h b/src/include/uapi/ipc.h index 68f638e4e983..1fae8096b58a 100644 --- a/src/include/uapi/ipc.h +++ b/src/include/uapi/ipc.h @@ -137,16 +137,17 @@ #define SOF_IPC_PANIC_MAGIC 0x0dead000 #define SOF_IPC_PANIC_MAGIC_MASK 0x0ffff000 #define SOF_IPC_PANIC_CODE_MASK 0x00000fff -#define SOF_IPC_PANIC_MEM (SOF_IPC_PANIC_MAGIC | 0) -#define SOF_IPC_PANIC_WORK (SOF_IPC_PANIC_MAGIC | 1) -#define SOF_IPC_PANIC_IPC (SOF_IPC_PANIC_MAGIC | 2) -#define SOF_IPC_PANIC_ARCH (SOF_IPC_PANIC_MAGIC | 3) -#define SOF_IPC_PANIC_PLATFORM (SOF_IPC_PANIC_MAGIC | 4) -#define SOF_IPC_PANIC_TASK (SOF_IPC_PANIC_MAGIC | 5) -#define SOF_IPC_PANIC_EXCEPTION (SOF_IPC_PANIC_MAGIC | 6) -#define SOF_IPC_PANIC_DEADLOCK (SOF_IPC_PANIC_MAGIC | 7) -#define SOF_IPC_PANIC_STACK (SOF_IPC_PANIC_MAGIC | 8) -#define SOF_IPC_PANIC_IDLE (SOF_IPC_PANIC_MAGIC | 9) +#define SOF_IPC_PANIC_MEM (SOF_IPC_PANIC_MAGIC | 0x0) +#define SOF_IPC_PANIC_WORK (SOF_IPC_PANIC_MAGIC | 0x1) +#define SOF_IPC_PANIC_IPC (SOF_IPC_PANIC_MAGIC | 0x2) +#define SOF_IPC_PANIC_ARCH (SOF_IPC_PANIC_MAGIC | 0x3) +#define SOF_IPC_PANIC_PLATFORM (SOF_IPC_PANIC_MAGIC | 0x4) +#define SOF_IPC_PANIC_TASK (SOF_IPC_PANIC_MAGIC | 0x5) +#define SOF_IPC_PANIC_EXCEPTION (SOF_IPC_PANIC_MAGIC | 0x6) +#define SOF_IPC_PANIC_DEADLOCK (SOF_IPC_PANIC_MAGIC | 0x7) +#define SOF_IPC_PANIC_STACK (SOF_IPC_PANIC_MAGIC | 0x8) +#define SOF_IPC_PANIC_IDLE (SOF_IPC_PANIC_MAGIC | 0x9) +#define SOF_IPC_PANIC_WFI (SOF_IPC_PANIC_MAGIC | 0xa) /* * SOF memory capabilities, add new ones at the end