Skip to content

Commit

Permalink
ipc4: Use saved base_cfg_ext data in ipc_comp_connect()
Browse files Browse the repository at this point in the history
The code here never really worked right.  The module base config
values weren't saved by the core layers, so querying the attribute
returned nothing.  A few components have been modified with a whitebox
workaround where they write directly to the basecfg_ext field in the
module_config, but that's not really an API we should want to support.

Get the values from the now-correctly-saved-and-parsed fields the
module init layer has left for us, with considerable code savings and
much less heap thrashing for the temporary copy.

Signed-off-by: Andy Ross <[email protected]>
  • Loading branch information
andyross committed Jan 3, 2024
1 parent 4dbcff9 commit 595031c
Showing 1 changed file with 34 additions and 9 deletions.
43 changes: 34 additions & 9 deletions src/ipc/ipc4/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,17 +453,42 @@ int ipc_comp_connect(struct ipc *ipc, ipc_pipe_comp_connect *_connect)
if (!cpu_is_me(source->ipc_config.core) && !cross_core_bind)
return ipc4_process_on_core(source->ipc_config.core, false);

/* these might call comp_ipc4_get_attribute_remote() if necessary */
ret = comp_get_attribute(source, COMP_ATTR_BASE_CONFIG, &source_src_cfg);
if (ret < 0) {
tr_err(&ipc_tr, "failed to get base config for module %#x", dev_comp_id(source));
return IPC4_FAILURE;
struct processing_module *srcmod = comp_get_drvdata(source);
struct processing_module *dstmod = comp_get_drvdata(sink);
struct module_config *dstcfg = &dstmod->priv.cfg;
struct module_config *srccfg = &srcmod->priv.cfg;

/* get obs from the base config extension if the src queue ID is non-zero */
if (bu->extension.r.src_queue && bu->extension.r.src_queue < srccfg->nb_output_pins)
obs = srccfg->output_pins[bu->extension.r.src_queue].obs;

/* get obs from base config if src queue ID is 0 or if base config extn is missing */
if (!obs) {
/* these might call comp_ipc4_get_attribute_remote() if necessary */
ret = comp_get_attribute(source, COMP_ATTR_BASE_CONFIG, &source_src_cfg);

if (ret < 0) {
tr_err(&ipc_tr, "failed to get base config for src module %#x",
dev_comp_id(source));
return IPC4_FAILURE;
}
obs = source_src_cfg.obs;
}

ret = comp_get_attribute(sink, COMP_ATTR_BASE_CONFIG, &sink_src_cfg);
if (ret < 0) {
tr_err(&ipc_tr, "failed to get base config for module %#x", dev_comp_id(sink));
return IPC4_FAILURE;
/* get ibs from the base config extension if the sink queue ID is non-zero */
if (bu->extension.r.dst_queue && bu->extension.r.dst_queue < dstcfg->nb_input_pins)
ibs = dstcfg->input_pins[bu->extension.r.dst_queue].ibs;

/* get ibs from base config if sink queue ID is 0 or if base config extn is missing */
if (!ibs) {
ret = comp_get_attribute(sink, COMP_ATTR_BASE_CONFIG, &sink_src_cfg);
if (ret < 0) {
tr_err(&ipc_tr, "failed to get base config for sink module %#x",
dev_comp_id(sink));
return IPC4_FAILURE;
}

ibs = sink_src_cfg.ibs;
}

/* create a buffer
Expand Down

0 comments on commit 595031c

Please sign in to comment.