Skip to content

Conversation

@jsarha
Copy link

@jsarha jsarha commented Jun 17, 2025

Add new module init payload (this has already been partly specified in SOF FW src/include/ipc4/module.h) and use that to pass new topology widget properties to FW. The original ext_init payload needed some extension for this and there is a draft PR supporting this new payload here:

thesofproject/sof#10064

@jsarha jsarha force-pushed the new_component_attributes branch from 38a9088 to d22b571 Compare June 18, 2025 13:37
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsarha does it make sense to move this to each widget's setup op? I mean this is static data parsed from the topology right? So it isnt going to change from every instance of start/stop isnt it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put it there only because that is where the IPC payload is put together. The ext_init payload could be created already at sof_ipc4_widget_setup_msg() and store it somewhere, but we would still have to allocate memory and concatenate different payloads together in sof_ipc4_widget_setup(), so the benefit would be mostly cosmetic.

That is unless I take on a bigger rework, find a standard place for setup msg payloads in snd_sof_widget for all modules (except pipelines), and put custom made payloads there. That would still only be a trade from saved cycles to consumed memory.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsarha why would you need to allocate memory only here? You can do the same earlier as well.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently the payloads are module specific, initialized where ever, and not having common place in sof_widget. The ext_init payload however would not depend on the module its using. It would be relatively straight forward to add a pointer for storing the ext_init payload to sof_widget in setup_msg(). However, the ext_init payload should still be concatenated with the current module specific payload in widget_setup().

I guess it would be possible to create the full IPC payloads also already at topology read phase. That would however require fixing the current situation, where there is no common place for init message payloads, and each module code stores it somewhere in its own private memory space.

@jsarha jsarha force-pushed the new_component_attributes branch from d22b571 to a858b2f Compare June 24, 2025 22:03
@jsarha
Copy link
Author

jsarha commented Jun 30, 2025

@ujfalusi , @lyakh , @ranj063 , could give another look at this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are the options for domain ID?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its supposed to describe a domain in usespace that can share data or something like that. I do not exactly know, and the implementation does not exist yet. @lgirdwood asked me to add it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return 1? This looks awkward. How about returning the size of the payload?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should return new_size instead of passing the pointer to it

Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment I left also to FW PR review.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as to FW 10064. We already have a concept of "extended init". E.g. we have:

»       struct sof_ipc4_base_module_cfg base_config;
»       struct sof_ipc4_base_module_cfg_ext *base_config_ext;

All modules have base_config, but some have base_config_ext additionally. This new PR (and the bit29) seems to add a way to extend the module init data, but still keeps the old "base_config_ext" around as well. Having too "extended" module configs is highly confusing. Can we call this new variant something clearly different?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I address all the other comments first and push a new version. I take on this tomorrow, when I am certain we have an agreement on what to do. Let's continue the discussion on FW PR side.

…bytes

Add topology tokens for defining user-space domain_id, required stack
and heap size byte for a component. The new topology tokens are
SOF_TKN_COMP_DOMAIN_ID, SOF_TKN_COMP_HEAP_BYTES_REQUIREMENT and
SOF_TKN_COMP_STACK_BYTES_REQUIREMENT for defining required stack and
heap size for a component.

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
@jsarha jsarha force-pushed the new_component_attributes branch from a858b2f to dd43c3e Compare July 1, 2025 21:57
@jsarha
Copy link
Author

jsarha commented Jul 1, 2025

@ranj063 your comments should be addressed, could you check? I try to agree with @kv2019i on #5460 (comment) tomorrow.

@jsarha
Copy link
Author

jsarha commented Jul 3, 2025

@ujfalusi , @ranj063 , @kv2019i would this be Ok now?

lyakh
lyakh previously approved these changes Jul 3, 2025
Copy link
Collaborator

@lyakh lyakh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a formal ack

ujfalusi
ujfalusi previously approved these changes Jul 3, 2025
@ranj063
Copy link
Collaborator

ranj063 commented Jul 3, 2025

@jsarha there are some legit checkpatch warnings. Can you please fix those? And I think its better to use u32 over uint32_t. I understand you want to keep it aligned with the firmware side but even so someone else will definitely complain about it. SO better to do it ourselves.

Jyri Sarha added 2 commits July 3, 2025 19:31
Add dp_domain_id, dp_heap_bytes and dp_stack_bytes to struct
snd_sof_widget and fill the values from topology tuples with
SOF_TKN_COMP_DOMAIN_ID, SOF_TKN_COMP_STACK_BYTES_REQUIREMENT and
SOF_TKN_COMP_HEAP_BYTES_REQUIREMENT tokens.

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
Add structs and macros for struct sof_ipc4_module_init_ext_init,
following struct sof_ipc4_module_init_ext_object array, and
struct sof_ipc4_mod_init_ext_dp_memory_data as object payload.

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
Add of_ipc4_widget_setup_msg_payload() for adding struct
sof_ipc4_module_init_ext_init payload with associated objects. The
function allocates memory for the additional payload, sets up the
payload according to data collected from topology, and copies
pre-encoded module specific payload after the ext_init payload. The
function is called in sof_ipc4_widget_setup().

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
@jsarha
Copy link
Author

jsarha commented Jul 3, 2025

@jsarha there are some legit checkpatch warnings. Can you please fix those? And I think its better to use u32 over uint32_t. I understand you want to keep it aligned with the firmware side but even so someone else will definitely complain about it. SO better to do it ourselves.

I do not know which ones you considered legit, and do not have time to be stubborn any more, so I fixed all of them... Even if shortening 75 char commit message line due to "Prefer a maximum 75 chars per line" feels a bit stupid, and there were some reasonable arguments against some other warnings too.

@jsarha jsarha dismissed stale reviews from ujfalusi and lyakh via b7e8825 July 3, 2025 16:49
@jsarha jsarha force-pushed the new_component_attributes branch from dd43c3e to b7e8825 Compare July 3, 2025 16:49
@ranj063 ranj063 requested review from lyakh and ujfalusi July 3, 2025 17:07
Copy link
Collaborator

@lyakh lyakh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, I think I mentioned u32 before ;-)

@jsarha
Copy link
Author

jsarha commented Jul 21, 2025

@ranj063 , @ujfalusi , @kv2019i , any particular reason to delay merging this PR?

@jsarha
Copy link
Author

jsarha commented Aug 19, 2025

@ujfalusi , I hoped your approval would mean that this is to be merged soon, but its been two weeks now. Are we waiting for something?

@ujfalusi ujfalusi merged commit dbed0a3 into thesofproject:topic/sof-dev Aug 19, 2025
8 of 16 checks passed
@ujfalusi
Copy link
Collaborator

@jsarha, the stars now aligned, sorry for the delay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants