Skip to content
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

Check fw boot flags to load library #4643

Closed
wants to merge 2 commits into from

Conversation

RanderWang
Copy link

@RanderWang RanderWang commented Oct 18, 2023

Follow IPC3 method to fw_ready flags and skip library reload if D3_PERSISTENT is supported.

FW PR: thesofproject/sof#8342

sound/soc/sof/ipc4.c Outdated Show resolved Hide resolved
Kernel uses fw_ready information to get fw boot config.

Signed-off-by: Rander Wang <[email protected]>
If fw supports both IMR booting and D3 context save, library reload
can be skipped, or library should be reloaded.

Signed-off-by: Rander Wang <[email protected]>
@RanderWang
Copy link
Author

update according to FW change. Get fw_ready info to check boot flags. thesofproject/sof#8342

/* IMR booting will restore the libraries as well, skip the loading */
if (reload && hda->booted_from_imr)
/* if IMR booting and D3 context save are supported, skip the loading */
if (reload && hda->booted_from_imr && sdev->fw_ready.flags & SOF_IPC_INFO_CONTEXT_SAVE)
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is going to fail with reference firmware. FW_READY in IPC4 does not contain payload, thus the "fw_ready" is going to be all 0, the flag is 0 but the reference fw does have context save and the library re-load will fail since we are trying to load already loaded library.

Or do I miss something?

Copy link
Author

Choose a reason for hiding this comment

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

so what 's your advice ? I don't want to add more config in get_fw config which is also not compatible with reference fw.

@@ -599,6 +601,13 @@ static int ipc4_fw_ready(struct snd_sof_dev *sdev, struct sof_ipc4_msg *ipc4_msg
sdev->debug_box.offset = snd_sof_dsp_get_window_offset(sdev,
SOF_IPC4_DEBUG_WINDOW_IDX);

ret = snd_sof_dsp_block_read(sdev, SOF_FW_BLK_TYPE_SRAM, inbox_offset, fw_ready,
sizeof(*fw_ready));
Copy link
Collaborator

Choose a reason for hiding this comment

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

struct sof_ipc_fw_ready is the IPC3 fw_ready message. IPC4 does not define payload for FW_READY notification.
Reference fw definitely not giving any payload. The way to get the configuration and parameters is via GET_LARGE_CONFIG:FW_CONFIG, but that does not have a tuple defined for context save support as it is always supported in the reference fw along with IMR boot.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@ujfalusi why do we need to worry about the reference firmware in the context of library loading? Is this something we will ever test?

Copy link
Member

Choose a reason for hiding this comment

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

We should only lose compatibility with a reference when all possible alternatives have been exhausted...

@RanderWang
Copy link
Author

no need

@RanderWang RanderWang closed this Oct 27, 2023
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.

4 participants