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
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ 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] 7+ 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
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ 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] 7+ 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 subsequent siblings)
  4 siblings, 0 replies; 7+ 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] 7+ 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
  2026-11-30 16:21 ` Mark Brown
  2026-11-30 16:24 ` Mark Brown
  4 siblings, 0 replies; 7+ 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] 7+ 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
                   ` (2 preceding siblings ...)
  2026-11-30  9:14 ` [PATCH v2 0/2] ASoC: SOF: amd: acp7x: fix S4 resume with ASP carveout firmware loading Mukunda,Vijendar
@ 2026-11-30 16:21 ` Mark Brown
  2026-12-01  5:39   ` Mukunda,Vijendar
  2026-11-30 16:24 ` Mark Brown
  4 siblings, 1 reply; 7+ messages in thread
From: Mark Brown @ 2026-11-30 16:21 UTC (permalink / raw)
  To: sravisar
  Cc: broonie, 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

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

I'll apply this but I'm not convinced it does the right thing on
hibernate, we don't notice that the DSP was powered down since the
snapshot is taken before that.

-- 
Mark Brown <broonie@kernel.org>

^ permalink raw reply	[flat|nested] 7+ 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
                   ` (3 preceding siblings ...)
  2026-11-30 16:21 ` Mark Brown
@ 2026-11-30 16:24 ` Mark Brown
  4 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2026-11-30 16:24 UTC (permalink / raw)
  To: sravisar
  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

On Mon, 30 Nov 2026 14:32:21 +0530, sravisar@amd.com wrote:
> ASoC: SOF: amd: acp7x: fix S4 resume with ASP carveout firmware loading
> 
> 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.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.5

Thanks!

[1/2] ASoC: SOF: amd: acp7x: enable ACPI target power states
      https://git.kernel.org/broonie/sound/c/8d1e5a7a1b58
[2/2] ASoC: SOF: amd: acp7x: reload firmware from disk on S4 resume
      https://git.kernel.org/broonie/sound/c/f256500eae71

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


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

* Re: [PATCH v2 0/2] ASoC: SOF: amd: acp7x: fix S4 resume with ASP carveout firmware loading
  2026-11-30 16:21 ` Mark Brown
@ 2026-12-01  5:39   ` Mukunda,Vijendar
  0 siblings, 0 replies; 7+ messages in thread
From: Mukunda,Vijendar @ 2026-12-01  5:39 UTC (permalink / raw)
  To: Mark Brown, sravisar
  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 21:51, Mark Brown wrote:
>> 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.
> I'll apply this but I'm not convinced it does the right thing on
> hibernate, we don't notice that the DSP was powered down since the
> snapshot is taken before that.
The DSP is stopped before the snapshot. amd_sof_acp7x_suspend()
applies ACP soft reset (ACP_ASSERT_RESET / ACP_RELEASE_RESET) which
resets all ACP registers to their default values including
ACP_DSP0_RUNSTALL which defaults to 0x01 (stalled). DSP firmware
execution stops before create_image() is called.

What the snapshot does not capture is the subsequent loss of DDR
carveout content, which only happens after the image is written to
disk and the platform enters S4/S5. Patch 2 handles this by clearing
fw_code_carveout_addr at the start of amd_sof_acp7x_resume() when
system_suspend_target > SOF_SUSPEND_S3, before the firmware loader
runs. The loader's fast-path gate:

     if (adata->fw_code_carveout_addr)
         goto load_data_binary;

always sees zero on S4/S5 restore, forcing a full
request_firmware() + VALIDATE_IMAGE before the DSP is started.

However, while reviewing this further we identified a gap in the
SoundWire clock-stop path. For S3, amd_sof_acp7x_resume() takes
an early return when sdw_en_stat is true (SoundWire was clock-stopped)
since the ACP power tiles and SoundWire link state are preserved.
For S4/S5 this early return is incorrect -- the ACP power tiles
lose power, the SoundWire link is completely reset and the codec
must re-enumerate. The current code takes the same clock-stop fast
path based on the stale snapshot value of sdw_en_stat, skipping
the acp_init() and acp_memory_init() needed for full re-enumeration.

We will send a follow-up patch to gate the sdw_en_stat early return
on system_suspend_target <= SOF_SUSPEND_S3, so S4/S5 always falls
through to the full ACP re-initialization path.


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

end of thread, other threads:[~2026-12-01 12:04 UTC | newest]

Thread overview: 7+ 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
2026-11-30 16:21 ` Mark Brown
2026-12-01  5:39   ` Mukunda,Vijendar
2026-11-30 16:24 ` Mark Brown

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®