Skip to content

Commit e58f00a

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 7a05a4a commit e58f00a

4 files changed

Lines changed: 18 additions & 1 deletion

File tree

src/include/sof/schedule/ll_schedule_domain.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ struct ll_schedule_domain *zephyr_domain_init(int clk);
330330
struct k_thread *zephyr_domain_thread_tid(struct ll_schedule_domain *domain);
331331
struct k_thread *zephyr_domain_thread_tid_for_core(int core);
332332
struct k_mem_domain *zephyr_ll_mem_domain(void);
333+
struct k_thread *zephyr_ll_domain_thread(void);
333334
#endif /* CONFIG_SOF_USERSPACE_LL */
334335
#ifdef CONFIG_SOF_FULL_ZEPHYR_APPLICATION
335336
__syscall int zephyr_ll_task_sem_alloc(struct task *task);

src/schedule/zephyr_domain.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,18 @@ struct k_thread *zephyr_domain_thread_tid_for_core(int core)
525525
return ll_thread_tid[core];
526526
}
527527

528+
struct k_thread *zephyr_ll_domain_thread(void)
529+
{
530+
struct ll_schedule_domain *ll_domain = zephyr_ll_domain();
531+
532+
if (!ll_domain)
533+
return NULL;
534+
535+
struct zephyr_domain *zephyr_domain = ll_sch_domain_get_pdata(ll_domain);
536+
537+
return zephyr_domain->domain_thread[cpu_get_id()].ll_thread;
538+
}
539+
528540
#endif /* CONFIG_SOF_USERSPACE_LL */
529541

530542
#if CONFIG_CROSS_CORE_STREAM

src/schedule/zephyr_dp_schedule.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ void scheduler_dp_unlock(unsigned int key)
6262

6363
void scheduler_dp_grant(k_tid_t thread_id, uint16_t core)
6464
{
65-
k_thread_access_grant(thread_id, &dp_lock[core]);
65+
if (thread_id)
66+
k_thread_access_grant(thread_id, &dp_lock[core]);
6667
}
6768

6869
/* dummy LL task - to start LL on secondary cores */

src/schedule/zephyr_dp_schedule_application.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,9 @@ int scheduler_dp_task_init(struct task **task, const struct sof_uuid_entry *uid,
528528

529529
k_thread_access_grant(pdata->thread_id, pdata->event, &dp_sync[core]);
530530
scheduler_dp_grant(pdata->thread_id, core);
531+
#if CONFIG_SOF_USERSPACE_LL
532+
scheduler_dp_grant(zephyr_ll_domain_thread(), core);
533+
#endif
531534

532535
struct k_mem_domain *mdom = objpool_alloc(&dp_mdom_head, sizeof(*mdom),
533536
SOF_MEM_FLAG_COHERENT);

0 commit comments

Comments
 (0)