mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] ASoC: SOF: amd: acp7x: fix S4 resume with ASP carveout firmware loading
@ 2026-11-30  9:02 sravisar
  2026-11-30  9:02 ` [PATCH v2 1/2] ASoC: SOF: amd: acp7x: enable ACPI target power states sravisar
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: sravisar @ 2026-11-30  9:02 UTC (permalink / raw)
  To: broonie
  Cc: alsa-devel, lgirdwood, perex, tiwai, yung-chuan.liao,
	Basavaraj.Hiregoudar, Sunil-kumar.Dommati, venkataprasad.potturu,
	Syed.SabaKareem, Mario.Limonciello, Richard.Gong,
	Vijendar.Mukunda, linux-sound, linux-kernel, sound-open-firmware,
	Siva Subramanian Ravi Saravanan

From: Siva Subramanian Ravi Saravanan <sravisar@amd.com>

On ACP7.B/7.F with signed firmware, the DSP firmware is loaded through
the ASP carveout in DDR. The carveout loses its contents across S4
(hibernate), but on resume the loader still SHA-DMAs the image from it,
so the DSP fails to boot.

Patch 1 enables ACPI target power states for ACP7.B/7.F so the driver
can tell S4 apart from S3. It does not change behaviour on its own.

Patch 2 clears the cached carveout firmware address on S4/S5 resume,
forcing a full request_firmware() + VALIDATE_IMAGE reload. S0ix/s2idle
resume keeps the fast path.

Changes in v2:
- Patch 2: clear fw_code_carveout_addr at the start of resume for
  S4/S5, before the SoundWire and acp_init()/acp_memory_init() early
  returns, and on suspend if the firmware has crashed or failed to boot.
- Link to v1: https://lore.kernel.org/all/20261125053843.1611378-1-sravisar@amd.com/

Siva Subramanian Ravi Saravanan (2):
  ASoC: SOF: amd: acp7x: enable ACPI target power states
  ASoC: SOF: amd: acp7x: reload firmware from disk on S4 resume

 sound/soc/sof/amd/acp.c       | 11 +++++++++++
 sound/soc/sof/amd/pci-acp7x.c |  2 ++
 2 files changed, 13 insertions(+)


base-commit: a6c7e545d8abac8ad0b48da4c8b4ca5ef8ea8eda
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2] ASoC: SOF: amd: acp7x: enable ACPI target power states
  2026-11-30  9:02 [PATCH v2 0/2] ASoC: SOF: amd: acp7x: fix S4 resume with ASP carveout firmware loading sravisar
@ 2026-11-30  9:02 ` sravisar
  2026-11-30  9:02 ` [PATCH v2 2/2] ASoC: SOF: amd: acp7x: reload firmware from disk on S4 resume sravisar
  2026-11-30  9:14 ` [PATCH v2 0/2] ASoC: SOF: amd: acp7x: fix S4 resume with ASP carveout firmware loading Mukunda,Vijendar
  2 siblings, 0 replies; 4+ messages in thread
From: sravisar @ 2026-11-30  9:02 UTC (permalink / raw)
  To: broonie
  Cc: alsa-devel, lgirdwood, perex, tiwai, yung-chuan.liao,
	Basavaraj.Hiregoudar, Sunil-kumar.Dommati, venkataprasad.potturu,
	Syed.SabaKareem, Mario.Limonciello, Richard.Gong,
	Vijendar.Mukunda, linux-sound, linux-kernel, sound-open-firmware,
	Siva Subramanian Ravi Saravanan

From: Siva Subramanian Ravi Saravanan <sravisar@amd.com>

The ACP7.x PM handlers need to distinguish S4 from S3, since the ASP
firmware carveout in DDR is lost across S4 but preserved across S3.

snd_sof_prepare() derives sdev->system_suspend_target from
acpi_target_system_state() only when use_acpi_target_states is set;
otherwise it defaults to SOF_SUSPEND_S3, and S4 is never detected.

Set use_acpi_target_states for ACP7.B and ACP7.F.

Signed-off-by: Siva Subramanian Ravi Saravanan <sravisar@amd.com>
---
 sound/soc/sof/amd/pci-acp7x.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/sof/amd/pci-acp7x.c b/sound/soc/sof/amd/pci-acp7x.c
