From c1440325b20e1c55d45363c8228da1bbc8d6e583 Mon Sep 17 00:00:00 2001 From: Tomasz Leman Date: Tue, 26 Aug 2025 16:01:44 +0200 Subject: [PATCH] ipc3: Fix spinlock violation in PM context save on fuzzer Fix spinlock validation assertion failure during fuzzing on native_sim builds with IPC3. Recent Zephyr commit added spinlock validation that detects context switching while holding spinlocks. This revealed that `ipc_pm_context_save` calls `arch_irq_lock` before the EDF work queue yields, causing: ASSERTION FAIL [arch_irq_unlocked(key) || ...] Context switching while holding lock! The hardware PM operations (arch_irq_lock, platform_timer_stop, etc.) are not needed for POSIX simulation environments. Extend the existing guard to exclude these operations when CONFIG_ZEPHYR_POSIX is defined. This preserves PM functionality while avoiding spinlock violations in native simulation builds. Signed-off-by: Tomasz Leman --- src/ipc/ipc3/handler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ipc/ipc3/handler.c b/src/ipc/ipc3/handler.c index 94094c187ef4..9f865960f1bf 100644 --- a/src/ipc/ipc3/handler.c +++ b/src/ipc/ipc3/handler.c @@ -672,7 +672,7 @@ static int ipc_pm_context_save(uint32_t header) /* do platform specific suspending */ platform_context_save(sof_get()); -#if !defined(CONFIG_LIBRARY) +#if !defined(CONFIG_LIBRARY) && !defined(CONFIG_ZEPHYR_POSIX) /* TODO: check we are inactive - all streams are suspended */ /* TODO: mask ALL platform interrupts except DMA */