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

Query FW config to reload library #4680

Merged
merged 3 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions include/sound/sof/ipc4/header.h
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,12 @@ enum sof_ipc4_fw_config_params {
SOF_IPC4_FW_CFG_RESERVED,
SOF_IPC4_FW_CFG_POWER_GATING_POLICY,
SOF_IPC4_FW_CFG_ASSERT_MODE,
SOF_IPC4_FW_RESERVED1,
SOF_IPC4_FW_RESERVED2,
SOF_IPC4_FW_RESERVED3,
SOF_IPC4_FW_RESERVED4,
SOF_IPC4_FW_RESERVED5,
SOF_IPC4_FW_CONTEXT_SAVE
};

struct sof_ipc4_fw_version {
Expand Down
5 changes: 3 additions & 2 deletions sound/soc/sof/intel/hda-loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,14 +551,15 @@ int hda_dsp_ipc4_load_library(struct snd_sof_dev *sdev,
struct sof_ipc4_fw_library *fw_lib, bool reload)
{
struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
struct sof_ipc4_fw_data *ipc4_data = sdev->private;
struct hdac_ext_stream *hext_stream;
struct firmware stripped_firmware;
struct sof_ipc4_msg msg = {};
struct snd_dma_buffer dmab;
int ret, ret1;

/* IMR booting will restore the libraries as well, skip the loading */
if (reload && hda->booted_from_imr)
/* if IMR booting is enabled and fw context is saved for D3 state, skip the loading */
if (reload && hda->booted_from_imr && ipc4_data->fw_context_save)
RanderWang marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

it's a bit odd to have different structures to stored 'booted_from_imr' and 'fw_context_save'. Can we put all the information in the same place?

Copy link
Author

Choose a reason for hiding this comment

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

@plbossart booted_from_imr is a intel feature which is set in sof/intel layer. fw_context_save is a common feature which is set in sof core layer. So I don't prefer to combine them in hda structure.

return 0;

/* the fw_lib has been verified during loading, we can trust the validity here */
Expand Down
2 changes: 2 additions & 0 deletions sound/soc/sof/intel/lnl.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ int sof_lnl_ops_init(struct snd_sof_dev *sdev)

ipc4_data->mtrace_type = SOF_IPC4_MTRACE_INTEL_CAVS_2;

ipc4_data->fw_context_save = true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

why do we need the default value to be true?

Copy link
Author

@RanderWang RanderWang Dec 8, 2023

Choose a reason for hiding this comment

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

It is for ref fw which supports it by default. Thanks @ujfalusi mentioned it for several times :)


/* External library loading support */
ipc4_data->load_library = hda_dsp_ipc4_load_library;

Expand Down
2 changes: 2 additions & 0 deletions sound/soc/sof/intel/mtl.c
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,8 @@ int sof_mtl_ops_init(struct snd_sof_dev *sdev)

ipc4_data->mtrace_type = SOF_IPC4_MTRACE_INTEL_CAVS_2;

ipc4_data->fw_context_save = true;

RanderWang marked this conversation as resolved.
Show resolved Hide resolved
/* External library loading support */
ipc4_data->load_library = hda_dsp_ipc4_load_library;

Expand Down
2 changes: 2 additions & 0 deletions sound/soc/sof/intel/tgl.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ int sof_tgl_ops_init(struct snd_sof_dev *sdev)

ipc4_data->mtrace_type = SOF_IPC4_MTRACE_INTEL_CAVS_2;

ipc4_data->fw_context_save = true;

RanderWang marked this conversation as resolved.
Show resolved Hide resolved
/* External library loading support */
ipc4_data->load_library = hda_dsp_ipc4_load_library;

Expand Down
3 changes: 3 additions & 0 deletions sound/soc/sof/ipc4-loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@ int sof_ipc4_query_fw_configuration(struct snd_sof_dev *sdev)
goto out;
}
break;
case SOF_IPC4_FW_CONTEXT_SAVE:
ipc4_data->fw_context_save = *tuple->value;
RanderWang marked this conversation as resolved.
Show resolved Hide resolved
break;
default:
break;
}
Expand Down
1 change: 1 addition & 0 deletions sound/soc/sof/ipc4-priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ struct sof_ipc4_fw_data {
u32 mtrace_log_bytes;
int max_num_pipelines;
u32 max_libs_count;
bool fw_context_save;

int (*load_library)(struct snd_sof_dev *sdev,
struct sof_ipc4_fw_library *fw_lib, bool reload);
Expand Down