Skip to content

Commit e84bb6b

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 33b3b32 commit e84bb6b

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
@@ -588,6 +588,23 @@ __cold static struct comp_buffer *ipc4_create_buffer(struct comp_dev *src, bool
588588
* disable any interrupts.
589589
*/
590590

591+
#if CONFIG_SOF_USERSPACE_LL
592+
#define ll_block(cross_core_bind, flags) \
593+
do { \
594+
if (cross_core_bind) \
595+
domain_block(sof_get()->platform_timer_domain); \
596+
else \
597+
zephyr_ll_lock_sched(); \
598+
} while (0)
599+
600+
#define ll_unblock(cross_core_bind, flags) \
601+
do { \
602+
if (cross_core_bind) \
603+
domain_unblock(sof_get()->platform_timer_domain); \
604+
else \
605+
zephyr_ll_unlock_sched(); \
606+
} while (0)
607+
#else
591608
#define ll_block(cross_core_bind, flags) \
592609
do { \
593610
if (cross_core_bind) \
@@ -603,6 +620,7 @@ __cold static struct comp_buffer *ipc4_create_buffer(struct comp_dev *src, bool
603620
else \
604621
irq_local_enable(flags); \
605622
} while (0)
623+
#endif /* CONFIG_SOF_USERSPACE_LL */
606624

607625
/* Calling both ll_block() and ll_wait_finished_on_core() makes sure LL will not start its
608626
* next cycle and its current cycle on specified core has finished.
@@ -634,8 +652,13 @@ static int ll_wait_finished_on_core(struct comp_dev *dev)
634652

635653
#else
636654

655+
#if CONFIG_SOF_USERSPACE_LL
656+
#define ll_block(cross_core_bind, flags) zephyr_ll_lock_sched()
657+
#define ll_unblock(cross_core_bind, flags) zephyr_ll_unlock_sched()
658+
#else
637659
#define ll_block(cross_core_bind, flags) irq_local_disable(flags)
638660
#define ll_unblock(cross_core_bind, flags) irq_local_enable(flags)
661+
#endif /* CONFIG_SOF_USERSPACE_LL */
639662

640663
#endif
641664

0 commit comments

Comments
 (0)