Skip to content

Commit f42df88

Browse files
committed
ipc4: helper: use LL scheduler lock for userspace builds
The ll_block()/ll_unblock() macros use irq_local_disable() and irq_local_enable() for the same-core binding path, or when CONFIG_CROSS_CORE_STREAM is not enabled. These are not available in user-space. Use zephyr_ll_lock_sched()/zephyr_ll_unlock_sched() when building with CONFIG_SOF_USERSPACE_LL to acquire the LL scheduler's own k_mutex instead. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
1 parent 76c6561 commit f42df88

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

src/ipc/ipc4/helper.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,23 @@ __cold static struct comp_buffer *ipc4_create_buffer(struct comp_dev *src, bool
599599
* disable any interrupts.
600600
*/
601601

602+
#if CONFIG_SOF_USERSPACE_LL
603+
#define ll_block(cross_core_bind, flags) \
604+
do { \
605+
if (cross_core_bind) \
606+
domain_block(sof_get()->platform_timer_domain); \
607+
else \
608+
zephyr_ll_lock_sched(); \
609+
} while (0)
610+
611+
#define ll_unblock(cross_core_bind, flags) \
612+
do { \
613+
if (cross_core_bind) \
614+
domain_unblock(sof_get()->platform_timer_domain); \
615+
else \
616+
zephyr_ll_unlock_sched(); \
617+
} while (0)
618+
#else
602619
#define ll_block(cross_core_bind, flags) \
603620
do { \
604621
if (cross_core_bind) \
@@ -614,6 +631,7 @@ __cold static struct comp_buffer *ipc4_create_buffer(struct comp_dev *src, bool
614631
else \
615632
irq_local_enable(flags); \
616633
} while (0)
634+
#endif /* CONFIG_SOF_USERSPACE_LL */
617635

618636
/* Calling both ll_block() and ll_wait_finished_on_core() makes sure LL will not start its
619637
* next cycle and its current cycle on specified core has finished.
@@ -645,8 +663,13 @@ static int ll_wait_finished_on_core(struct comp_dev *dev)
645663

646664
#else
647665

666+
#if CONFIG_SOF_USERSPACE_LL
667+
#define ll_block(cross_core_bind, flags) zephyr_ll_lock_sched()
668+
#define ll_unblock(cross_core_bind, flags) zephyr_ll_unlock_sched()
669+
#else
648670
#define ll_block(cross_core_bind, flags) irq_local_disable(flags)
649671
#define ll_unblock(cross_core_bind, flags) irq_local_enable(flags)
672+
#endif /* CONFIG_SOF_USERSPACE_LL */
650673

651674
#endif
652675

0 commit comments

Comments
 (0)