-
Notifications
You must be signed in to change notification settings - Fork 321
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: Implemented ipc4 libraries info get #9031
Conversation
5429dc9
to
7dc348c
Compare
5fb41d7
to
90882b9
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.
Will need to additionally pack our ABI
src/include/ipc4/base_fw.h
Outdated
uint16_t build_version; | ||
/* Number of modules packed into the library. */ | ||
uint32_t num_module_entries; | ||
} __aligned(4); |
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.
will need packed too
b0a49ff
to
3f28d85
Compare
SOFCI TEST |
src/audio/base_fw.c
Outdated
libs_info->library_count = 0; | ||
|
||
for (int lib_id = 0; lib_id < LIB_MANAGER_MAX_LIBS; ++lib_id) { | ||
#ifdef ZEPHYR_SOC_INTEL_ADSP_MEMORY_H_ |
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 condition is surprising. What is it supposed to check, apart from a header file is included?
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 exactly what he is supposed to check. Generally it is that in uses the definition which is platform specific. The idea is to check if there is this definition which is in the code. Do you think it's better to replace it with 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.
@kv2019i and I were discussing a src/ipc/ipc4/intel.c
where we could put a lot of the vendor specific code and wrap it with Kconfigs, have it read values from Zephyr DT later too.
It would seem we could use that here too and rather than using the #ifdef ZEPHYR_SOC_INTEL_ADSP_MEMORY_H_
we use a Kconfig CONFIG_SOME_INTEL_MEMORY_OPTION
, so lets use Kconfig now and next step move into an intel specific file.
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.
My question arises from the fact that in another place in the code where the IMR_BOOT_LDR_MANIFEST_BASE
definition is used, the condition looks different. It would be good to check it the same way in both places.
Lines 959 to 961 in 14c4e86
#ifdef RIMAGE_MANIFEST | |
desc = (const struct sof_man_fw_desc *)IMR_BOOT_LDR_MANIFEST_BASE; | |
#else |
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 was looking at the same @softwarecki but later realized RIMAGE_MANIFEST is locally defined in helper.c. However, #9012 was now merged, so we now have a place to put Intel/vendor specific bits of code and don't need to ifdefs like RIMAGE_MANIFEST anymore.
E.g. I'd propose to make getting the base_fw manifest a platform specific call. Something like:
``` `
if (lib_id == 0)
desc = platform_base_fw_get_manifest()
else
desc = lib_manager_get_library_manifest()
And add platform_base_fw_get_manifest() to the newly added base_fw_platform.h and add implementation for Intel ACE and a dummy one for posix.
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.
Lets use Kconfig
src/audio/base_fw.c
Outdated
libs_info->library_count = 0; | ||
|
||
for (int lib_id = 0; lib_id < LIB_MANAGER_MAX_LIBS; ++lib_id) { | ||
#ifdef ZEPHYR_SOC_INTEL_ADSP_MEMORY_H_ |
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 and I were discussing a src/ipc/ipc4/intel.c
where we could put a lot of the vendor specific code and wrap it with Kconfigs, have it read values from Zephyr DT later too.
It would seem we could use that here too and rather than using the #ifdef ZEPHYR_SOC_INTEL_ADSP_MEMORY_H_
we use a Kconfig CONFIG_SOME_INTEL_MEMORY_OPTION
, so lets use Kconfig now and next step move into an intel specific file.
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.
Proposal how to handle the ifdef added inline
src/audio/base_fw.c
Outdated
libs_info->library_count = 0; | ||
|
||
for (int lib_id = 0; lib_id < LIB_MANAGER_MAX_LIBS; ++lib_id) { | ||
#ifdef ZEPHYR_SOC_INTEL_ADSP_MEMORY_H_ |
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 was looking at the same @softwarecki but later realized RIMAGE_MANIFEST is locally defined in helper.c. However, #9012 was now merged, so we now have a place to put Intel/vendor specific bits of code and don't need to ifdefs like RIMAGE_MANIFEST anymore.
E.g. I'd propose to make getting the base_fw manifest a platform specific call. Something like:
``` `
if (lib_id == 0)
desc = platform_base_fw_get_manifest()
else
desc = lib_manager_get_library_manifest()
And add platform_base_fw_get_manifest() to the newly added base_fw_platform.h and add implementation for Intel ACE and a dummy one for posix.
3f28d85
to
bcda0da
Compare
d4ecab6
to
48241b5
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.
Thanks @gbernatxintel , looks good now!
48241b5
to
fa103de
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.
In my opinion, there is a missing check (eg. static assert) to make sure that sizeof(struct ipc4_libraries_info) + LIB_MANAGER_MAX_LIBS * sizeof(struct ipc4_library_props)
not exceed the SOF_IPC_MSG_MAX_SIZE
. Under unfavorable circumstances, this may result in a response buffer overflow.
src/audio/base_fw.c
Outdated
libs_info->library_count++; | ||
} | ||
|
||
*data_offset = sizeof(libs_info->library_count) + |
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 would like change the libraries
filed declaration to struct ipc4_library_props libraries[0];
and then simplify this calculation to *data_offset = sizeof(libs_info) + libs_info->library_count * sizeof(libs_info->libraries[0]);
eb69c56
to
7baafb8
Compare
@softwarecki Ok for you? |
src/audio/base_fw.c
Outdated
@@ -425,6 +427,56 @@ static int basefw_power_state_info_get(uint32_t *data_offset, char *data) | |||
return 0; | |||
} | |||
|
|||
static int basefw_libraries_info_get(uint32_t *data_offset, char *data) | |||
{ | |||
if (sizeof(uint32_t) + LIB_MANAGER_MAX_LIBS * sizeof(struct ipc4_library_props) > |
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(uint32_t) -> sizeof(struct ipc4_libraries_info)
7baafb8
to
fad6971
Compare
Added support for ipc4 query no 16. This makes it possible to get information about the current basefw library. Signed-off-by: Grzegorz Bernat <[email protected]>
fad6971
to
4a5217b
Compare
Added support for ipc4 query no 16.
This makes it possible to get information about the current basefw library.