Repository navigation
Audio: basefw: Implement ipc4 modules info get - #9032
Conversation
| case IPC4_DSP_RESOURCE_STATE: | ||
| case IPC4_NOTIFICATION_MASK: | ||
| case IPC4_MODULES_INFO_GET: | ||
| return basefw_modules_info_get(data_offset, data); |
There was a problem hiding this comment.
this handler will also handle IPC4_DSP_RESOURCE_STATE and IPC4_NOTIFICATION_MASK?
| struct sof_man_module *module_entry = | ||
| (struct sof_man_module *)((char *)desc + SOF_MAN_MODULE_OFFSET(idx)); | ||
| memcpy(&(module_info->modules[idx]), module_entry, sizeof(struct sof_man_module)); | ||
| } |
|
|
||
| module_info->modules_count = desc->header.num_module_entries; | ||
|
|
||
| for(int idx = 0; idx < module_info->modules_count; ++idx){ |
| for(int idx = 0; idx < module_info->modules_count; ++idx){ | ||
| struct sof_man_module *module_entry = | ||
| (struct sof_man_module *)((char *)desc + SOF_MAN_MODULE_OFFSET(idx)); | ||
| memcpy(&(module_info->modules[idx]), module_entry, sizeof(struct sof_man_module)); |
There was a problem hiding this comment.
sizeof(module_info->modules[idx]) as the last parameter
| memcpy(&(module_info->modules[idx]), module_entry, sizeof(struct sof_man_module)); | ||
| } | ||
|
|
||
| *data_offset = sizeof(uint32_t) + module_info->modules_count * sizeof(struct sof_man_module); |
There was a problem hiding this comment.
I'd do sizeof(module_info->modules_count) + module_info->modules_count * sizeof(module_info->modules[0]) - makes it clearer what is calculated IMHO
kv2019i
left a comment
There was a problem hiding this comment.
Some review comments inline.
| { | ||
| struct ipc4_modules_info *const module_info = (struct ipc4_modules_info *)data; | ||
|
|
||
| struct sof_man_fw_desc *desc = (struct sof_man_fw_desc *)IMR_BOOT_LDR_MANIFEST_BASE; |
There was a problem hiding this comment.
This is a bit platform specific. The work to add a platform layer for IPC4 basefw is still in progress, but at a minimum, I think you need to ifdef this with "#ifdef RIMAGE_MANIFEST" like done in ipc4/helper.c.
| #define SOF_IPC_MESSAGE_ID(x) ((x) & 0xffff) | ||
|
|
||
| /** Maximum message size for mailbox Tx/Rx */ | ||
| #define SOF_IPC_MSG_MAX_SIZE 384 |
There was a problem hiding this comment.
I think this needs a separate commit and rationale for the increase. This affects all IPC3 implementations as well and increases memory use as this is directly used to allocate memory (which so far has been 384 bytes).
Or is this something only for IPC4. Then tihs could be changed only if built for IPC4.
There was a problem hiding this comment.
@gbernatxintel We can play safe here. e.g.
#if IPC4
#define SIZE 0x1000
#else
#define SIZE 384
#endif
There was a problem hiding this comment.
IPC fuzz failed only for IPC3 so please try this @gbernatxintel
There was a problem hiding this comment.
@ujfalusi @plbossart This SOF_IPC_MSG_MAX_SIZE is only used in IPC3 code, so if this change is ifdeffed like this, I don't think we need to bump the ABI ver
There was a problem hiding this comment.
@kv2019i, the kernel uses different defines for the message size (in mailbox):
include/sound/sof/header.h:#define SOF_IPC_MSG_MAX_SIZE 384
include/sound/sof/ipc4/header.h:#define SOF_IPC4_MSG_MAX_SIZE 4096
sound/soc/sof/ipc3.c: sdev->ipc->max_payload_size = SOF_IPC_MSG_MAX_SIZE;
sound/soc/sof/ipc4.c: sdev->ipc->max_payload_size = SOF_IPC4_MSG_MAX_SIZE;
68a51da to
11cff4b
Compare
4744f21 to
7f3f141
Compare
| #define SOF_IPC_MESSAGE_ID(x) ((x) & 0xffff) | ||
|
|
||
| /** Maximum message size for mailbox Tx/Rx */ | ||
| #if IPC4 |
There was a problem hiding this comment.
Can you check the Kconfig symbol for IPC4, it should be something like CONFIG_IPC4
| #ifndef __SOF_IPC4_BASE_FW_H__ | ||
| #define __SOF_IPC4_BASE_FW_H__ | ||
|
|
||
| #ifdef CONFIG_INTEL |
There was a problem hiding this comment.
Can we make this a new Kconfig as manifest data is useful and generic that could be used by anyone. e.g. KCONFIG_IPC4_MANIFEST_MODULES we can have other ipc4 manifest kconfisg too as I would imagine a lot of vendors would like to export data.
1111c34 to
a710f66
Compare
|
Update @marc-hb Could you take a look at CI, is there a compilation problem? |
| #define SOF_IPC_MESSAGE_ID(x) ((x) & 0xffff) | ||
|
|
||
| /** Maximum message size for mailbox Tx/Rx */ | ||
| #define SOF_IPC_MSG_MAX_SIZE 384 |
There was a problem hiding this comment.
@ujfalusi @plbossart This SOF_IPC_MSG_MAX_SIZE is only used in IPC3 code, so if this change is ifdeffed like this, I don't think we need to bump the ABI ver
| /** \brief SOF ABI version major, minor and patch numbers */ | ||
| #define SOF_ABI_MAJOR 3 | ||
| #define SOF_ABI_MINOR 29 | ||
| #define SOF_ABI_MINOR 30 |
There was a problem hiding this comment.
So this is not needed as this ABI versioning applies to IPC3 builds.
We still don't have infra to describe IPC4 infra. As this has been pending for long, let me file a ticket -> #9080
Next time please share the link and error message, more specifically: https://github.com/thesofproject/sof/actions/runs/8814185894/job/24193491363?pr=9032
It's either very hard or impossible (depending on which check) to find results again after a force-push. Back to the actual issue: yes this looks like a Github glitch. Since you need to resolve git conflicts anyway, it will hopefully be fixed next time. |
a710f66 to
ffcbe66
Compare
ffcbe66 to
a625185
Compare
| /* TODO: add more support */ | ||
| case IPC4_DSP_RESOURCE_STATE: | ||
| case IPC4_NOTIFICATION_MASK: | ||
| break; |
There was a problem hiding this comment.
Why is this not even printing a warning?
There was a problem hiding this comment.
You seem to be splitting the "TODO", unimplemented section in the middle. This means the second part is losing its "TODO" comment and silently doing nothing with zero comment and zero warning. So now it looks even less intentional and even more like a bug.
There was a problem hiding this comment.
move out the IPC4_MODULES_INFO_GET case from the TODO list.
There was a problem hiding this comment.
done, currently all implemented cases are before the TODO comment
| #define SOF_IPC_MESSAGE_ID(x) ((x) & 0xffff) | ||
|
|
||
| /** Maximum message size for mailbox Tx/Rx */ | ||
| #define SOF_IPC_MSG_MAX_SIZE 384 |
There was a problem hiding this comment.
@kv2019i, the kernel uses different defines for the message size (in mailbox):
include/sound/sof/header.h:#define SOF_IPC_MSG_MAX_SIZE 384
include/sound/sof/ipc4/header.h:#define SOF_IPC4_MSG_MAX_SIZE 4096
sound/soc/sof/ipc3.c: sdev->ipc->max_payload_size = SOF_IPC_MSG_MAX_SIZE;
sound/soc/sof/ipc4.c: sdev->ipc->max_payload_size = SOF_IPC4_MSG_MAX_SIZE;
| /* TODO: add more support */ | ||
| case IPC4_DSP_RESOURCE_STATE: | ||
| case IPC4_NOTIFICATION_MASK: | ||
| break; |
There was a problem hiding this comment.
move out the IPC4_MODULES_INFO_GET case from the TODO list.
| case IPC4_DSP_RESOURCE_STATE: | ||
| case IPC4_NOTIFICATION_MASK: | ||
| break; | ||
| case IPC4_MODULES_INFO_GET: |
There was a problem hiding this comment.
The commit message can use some update.
"Added support for ipc4 query no 9."
->
"Add support to handle IPC4_MODULES_INFO_GET message."
|
|
||
| static int basefw_modules_info_get(uint32_t *data_offset, char *data) | ||
| { | ||
| return platform_basefw_modules_info_get(data_offset, data); |
There was a problem hiding this comment.
why it is offloaded to platform function?
What is the difference between the module info and library info (basefw_libraries_info_get()) to demand this handling?
There was a problem hiding this comment.
I have generally separated the function platform_basefw_modules_info_get(...) instead of implementing everything in base_fw.c because I use the ipc4_modules_info structure which uses sof_man_module.
sof_man_module is defined in rimage/manifest.h
I had a problem with the tests because on non-Intel platforms there is no manifest.h file and the tests did not pass. Besides, this modular approach follows the convention that we create code in base_fw_platform.c
With regard to the differences between basefw_modules_info_get and basefw_libraries_info_get
This basefw_libraries_info_get returns the currently loaded library and other structure.
basefw_modules_info_get returns which modules are loaded and which are not, along with information about them.
In short, both commands return a different data type, different structure. In preparing this PR I looked at previous code and tests that need specific information.
a625185 to
e61dbc6
Compare
| module_entry, sizeof(struct sof_man_module)); | ||
| } | ||
|
|
||
| *data_offset = sizeof(module_info) + |
There was a problem hiding this comment.
you meant sizeof(*module_info)
There was a problem hiding this comment.
Good point, fixed
Maximym ipc4 message size changed to 4kB. This is the size of a page. Signed-off-by: Grzegorz Bernat <grzegorzx.bernat@intel.com>
Add support to handle IPC4_MODULES_INFO_GET message. This make it possible to get information about the current loaded modules. Signed-off-by: Grzegorz Bernat <grzegorzx.bernat@intel.com>
e61dbc6 to
c429510
Compare
|
@lyakh good now ? |
Add support to handle IPC4_MODULES_INFO_GET message.
This make it possible to get information about the current loaded modules.