-
Notifications
You must be signed in to change notification settings - Fork 308
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
Audio: basefw: Implement ipc4 modules info get #9032
Conversation
src/audio/base_fw.c
Outdated
@@ -497,6 +520,7 @@ static int basefw_get_large_config(struct comp_dev *dev, | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this handler will also handle IPC4_DSP_RESOURCE_STATE
and IPC4_NOTIFICATION_MASK
?
src/audio/base_fw.c
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation
src/audio/base_fw.c
Outdated
|
||
module_info->modules_count = desc->header.num_module_entries; | ||
|
||
for(int idx = 0; idx < module_info->modules_count; ++idx){ |
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.
space before {
src/audio/base_fw.c
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sizeof(module_info->modules[idx])
as the last parameter
src/audio/base_fw.c
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd do sizeof(module_info->modules_count) + module_info->modules_count * sizeof(module_info->modules[0])
- makes it clearer what is calculated IMHO
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.
Some review comments inline.
src/audio/base_fw.c
Outdated
{ | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -329,7 +329,7 @@ struct ipc_cmd_hdr; | |||
#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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IPC fuzz failed only for IPC3 so please try this @gbernatxintel
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.
Done
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.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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
src/include/ipc/header.h
Outdated
@@ -329,8 +329,11 @@ struct ipc_cmd_hdr; | |||
#define SOF_IPC_MESSAGE_ID(x) ((x) & 0xffff) | |||
|
|||
/** Maximum message size for mailbox Tx/Rx */ | |||
#if IPC4 |
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.
Can you check the Kconfig symbol for IPC4, it should be something like CONFIG_IPC4
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.
@gbernatxintel use #ifdef CONFIG_IPC_MAJOR_4
src/include/ipc4/base_fw.h
Outdated
@@ -17,6 +17,10 @@ | |||
#ifndef __SOF_IPC4_BASE_FW_H__ | |||
#define __SOF_IPC4_BASE_FW_H__ | |||
|
|||
#ifdef CONFIG_INTEL |
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.
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? |
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.
#9060 was merged, so you'll need to rebase this.
@@ -329,7 +329,7 @@ struct ipc_cmd_hdr; | |||
#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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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
src/include/kernel/abi.h
Outdated
@@ -29,7 +29,7 @@ | |||
|
|||
/** \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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
src/audio/base_fw.c
Outdated
@@ -461,7 +466,9 @@ static int basefw_get_large_config(struct comp_dev *dev, | |||
/* TODO: add more support */ | |||
case IPC4_DSP_RESOURCE_STATE: | |||
case IPC4_NOTIFICATION_MASK: | |||
break; |
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.
Why is this not even printing a warning?
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move out the IPC4_MODULES_INFO_GET case from the TODO list.
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.
done, currently all implemented cases are before the TODO comment
@@ -329,7 +329,7 @@ struct ipc_cmd_hdr; | |||
#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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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;
src/audio/base_fw.c
Outdated
@@ -461,7 +466,9 @@ static int basefw_get_large_config(struct comp_dev *dev, | |||
/* TODO: add more support */ | |||
case IPC4_DSP_RESOURCE_STATE: | |||
case IPC4_NOTIFICATION_MASK: | |||
break; |
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.
move out the IPC4_MODULES_INFO_GET case from the TODO list.
src/audio/base_fw.c
Outdated
@@ -461,7 +466,9 @@ static int basefw_get_large_config(struct comp_dev *dev, | |||
/* TODO: add more support */ | |||
case IPC4_DSP_RESOURCE_STATE: | |||
case IPC4_NOTIFICATION_MASK: | |||
break; | |||
case IPC4_MODULES_INFO_GET: |
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 commit message can use some update.
"Added support for ipc4 query no 9."
->
"Add support to handle IPC4_MODULES_INFO_GET message."
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.
Fixed
@@ -334,6 +334,11 @@ static int basefw_libraries_info_get(uint32_t *data_offset, char *data) | |||
return 0; | |||
} | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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.
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.
one error to correct
module_entry, sizeof(struct sof_man_module)); | ||
} | ||
|
||
*data_offset = sizeof(module_info) + |
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.
you meant sizeof(*module_info)
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.
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.