Skip to content

Audio: basefw: Implemented ipc4 libraries info get - #9031

Merged
kv2019i merged 1 commit into
thesofproject:mainfrom
gbernatxintel:gb_branch_1
Apr 23, 2024
Merged

kv2019i merged 1 commit into
thesofproject:mainfrom
gbernatxintel:gb_branch_1

Conversation

@gbernatxintel

Copy link
Copy Markdown
Contributor

Added support for ipc4 query no 16.
This makes it possible to get information about the current basefw library.

lyakh
lyakh previously requested changes Apr 12, 2024
Comment thread src/audio/base_fw.c
Comment thread src/audio/base_fw.c Outdated
Comment thread src/audio/base_fw.c Outdated

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member

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

Comment thread 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);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

will need packed too

@gbernatxintel
gbernatxintel force-pushed the gb_branch_1 branch 5 times, most recently from b0a49ff to 3f28d85 Compare April 15, 2024 12:07
@gbernatxintel

Copy link
Copy Markdown
Contributor Author

SOFCI TEST

Comment thread 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_

Copy link
Copy Markdown
Collaborator

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?

Copy link
Copy Markdown
Contributor Author

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?

Copy link
Copy Markdown
Member

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.

@softwarecki softwarecki Apr 17, 2024 •

Copy link
Copy Markdown
Collaborator

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.

sof/src/ipc/ipc4/helper.c

Lines 959 to 961 in 14c4e86

#ifdef RIMAGE_MANIFEST
desc = (const struct sof_man_fw_desc *)IMR_BOOT_LDR_MANIFEST_BASE;
#else

Copy link
Copy Markdown
Collaborator

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.

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Lets use Kconfig

Comment thread 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_

Copy link
Copy Markdown
Member

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.

@kv2019i kv2019i left a comment

Copy link
Copy Markdown
Collaborator

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

Comment thread 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_

Copy link
Copy Markdown
Collaborator

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.

@gbernatxintel
gbernatxintel force-pushed the gb_branch_1 branch 3 times, most recently from d4ecab6 to 48241b5 Compare April 19, 2024 07:41

@kv2019i kv2019i left a comment

Copy link
Copy Markdown
Collaborator

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!

@softwarecki softwarecki left a comment

Copy link
Copy Markdown
Collaborator

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.

Comment thread src/audio/base_fw.c Outdated
libs_info->library_count++;
}

*data_offset = sizeof(libs_info->library_count) +

Copy link
Copy Markdown
Collaborator

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]);

Comment thread src/audio/base_fw.c
@gbernatxintel
gbernatxintel force-pushed the gb_branch_1 branch 3 times, most recently from eb69c56 to 7baafb8 Compare April 19, 2024 12:43
@kv2019i
kv2019i dismissed lyakh’s stale review April 23, 2024 09:00

Comments addressed

@kv2019i

kv2019i commented Apr 23, 2024

Copy link
Copy Markdown
Collaborator

@softwarecki Ok for you?

Comment thread src/audio/base_fw.c Outdated

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) >

Copy link
Copy Markdown
Collaborator

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)

Added support for ipc4 query no 16. This makes it possible to get
information about the current basefw library.

Signed-off-by: Grzegorz Bernat <grzegorzx.bernat@intel.com>
@kv2019i
kv2019i merged commit 7b0c202 into thesofproject:main Apr 23, 2024
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