Skip to content

Commit 28d9337

Browse files
committed
debug
1 parent b4987f3 commit 28d9337

3 files changed

Lines changed: 71 additions & 5 deletions

File tree

src/audio/module_adapter/library/userspace_proxy.c

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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

249267
done:
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
475499
static 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

src/audio/src/src_ipc4.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,59 +189,85 @@ int src_prepare_general(struct processing_module *mod,
189189
__cold int src_init(struct processing_module *mod)
190190
{
191191
struct module_data *md = &mod->priv;
192+
MOD_DBG(mod);
192193
struct module_config *cfg = &md->cfg;
194+
MOD_DBG(mod);
193195
struct comp_dev *dev = mod->dev;
196+
MOD_DBG(mod);
194197
struct comp_data *cd = NULL;
198+
MOD_DBG(mod);
195199

196200
assert_can_be_cold();
201+
MOD_DBG(mod);
197202

198203
comp_dbg(dev, "entry");
204+
MOD_DBG(mod);
199205

200206
if (!cfg->init_data || cfg->size != sizeof(cd->ipc_config)) {
201207
comp_err(dev, "Missing or bad size (%u) init data",
202208
cfg->size);
209+
MOD_DBG(mod);
203210
return -EINVAL;
204211
}
212+
MOD_DBG(mod);
205213

206214
/* validate init data - either SRC sink or source rate must be set */
207215
if (src_rate_check(cfg->init_data) < 0) {
208216
comp_err(dev, "SRC sink and source rate are not set");
217+
MOD_DBG(mod);
209218
return -EINVAL;
210219
}
220+
MOD_DBG(mod);
211221

212222
cd = mod_zalloc(mod, sizeof(*cd));
223+
MOD_DBG(mod);
213224
if (!cd)
214225
return -ENOMEM;
215226

216227
md->private = cd;
228+
MOD_DBG(mod);
217229
memcpy_s(&cd->ipc_config, sizeof(cd->ipc_config), cfg->init_data, sizeof(cd->ipc_config));
230+
MOD_DBG(mod);
218231

219232
cd->delay_lines = NULL;
233+
MOD_DBG(mod);
220234
cd->src_func = src_fallback;
235+
MOD_DBG(mod);
221236
cd->polyphase_func = NULL;
237+
MOD_DBG(mod);
222238
src_polyphase_reset(&cd->src);
239+
MOD_DBG(mod);
223240

224241
comp_dbg(dev, "channels_count = %d, depth = %d",
225242
cd->ipc_config.base.audio_fmt.channels_count,
226243
cd->ipc_config.base.audio_fmt.depth);
244+
MOD_DBG(mod);
227245
comp_dbg(dev, "sampling frequency = %d, sink rate = %d",
228246
cd->ipc_config.base.audio_fmt.sampling_frequency, cd->ipc_config.sink_rate);
247+
MOD_DBG(mod);
229248
cd->source_rate = cd->ipc_config.base.audio_fmt.sampling_frequency;
249+
MOD_DBG(mod);
230250
cd->sink_rate = cd->ipc_config.sink_rate;
251+
MOD_DBG(mod);
231252
cd->channels_count = cd->ipc_config.base.audio_fmt.channels_count;
253+
MOD_DBG(mod);
232254
switch (cd->ipc_config.base.audio_fmt.depth) {
233255
case IPC4_DEPTH_16BIT:
234256
cd->sample_container_bytes = sizeof(int16_t);
257+
MOD_DBG(mod);
235258
break;
236259
case IPC4_DEPTH_24BIT:
237260
case IPC4_DEPTH_32BIT:
238261
cd->sample_container_bytes = sizeof(int32_t);
262+
MOD_DBG(mod);
239263
break;
240264
default:
241265
comp_err(dev, "Illegal sample depth %d",
242266
cd->ipc_config.base.audio_fmt.depth);
267+
MOD_DBG(mod);
243268
return -EINVAL;
244269
}
270+
MOD_DBG(mod);
245271

246272
return 0;
247273
}

src/library_manager/lib_manager.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,7 @@ static struct comp_dev *lib_manager_module_create(const struct comp_driver *drv,
642642

643643
mod = (const struct sof_man_module *)
644644
((const uint8_t *)desc + SOF_MAN_MODULE_OFFSET(entry_index));
645+
tr_err(&lib_manager_tr, "lib_manager_module_create %.8s.", mod->name);
645646

646647
const uintptr_t module_entry_point = lib_manager_allocate_module(mod, config, args->data);
647648

@@ -652,15 +653,18 @@ static struct comp_dev *lib_manager_module_create(const struct comp_driver *drv,
652653

653654
switch (lib_manager_get_module_type(desc, mod)) {
654655
case MOD_TYPE_LLEXT:
656+
tr_err(&lib_manager_tr, "MOD_TYPE_LLEXT");
655657
agent = NULL;
656658
ops = (const struct module_interface *)module_entry_point;
657659
break;
658660
case MOD_TYPE_LMDK:
661+
tr_err(&lib_manager_tr, "MOD_TYPE_LMDK");
659662
agent = &native_system_agent_start;
660663
agent_iface = (const void **)&ops;
661664
break;
662665
#if CONFIG_INTEL_MODULES
663666
case MOD_TYPE_IADK:
667+
tr_err(&lib_manager_tr, "MOD_TYPE_IADK");
664668
agent = &system_agent_start;
665669
ops = &processing_module_adapter_interface;
666670
agent_iface = (const void **)&adapter_priv;
@@ -754,6 +758,7 @@ int lib_manager_register_module(const uint32_t component_id)
754758
component_id);
755759
return -ENOENT;
756760
}
761+
tr_err(&lib_manager_tr, "Register %u %.8s, user %u", component_id, mod->name, mod->type.user_mode);
757762

758763
/* allocate new comp_driver_info */
759764
new_drv_info = rmalloc(SOF_MEM_FLAG_KERNEL | SOF_MEM_FLAG_COHERENT,

0 commit comments

Comments
 (0)