diff --git a/src/include/sof/schedule/dp_schedule.h b/src/include/sof/schedule/dp_schedule.h index 63f1a02f71e8..ab511e125f65 100644 --- a/src/include/sof/schedule/dp_schedule.h +++ b/src/include/sof/schedule/dp_schedule.h @@ -147,8 +147,10 @@ static inline void scheduler_dp_check_deadline(uint16_t core, uint32_t deadline_ * memory is writable by the DP threads, so the calculation runs in the calling * LL user thread, and only its results are passed to the kernel with * scheduler_dp_kick(). Otherwise this calls scheduler_dp_ll_tick(). + * + * @param[in] core Core ID of the calling LL scheduler. */ -void scheduler_dp_ll_post_tick(void); +void scheduler_dp_ll_post_tick(unsigned int core); #if CONFIG_SOF_BOOT_TEST_STANDALONE && CONFIG_SOF_USERSPACE_APPLICATION /* Test hooks: add and remove kernel-only DP task records without a DP task */ diff --git a/src/schedule/zephyr_dp_schedule.c b/src/schedule/zephyr_dp_schedule.c index 918d3661bb95..38d228d4b609 100644 --- a/src/schedule/zephyr_dp_schedule.c +++ b/src/schedule/zephyr_dp_schedule.c @@ -52,9 +52,12 @@ void scheduler_dp_unlock(unsigned int key) #if CONFIG_SOF_USERSPACE_APPLICATION && CONFIG_SOF_USERSPACE_LL /* Runs in the LL user thread, see scheduler_dp_ll_post_tick() documentation */ -void scheduler_dp_ll_post_tick(void) +void scheduler_dp_ll_post_tick(unsigned int core) { - struct scheduler_dp_data *dp_sch = scheduler_get_user_data(SOF_SCHEDULE_DP); + /* user context: the kernel-only lookup and cpu_get_id() are not usable */ + struct scheduler_dp_data *dp_sch = + scheduler_list_get_data(*arch_user_schedulers_get_for_core(core), + SOF_SCHEDULE_DP); unsigned int lock_key; /* @@ -64,12 +67,12 @@ void scheduler_dp_ll_post_tick(void) if (!dp_sch || list_is_empty(&dp_sch->tasks)) return; - lock_key = scheduler_dp_lock(cpu_get_id()); + lock_key = scheduler_dp_lock(core); scheduler_dp_recalculate(dp_sch); scheduler_dp_unlock(lock_key); } #else -void scheduler_dp_ll_post_tick(void) +void scheduler_dp_ll_post_tick(unsigned int core) { scheduler_dp_ll_tick(); } diff --git a/src/schedule/zephyr_ll.c b/src/schedule/zephyr_ll.c index 951f421e00a8..95f4cd17620d 100644 --- a/src/schedule/zephyr_ll.c +++ b/src/schedule/zephyr_ll.c @@ -302,7 +302,7 @@ static void zephyr_ll_run(void *data) zephyr_ll_unlock(sch, &flags); #ifdef CONFIG_ZEPHYR_DP_SCHEDULER - scheduler_dp_ll_post_tick(); + scheduler_dp_ll_post_tick(sch->core); #endif }