@@ -196,66 +196,87 @@ static int userspace_proxy_invoke(struct userspace_context *user_ctx, uint32_t c
196196 struct k_event * const event = & worker .event ;
197197#endif
198198 struct module_params * params = user_work_get_params (user_ctx );
199+ struct processing_module * mod = params -> mod ;
200+ MOD_DBG (mod );
199201 const uintptr_t ipc_req_buf = (uintptr_t )MAILBOX_HOSTBOX_BASE ;
202+ MOD_DBG (mod );
200203 struct k_mem_partition ipc_part = {
201204 .start = ipc_req_buf ,
202205 .size = MAILBOX_HOSTBOX_SIZE ,
203206 .attr = user_get_partition_attr (ipc_req_buf ) | K_MEM_PARTITION_P_RO_U_RO ,
204207 };
208+ MOD_DBG (mod );
205209 int ret = 0 , ret2 ;
206210
207211 params -> cmd = cmd ;
212+ MOD_DBG (mod );
208213
209214 if (ipc_payload_access ) {
210215 ret = k_mem_domain_add_partition (user_ctx -> comp_dom , & ipc_part );
216+ MOD_DBG (mod );
211217 if (ret < 0 ) {
212218 tr_err (& userspace_proxy_tr , "Add mailbox to domain error: %d" , ret );
219+ MOD_DBG (mod );
213220 return ret ;
214221 }
215222 }
223+ MOD_DBG (mod );
216224
217225#if !IS_ENABLED (CONFIG_SOF_USERSPACE_MOD_IPC_BY_DP_THREAD )
218226 /* Switch worker thread to module memory domain */
219227 ret = k_mem_domain_add_thread (user_ctx -> comp_dom , worker .thread_id );
228+ MOD_DBG (mod );
220229 if (ret < 0 ) {
221230 tr_err (& userspace_proxy_tr , "Failed to switch memory domain, error: %d" , ret );
231+ MOD_DBG (mod );
222232 goto done ;
223233 }
224234
225235 /* Pin worker thread to the same core as the module */
226236 ret = k_thread_cpu_pin (worker .thread_id , cpu_get_id ());
237+ MOD_DBG (mod );
227238 if (ret < 0 ) {
228239 tr_err (& userspace_proxy_tr , "Failed to pin cpu, error: %d" , ret );
240+ MOD_DBG (mod );
229241 goto done ;
230242 }
231243
232244 ret = k_work_user_submit_to_queue (& worker .work_queue , & user_ctx -> work_item -> work_item );
245+ MOD_DBG (mod );
233246 if (ret < 0 ) {
234247 tr_err (& userspace_proxy_tr , "Submit to queue error: %d" , ret );
248+ MOD_DBG (mod );
235249 goto done ;
236250 }
237251#else
238252 assert (event );
253+ MOD_DBG (mod );
239254 k_event_post (event , DP_TASK_EVENT_IPC );
255+ MOD_DBG (mod );
240256#endif
241257
242258 /* Timeout value is aligned with the ipc_wait_for_compound_msg function */
243259 if (!k_event_wait_safe (event , DP_TASK_EVENT_IPC_DONE , false,
244260 Z_TIMEOUT_US (250 * 20 ))) {
245261 tr_err (& userspace_proxy_tr , "IPC processing timedout." );
262+ MOD_DBG (mod );
246263 ret = - ETIMEDOUT ;
247264 }
265+ MOD_DBG (mod );
248266
249267done :
250268 if (ipc_payload_access ) {
251269 ret2 = k_mem_domain_remove_partition (user_ctx -> comp_dom , & ipc_part );
270+ MOD_DBG (mod );
252271 if (ret2 < 0 ) {
253272 tr_err (& userspace_proxy_tr , "Mailbox remove from domain error: %d" , ret );
273+ MOD_DBG (mod );
254274
255275 if (!ret )
256276 ret = ret2 ;
257277 }
258278 }
279+ MOD_DBG (mod );
259280
260281 return ret ;
261282}
@@ -392,7 +413,7 @@ int userspace_proxy_create(struct userspace_context **user_ctx, const struct com
392413 struct k_mem_domain * domain ;
393414 int ret ;
394415
395- tr_dbg (& userspace_proxy_tr , "userspace create" );
416+ tr_err (& userspace_proxy_tr , "userspace create" );
396417
397418 context = k_heap_alloc (drv -> user_heap , sizeof (struct userspace_context ), K_FOREVER );
398419 if (!context )
@@ -412,11 +433,14 @@ int userspace_proxy_create(struct userspace_context **user_ctx, const struct com
412433 if (ret )
413434 goto error_dom ;
414435
415- if (agent_fn )
436+ if (agent_fn ) {
437+ tr_err (& userspace_proxy_tr , "userspace_proxy_add_sections" );
416438 ret = userspace_proxy_add_sections (context , agent_params -> instance_id , manifest );
417- else
439+ } else {
440+ tr_err (& userspace_proxy_tr , "llext_manager_add_domain" , ret );
418441 /* llext modules do not use the system agent. */
419442 ret = llext_manager_add_domain (agent_params -> module_id , domain );
443+ }
420444
421445 if (ret )
422446 goto error_dom ;
@@ -475,32 +499,43 @@ void userspace_proxy_destroy(const struct comp_driver *drv, struct userspace_con
475499static int userspace_proxy_init (struct processing_module * mod )
476500{
477501 struct module_params * params = user_work_get_params (mod -> user_ctx );
502+ MOD_DBG (mod );
478503 int ret ;
479504
480505 comp_dbg (mod -> dev , "start" );
506+ MOD_DBG (mod );
481507
482508#if IS_ENABLED (CONFIG_SOF_USERSPACE_MOD_IPC_BY_DP_THREAD )
483509 /* Start the system agent, if provided. Params is already filled by
484510 * the userspace_proxy_start_agent function.
485511 */
486512 if (params -> ext .agent .start_fn ) {
513+ MOD_DBG (mod );
487514 ret = userspace_proxy_invoke (mod -> user_ctx , USER_PROXY_MOD_CMD_AGENT_START , true);
515+ MOD_DBG (mod );
488516 if (ret )
489517 return ret ;
490518
491- if (params -> ext .agent .start_fn == system_agent_start )
519+ if (params -> ext .agent .start_fn == system_agent_start ) {
492520 module_set_private_data (mod , (void * )params -> ext .agent .out_interface );
493- else
521+ MOD_DBG (mod );
522+ } else {
494523 mod -> user_ctx -> interface = params -> ext .agent .out_interface ;
524+ MOD_DBG (mod );
525+ }
495526 }
527+ MOD_DBG (mod );
496528#endif
497529
498530 params -> mod = mod ;
531+ MOD_DBG (mod );
499532 ret = userspace_proxy_invoke (mod -> user_ctx , USER_PROXY_MOD_CMD_INIT , true);
533+ MOD_DBG (mod );
500534 if (ret )
501535 return ret ;
502536
503537 /* Return status from module code operation. */
538+ MOD_DBG (mod );
504539 return params -> status ;
505540}
506541
0 commit comments