Skip to content

Commit 9bc893c

Browse files
committed
schedule: ll: userspace: grant the LL thread rights on DP
The LL userspace thread has to interact with the DP one. Grant required rights. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
1 parent c7a7e98 commit 9bc893c

4 files changed

Lines changed: 29 additions & 0 deletions

File tree

src/include/sof/schedule/ll_schedule_domain.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,8 @@ struct ll_schedule_domain *zephyr_domain_init(int clk);
324324
#ifdef CONFIG_SOF_USERSPACE_LL
325325
struct k_thread *zephyr_domain_thread_tid(struct ll_schedule_domain *domain);
326326
struct k_mem_domain *zephyr_ll_mem_domain(void);
327+
struct ll_schedule_domain *zephyr_ll_domain_for_core(unsigned int core);
328+
struct k_thread *zephyr_ll_domain_thread(unsigned int core);
327329
#endif /* CONFIG_SOF_USERSPACE_LL */
328330
#endif /* __ZEPHYR__ */
329331

src/schedule/zephyr_domain.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,20 @@ struct k_thread *zephyr_domain_thread_tid(struct ll_schedule_domain *domain)
495495
return dt->ll_thread;
496496
}
497497

498+
struct k_thread *zephyr_ll_domain_thread(unsigned int core)
499+
{
500+
struct ll_schedule_domain *ll_domain = zephyr_ll_domain_for_core(core);
501+
502+
if (!ll_domain)
503+
return NULL;
504+
505+
struct zephyr_domain *zephyr_domain = ll_sch_domain_get_pdata(ll_domain);
506+
507+
struct zephyr_domain_thread *dt = zephyr_domain->domain_thread + core;
508+
509+
return dt->ll_thread;
510+
}
511+
498512
#endif /* CONFIG_SOF_USERSPACE_LL */
499513

500514
#if CONFIG_CROSS_CORE_STREAM

src/schedule/zephyr_dp_schedule_application.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ int scheduler_dp_task_init(struct task **task, const struct sof_uuid_entry *uid,
531531

532532
k_thread_access_grant(thread_ipc, pdata->event, pdata->thread_id, p_stack, &dp_sync[core]);
533533
scheduler_dp_grant(thread_ipc, core);
534+
scheduler_dp_grant(zephyr_ll_domain_thread(core), core);
534535
#endif
535536

536537
struct k_mem_domain *mdom = objpool_alloc(&dp_mdom_head, sizeof(*mdom),

src/schedule/zephyr_ll.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,3 +788,15 @@ struct ll_schedule_domain *zephyr_ll_domain(void)
788788

789789
return ll_sch ? ll_sch->ll_domain : NULL;
790790
}
791+
792+
/* Return a pointer to the LL scheduler timer domain */
793+
struct ll_schedule_domain *zephyr_ll_domain_for_core(unsigned int core)
794+
{
795+
#if CONFIG_SOF_USERSPACE_LL
796+
struct zephyr_ll *ll_sch = scheduler_get_data_for_core(SOF_SCHEDULE_LL_TIMER, core);
797+
#else
798+
struct zephyr_ll *ll_sch = scheduler_get_data(SOF_SCHEDULE_LL_TIMER);
799+
#endif
800+
801+
return ll_sch ? ll_sch->ll_domain : NULL;
802+
}

0 commit comments

Comments
 (0)