@@ -43,6 +43,20 @@ struct ll_schedule_domain_ops {
4343 void (* handler )(void * arg ), void * arg );
4444 int (* domain_unregister )(struct ll_schedule_domain * domain ,
4545 struct task * task , uint32_t num_tasks );
46+ #if CONFIG_SOF_USERSPACE_LL
47+ /*
48+ * Initialize the scheduling thread and perform all privileged setup
49+ * (thread creation, timer init, access grants). Called once from
50+ * kernel context before any user-space domain_register() calls.
51+ */
52+ int (* domain_thread_init )(struct ll_schedule_domain * domain ,
53+ struct task * task );
54+ /* Free resources acquired by domain_thread_init(). Called from
55+ * kernel context when the scheduling context is being torn down.
56+ */
57+ void (* domain_thread_free )(struct ll_schedule_domain * domain ,
58+ uint32_t num_tasks );
59+ #endif
4660 void (* domain_enable )(struct ll_schedule_domain * domain , int core );
4761 void (* domain_disable )(struct ll_schedule_domain * domain , int core );
4862#if CONFIG_CROSS_CORE_STREAM
@@ -177,6 +191,31 @@ static inline void domain_task_cancel(struct ll_schedule_domain *domain,
177191 domain -> ops -> domain_task_cancel (domain , task );
178192}
179193
194+ #if CONFIG_SOF_USERSPACE_LL
195+ /*
196+ * Initialize the scheduling thread and do all privileged setup.
197+ * Must be called from kernel context before user-space tasks register.
198+ */
199+ static inline int domain_thread_init (struct ll_schedule_domain * domain ,
200+ struct task * task )
201+ {
202+ assert (domain -> ops -> domain_thread_init );
203+
204+ return domain -> ops -> domain_thread_init (domain , task );
205+ }
206+
207+ /*
208+ * Free resources acquired by domain_thread_init().
209+ * Must be called from kernel context.
210+ */
211+ static inline void domain_thread_free (struct ll_schedule_domain * domain ,
212+ uint32_t num_tasks )
213+ {
214+ if (domain -> ops -> domain_thread_free )
215+ domain -> ops -> domain_thread_free (domain , num_tasks );
216+ }
217+ #endif
218+
180219static inline int domain_register (struct ll_schedule_domain * domain ,
181220 struct task * task ,
182221 void (* handler )(void * arg ), void * arg )
0 commit comments