@@ -47,6 +47,20 @@ struct ll_schedule_domain_ops {
4747 void (* handler )(void * arg ), void * arg );
4848 int (* domain_unregister )(struct ll_schedule_domain * domain ,
4949 struct task * task , uint32_t num_tasks );
50+ #if CONFIG_SOF_USERSPACE_LL
51+ /*
52+ * Initialize the scheduling thread and perform all privileged setup
53+ * (thread creation, timer init, access grants). Called once from
54+ * kernel context before any user-space domain_register() calls.
55+ */
56+ int (* domain_thread_init )(struct ll_schedule_domain * domain ,
57+ struct task * task );
58+ /* Free resources acquired by domain_thread_init(). Called from
59+ * kernel context when the scheduling context is being torn down.
60+ */
61+ void (* domain_thread_free )(struct ll_schedule_domain * domain ,
62+ uint32_t num_tasks );
63+ #endif
5064 void (* domain_enable )(struct ll_schedule_domain * domain , int core );
5165 void (* domain_disable )(struct ll_schedule_domain * domain , int core );
5266#if CONFIG_CROSS_CORE_STREAM
@@ -181,6 +195,31 @@ static inline void domain_task_cancel(struct ll_schedule_domain *domain,
181195 domain -> ops -> domain_task_cancel (domain , task );
182196}
183197
198+ #if CONFIG_SOF_USERSPACE_LL
199+ /*
200+ * Initialize the scheduling thread and do all privileged setup.
201+ * Must be called from kernel context before user-space tasks register.
202+ */
203+ static inline int domain_thread_init (struct ll_schedule_domain * domain ,
204+ struct task * task )
205+ {
206+ assert (domain -> ops -> domain_thread_init );
207+
208+ return domain -> ops -> domain_thread_init (domain , task );
209+ }
210+
211+ /*
212+ * Free resources acquired by domain_thread_init().
213+ * Must be called from kernel context.
214+ */
215+ static inline void domain_thread_free (struct ll_schedule_domain * domain ,
216+ uint32_t num_tasks )
217+ {
218+ if (domain -> ops -> domain_thread_free )
219+ domain -> ops -> domain_thread_free (domain , num_tasks );
220+ }
221+ #endif
222+
184223static inline int domain_register (struct ll_schedule_domain * domain ,
185224 struct task * task ,
186225 void (* handler )(void * arg ), void * arg )
0 commit comments