@@ -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
@@ -179,6 +193,31 @@ static inline void domain_task_cancel(struct ll_schedule_domain *domain,
179193 domain -> ops -> domain_task_cancel (domain , task );
180194}
181195
196+ #if CONFIG_SOF_USERSPACE_LL
197+ /*
198+ * Initialize the scheduling thread and do all privileged setup.
199+ * Must be called from kernel context before user-space tasks register.
200+ */
201+ static inline int domain_thread_init (struct ll_schedule_domain * domain ,
202+ struct task * task )
203+ {
204+ assert (domain -> ops -> domain_thread_init );
205+
206+ return domain -> ops -> domain_thread_init (domain , task );
207+ }
208+
209+ /*
210+ * Free resources acquired by domain_thread_init().
211+ * Must be called from kernel context.
212+ */
213+ static inline void domain_thread_free (struct ll_schedule_domain * domain ,
214+ uint32_t num_tasks )
215+ {
216+ if (domain -> ops -> domain_thread_free )
217+ domain -> ops -> domain_thread_free (domain , num_tasks );
218+ }
219+ #endif
220+
182221static inline int domain_register (struct ll_schedule_domain * domain ,
183222 struct task * task ,
184223 void (* handler )(void * arg ), void * arg )
0 commit comments