Skip to content

Commit 28639f2

Browse files
committed
audio: copier: avoid IRQ lock/unlock in chmap code
Copier set_chmap() blocks IRQs to atomically update the converters. This code is not safe to be moved to user-space, so replace the locks with calls to block LL scheduler execution. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
1 parent b56f99b commit 28639f2

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

src/audio/copier/copier.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <rtos/interrupt.h>
1414
#include <sof/ipc/msg.h>
1515
#include <sof/ipc/topology.h>
16+
#include <sof/schedule/ll_schedule_domain.h>
1617
#include <rtos/interrupt.h>
1718
#include <rtos/timer.h>
1819
#include <rtos/cache.h>
@@ -838,7 +839,9 @@ __cold static int set_chmap(struct comp_dev *dev, const void *data, size_t data_
838839
pcm_converter_func process;
839840
pcm_converter_func converters[IPC4_COPIER_MODULE_OUTPUT_PINS_COUNT];
840841
int i;
842+
#ifndef CONFIG_SOF_USERSPACE_LL
841843
uint32_t irq_flags;
844+
#endif
842845

843846
assert_can_be_cold();
844847

@@ -892,15 +895,26 @@ __cold static int set_chmap(struct comp_dev *dev, const void *data, size_t data_
892895
}
893896
}
894897

895-
/* Atomically update chmap, process and converters */
898+
/* Atomically update chmap, process and converters.
899+
* In user-space builds irq_local_disable() is privileged,
900+
* use the LL scheduler lock instead.
901+
*/
902+
#ifdef CONFIG_SOF_USERSPACE_LL
903+
user_ll_lock_sched(dev->pipeline->core);
904+
#else
896905
irq_local_disable(irq_flags);
906+
#endif
897907

898908
cd->dd[0]->chmap = chmap_cfg->channel_map;
899909
cd->dd[0]->process = process;
900910
for (i = 0; i < IPC4_COPIER_MODULE_OUTPUT_PINS_COUNT; i++)
901911
cd->converter[i] = converters[i];
902912

913+
#ifdef CONFIG_SOF_USERSPACE_LL
914+
user_ll_unlock_sched(dev->pipeline->core);
915+
#else
903916
irq_local_enable(irq_flags);
917+
#endif
904918

905919
return 0;
906920
}

0 commit comments

Comments
 (0)