From ac5d2f188cef91d85067b83952a9ef63412438c1 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Sat, 5 Dec 2026 15:09:10 +0000 Subject: [PATCH] ams: take the local interrupt lock with arch_irq_lock() Kernel code uses the native Zephyr API. irq_local_disable() and irq_local_enable() expand to arch_irq_lock() and arch_irq_unlock() on Zephyr, so call them directly in the AMS pending slot updates, and keep the lock key in an unsigned int, the type arch_irq_lock() returns. The remaining kernel users of irq_local_disable() are the legacy DAI driver and the DMA scheduling domain, which only the platforms without native drivers build and which go with the legacy driver code. No functional change. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Liam Girdwood --- src/kernel/lib/ams.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/kernel/lib/ams.c b/src/kernel/lib/ams.c index 8da8952bb9f0..fbdd54f6ad9d 100644 --- a/src/kernel/lib/ams.c +++ b/src/kernel/lib/ams.c @@ -510,11 +510,11 @@ static int ams_process_slot(struct async_message_service *ams, uint32_t slot) static void ams_task_add_slot_to_process(struct ams_task *ams_task, uint32_t slot) { - int flags; + unsigned int key; - irq_local_disable(flags); + key = arch_irq_lock(); ams_task->pending_slots |= BIT(slot); - irq_local_enable(flags); + arch_irq_unlock(key); } int process_incoming_message(uint32_t slot) @@ -535,7 +535,7 @@ static enum task_state process_message(void *arg) { struct ams_task *ams_task = arg; uint32_t slot; - int flags; + unsigned int key; if (ams_task->pending_slots == 0) { tr_err(&ams_tr, "Could not process message! Skipping."); @@ -547,9 +547,9 @@ static enum task_state process_message(void *arg) ams_process_slot(ams_task->ams, slot); /* only done on main core, irq disabling is enough */ - irq_local_disable(flags); + key = arch_irq_lock(); ams_task->pending_slots &= ~BIT(slot); - irq_local_enable(flags); + arch_irq_unlock(key); schedule_task_cancel(&ams_task->ams_task); return SOF_TASK_STATE_COMPLETED;