index 6aa16d1a12b95..e6edefff5ab9d 100644
--- a/sound/soc/sof/amd/pci-acp7x.c
+++ b/sound/soc/sof/amd/pci-acp7x.c
@@ -67,6 +67,7 @@ static const struct sof_dev_desc acp7b_desc = {
 	.nocodec_tplg_filename	= "sof-acp.tplg",
 	.ops			= &sof_acp7x_ops,
 	.ops_init		= sof_acp7x_ops_init,
+	.use_acpi_target_states = true,
 };
 
 static const struct sof_amd_acp_desc acp7f_chip_info = {
@@ -110,6 +111,7 @@ static const struct sof_dev_desc acp7f_desc = {
 	.nocodec_tplg_filename	= "sof-acp.tplg",
 	.ops			= &sof_acp7x_ops,
 	.ops_init		= sof_acp7x_ops_init,
+	.use_acpi_target_states = true,
 };
 
 static const struct pci_device_id acp7b_pci_id = {
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] ASoC: SOF: amd: acp7x: reload firmware from disk on S4 resume
  2026-11-30  9:02 [PATCH v2 0/2] ASoC: SOF: amd: acp7x: fix S4 resume with ASP carveout firmware loading sravisar
  2026-11-30  9:02 ` [PATCH v2 1/2] ASoC: SOF: amd: acp7x: enable ACPI target power states sravisar
@ 2026-11-30  9:02 ` sravisar
  2026-11-30  9:14 ` [PATCH v2 0/2] ASoC: SOF: amd: acp7x: fix S4 resume with ASP carveout firmware loading Mukunda,Vijendar
  2 siblings, 0 replies; 4+ messages in thread
From: sravisar @ 2026-11-30  9:02 UTC (permalink / raw)
  To: broonie
  Cc: alsa-devel, lgirdwood, perex, tiwai, yung-chuan.liao,
	Basavaraj.Hiregoudar, Sunil-kumar.Dommati, venkataprasad.potturu,
	Syed.SabaKareem, Mario.Limonciello, Richard.Gong,
	Vijendar.Mukunda, linux-sound, linux-kernel, sound-open-firmware,
	Siva Subramanian Ravi Saravanan

From: Siva Subramanian Ravi Saravanan <sravisar@amd.com>

On S4 (hibernate) the ASP carveout in DDR loses power, so the raw
firmware image previously deposited there by VALIDATE_IMAGE is gone.
acp7x_load_firmware_carveout() skips VALIDATE_IMAGE whenever
fw_code_carveout_addr is already set and SHA-DMAs directly from the
carveout, which on S4 resume would read an empty carveout and fail to
boot the DSP.

Clear fw_code_carveout_addr at the start of amd_sof_acp7x_resume() when
the system suspend target is deeper than S3, so the loader takes the full
request_firmware() + VALIDATE_IMAGE path and re-deposits the image into
the carveout. Doing this before the SoundWire clock-stop and
acp_init()/acp_memory_init() early returns ensures it is never skipped.
Resume is used rather than suspend because the platform suspend callback
is not invoked when the DSP is already runtime suspended.

snd_sof_prepare() leaves the target at S3 without querying ACPI when the
firmware has crashed or failed to boot, so S4 cannot be detected in that
case. Also clear fw_code_carveout_addr in amd_sof_acp7x_suspend() for
those firmware states.

S0ix/s2idle resume is unaffected and keeps the fast SHA-DMA path, as the
carveout contents are preserved.

Fixes: cec3598305a6 ("ASoC: SOF: amd: add ASP carveout firmware loading for ACP7.B/7.F")
Signed-off-by: Siva Subramanian Ravi Saravanan <sravisar@amd.com>
---
Changes in v2:
- Clear fw_code_carveout_addr at the start of resume, before the
  early returns, and for S4/S5.
- Also clear it on suspend if the firmware has crashed or failed to boot.
- Link to v1: https://lore.kernel.org/all/20261125053843.1611378-1-sravisar@amd.com/

 sound/soc/sof/amd/acp.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/sound/soc/sof/amd/acp.c b/sound/soc/sof/amd/acp.c
index 0d208df621e29..b93330dcf22e8 100644
--- a/sound/soc/sof/amd/acp.c
+++ b/sound/soc/sof/amd/acp.c
@@ -1585,6 +1585,12 @@ int amd_sof_acp7x_suspend(struct snd_sof_dev *sdev, u32 target_state)
 
 	acp_data = sdev->pdata->hw_pdata;
 
+	/* snd_sof_prepare() can't detect S4 if FW crashed; reload from disk */
+	if (acp_data->asp_carveout_base &&
+	    (sdev->fw_state == SOF_FW_CRASHED ||
+	     sdev->fw_state == SOF_FW_BOOT_FAILED))
+		acp_data->fw_code_carveout_addr = 0;
+
 	if (acp_data->is_sdw_dev && check_acp_sdw_enable_status(sdev)) {
 		snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACP7X_ZSC_DSP_CTRL, 1);
 		return acp_dsp_reset(sdev);
@@ -1655,6 +1661,11 @@ int amd_sof_acp7x_resume(struct snd_sof_dev *sdev)
 
 	acp_data = sdev->pdata->hw_pdata;
 
+	/* Carveout is unpowered in S4/S5; force a full firmware reload */
+	if (acp_data->asp_carveout_base &&
+	    sdev->system_suspend_target > SOF_SUSPEND_S3)
+		acp_data->fw_code_carveout_addr = 0;
+
 	if (acp_data->sdw_en_stat) {
 		snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACP7X_ZSC_DSP_CTRL, 0);
 		snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACP7X_PME_EN, 1);
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 0/2] ASoC: SOF: amd: acp7x: fix S4 resume with ASP carveout firmware loading
  2026-11-30  9:02 [PATCH v2 0/2] ASoC: SOF: amd: acp7x: fix S4 resume with ASP carveout firmware loading sravisar
  2026-11-30  9:02 ` [PATCH v2 1/2] ASoC: SOF: amd: acp7x: enable ACPI target power states sravisar
  2026-11-30  9:02 ` [PATCH v2 2/2] ASoC: SOF: amd: acp7x: reload firmware from disk on S4 resume sravisar
@ 2026-11-30  9:14 ` Mukunda,Vijendar
  2 siblings, 0 replies; 4+ messages in thread
From: Mukunda,Vijendar @ 2026-11-30  9:14 UTC (permalink / raw)
  To: sravisar, broonie
  Cc: alsa-devel, lgirdwood, perex, tiwai, yung-chuan.liao,
	Basavaraj.Hiregoudar, Sunil-kumar.Dommati, venkataprasad.potturu,
	Syed.SabaKareem, Mario.Limonciello, Richard.Gong, linux-sound,
	linux-kernel, sound-open-firmware



On 11/30/26 14:32, sravisar@amd.com wrote:
> [Some people who received this message don't often get email from sravisar@amd.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> From: Siva Subramanian Ravi Saravanan <sravisar@amd.com>
>
> On ACP7.B/7.F with signed firmware, the DSP firmware is loaded through
> the ASP carveout in DDR. The carveout loses its contents across S4
> (hibernate), but on resume the loader still SHA-DMAs the image from it,
> so the DSP fails to boot.
>
> Patch 1 enables ACPI target power states for ACP7.B/7.F so the driver
> can tell S4 apart from S3. It does not change behaviour on its own.
>
> Patch 2 clears the cached carveout firmware address on S4/S5 resume,
> forcing a full request_firmware() + VALIDATE_IMAGE reload. S0ix/s2idle
> resume keeps the fast path.
Reviewed-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
>
> Changes in v2:
> - Patch 2: clear fw_code_carveout_addr at the start of resume for
>    S4/S5, before the SoundWire and acp_init()/acp_memory_init() early
>    returns, and on suspend if the firmware has crashed or failed to boot.
> - Link to v1: https://lore.kernel.org/all/20261125053843.1611378-1-sravisar@amd.com/
>
> Siva Subramanian Ravi Saravanan (2):
>    ASoC: SOF: amd: acp7x: enable ACPI target power states
>    ASoC: SOF: amd: acp7x: reload firmware from disk on S4 resume
>
>   sound/soc/sof/amd/acp.c       | 11 +++++++++++
>   sound/soc/sof/amd/pci-acp7x.c |  2 ++
>   2 files changed, 13 insertions(+)
>
>
> base-commit: a6c7e545d8abac8ad0b48da4c8b4ca5ef8ea8eda
> --
> 2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-30  9:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-30  9:02 [PATCH v2 0/2] ASoC: SOF: amd: acp7x: fix S4 resume with ASP carveout firmware loading sravisar
2026-11-30  9:02 ` [PATCH v2 1/2] ASoC: SOF: amd: acp7x: enable ACPI target power states sravisar
2026-11-30  9:02 ` [PATCH v2 2/2] ASoC: SOF: amd: acp7x: reload firmware from disk on S4 resume sravisar
2026-11-30  9:14 ` [PATCH v2 0/2] ASoC: SOF: amd: acp7x: fix S4 resume with ASP carveout firmware loading Mukunda,Vijendar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®