-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UUID kernel implementation #2215
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, while I was focusing on the docs thesofproject/sof-docs#245 review, it seems there was a massive discussions on the kernel patch as well. The extended_data trick is somewhat convoluted, but I don't really see a cleaner way to get the same effect -- it seems this is the (minimal) price we pay for keeping the ABI MAJOR intact. Together with the sof-docs update, this is good to go from my part, so approving. Thanks @keyonjie !
Somewhere in #2090 I found by chance your explanation that the sizeof the extended data is not constant and not part of the ABI because it's not actually the constant I think it would reduce confusion and there would be fewer memory questions (like for instance @ranj063 ) and risk of bugs if you:
This would probably simplify the sanity checks in https://github.com/thesofproject/sof/pull/2920/files as well. |
comp.hdr.size is the total size, this is the alignment b/w FW and driver, see in the FW source mailbox_validate(). |
Yes I'm suggesting not to include the extended data in comp.hdr.size, is it not possible and why not? |
I think it's a requirement that the firmware knows the total payload upfront. |
Based on that negative answer to @kv2019i in old #2090 about adding some reserved field and reading the current code at https://github.com/thesofproject/sof/pull/2920/files, from the firmware perspective the total size is: How's that not available upfront? In fact
As far as I understand extended_data is a variable-size structure concatenated at the end of another variable-size structure (comp_foo). So I don't think you can make the former a flexible array member of the latter because the latter has a variable size too. I'm also not sure it would really make this code clearer either, for a start you'd have to cast it to your actual structure. I see fairly large and recurring number of questions about
All the above and how much time it took me to understand these size questions demonstrate that the design of the main feature is neither clear nor widely understood yet. This would IMHO be better discussed in one github issue or one documentation PR rather than scattered across multiple code PRs. |
I don't think that's the case, we've removed all flexible array parts previously? It'd be really bad if we indeed have two parts of varying size, that is not by design and not the intention. |
It depends what you mean by "variable", which is exactly the part of the design that is not documented well enough and the source of multiple questions and confusion. You're right, nothing is variable from a narrow C compiler perspective, however:
|
@marc-hb @plbossart what we are talking here is about IPC commands, we share the exactly same header (struct sof_ipc_cmd_hdr) for all these IPC commands. Among all the different IPC commands, e.g. component new, set/get volume, trigger start/stop, the payload could be very different. What we care most here is the component new IPC commands (where they share the same header struct sof_ipc_comp). I don't think we have data[0]-liked flexible array defined here (though we have it in the TLV set/get data commands), if you ask what is variable here, back to @kv2019i 's summary, I would say they are actually like this: COMP_COMMON_DATA (fixed, 8 Bytes struct sof_ipc_cmd_hdr for all IPC commands, 28 Bytes struct sof_ipc_comp for all component new IPCs) |
Thanks @kv2019i your remained comments addressed and updated now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The github make me confuse about what change you are referring to, I think it's this? Yes, that question was asked several reviewers and the commit was split out, but yes, I can move it out and submit another PR with it. |
Add the definition SOF_TKN_COMP_UUID for the component UUID token, this shall be used for all types of component in the future. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Add member comp_ext to struct snd_sof_widget, which will be used for topology extended tokens parsing. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Add comp_ext_tokens which will be used to parse all extended tokens, these tokens will be stored it to struct snd_sof_widget. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Parse comp_ext_tokens in the common sof_widget_ready(), and the swidget->comp_ext will be used to construct the COMP_NEW ipc in the subsequent commits. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Use the 32bit reserved member of the struct sof_ipc_comp as the extended data length, this will help to minimize the ABI change for adding new extended data to the struct sof_ipc_comp, usually only minor ABI version bump needed for every update with this new solution. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Add helper to allocate buffer for IPC component, configure the basic settings, and set up the extended data for the subsequent IPC sending. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Append the extended data to the end of the struct sof_ipc_comp_dai, and update the ext_data_offset, to construct the IPC for the topology load and runtime restore. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Append the extended data to the end of the struct sof_ipc_comp_mixer, construct the ipc for COMP_NEW during the topology load stage. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Append the extended data to the end of the struct sof_ipc_comp_volume, construct the ipc for COMP_NEW during the topology load stage. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Append the extended data to the end of the struct sof_ipc_comp_host, construct the ipc for COMP_NEW during the topology load stage. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Append the extended data to the end of the struct sof_ipc_comp_src, construct the ipc for COMP_NEW during the topology load stage. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Append the extended data to the end of the struct sof_ipc_comp_asrc, construct the ipc for COMP_NEW during the topology load stage. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Append the extended data to the end of the struct sof_ipc_comp_tone, construct the ipc for COMP_NEW during the topology load stage. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Append the extended data to the end of the struct sof_ipc_comp_process, construct the ipc for COMP_NEW during the topology load stage. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Append the extended data to the end of the struct sof_ipc_comp_mux, construct the ipc for COMP_NEW during the topology load stage. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
no time to review this, will let others review and merge if relevant
@ranj063 can you help to merge this as Kai and Bard approved it also. |
Thanks @keyonjie and all reviewers, this has been a very, very long one! The one checkpatch issue relates to stdint types and is a known thing (we use C99 style types to keep definitions aligned with FW). So with that, this is ready to go, merging. |
This is the series for UUID support -- Kernel part, it should be used together with the tplg part(thesofproject/sof#2919) and Firmware part(thesofproject/sof#2920).
This is a replacement for #2090