Skip to contentSkip to conversation

Add SOF panic dump support for AMD platform.

PATCH In review V sujith kumar Reddy 2 participants 4 messages Dec 5, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Add SOF panic dump support for AMD platform.

This patch series consists of
>> Use poll function instead of simple read ACP_SHA_DSP_FW_QUALIFIER >> Add support for IPC and DSP dumps

Ajye Huang (1):
ASoC: SOF: amd: Use poll function instead to read
ACP_SHA_DSP_FW_QUALIFIER

V sujith kumar Reddy (1):
ASoC : SOF: amd: Add support for IPC and DSP dumps

 sound/soc/sof/amd/Kconfig      |   1 +
 sound/soc/sof/amd/acp-common.c | 108 +++++++++++++++++++++++++++++++++
 sound/soc/sof/amd/acp-ipc.c    |  13 ++++
 sound/soc/sof/amd/acp.c        |   8 ++-
 sound/soc/sof/amd/acp.h        |   6 ++
 5 files changed, 133 insertions(+), 3 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/2 ASoC: SOF: amd: Use poll function instead to read ACP_SHA_DSP_FW_QUALIFIER

From: Ajye Huang <[email protected]>

The Skyrim project and Whiterun met error when DSP loading during device boot.
Ex, error in kernel log,
ERR kernel: [ 16.124537] snd_sof_amd_rembrandt
0000:04:00.5: PSP validation failed.

Use the snd_sof_dsp_read_poll_timeout function to successfully read the FW_QUALIFIER register

---
 sound/soc/sof/amd/acp.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
sound/soc/sof/amd/acp.c +5 -3
index 47115a77c92c..6bd2888fbb66 100644
@@ -255,10 +255,12 @@ int configure_and_run_sha_dma(struct acp_dev_data *adata, void *image_addr,
 	if (ret)
 		return ret;
 
-	fw_qualifier = snd_sof_dsp_read(sdev, ACP_DSP_BAR, ACP_SHA_DSP_FW_QUALIFIER);
-	if (!(fw_qualifier & DSP_FW_RUN_ENABLE)) {
+	ret = snd_sof_dsp_read_poll_timeout(sdev, ACP_DSP_BAR, ACP_SHA_DSP_FW_QUALIFIER,
+					    fw_qualifier, fw_qualifier & DSP_FW_RUN_ENABLE,
+					    ACP_REG_POLL_INTERVAL, ACP_DMA_COMPLETE_TIMEOUT_US);
+	if (ret < 0) {
 		dev_err(sdev->dev, "PSP validation failed\n");
-		return -EINVAL;
+		return ret;
 	}
 
 	return 0;
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/2 ASoC : SOF: amd: Add support for IPC and DSP dumps

In reply to V sujith kumar Reddy

Add support for IPC and DSP dumps for AMD platforms.

---
 sound/soc/sof/amd/Kconfig      |   1 +
 sound/soc/sof/amd/acp-common.c | 108 +++++++++++++++++++++++++++++++++
 sound/soc/sof/amd/acp-ipc.c    |  13 ++++
 sound/soc/sof/amd/acp.h        |   6 ++
 4 files changed, 128 insertions(+)
sound/soc/sof/amd/Kconfig +1 -0
index a305ea6efea9..1cb92d6030e3 100644
@@ -20,6 +20,7 @@ config SND_SOC_SOF_AMD_COMMON
 	select SND_SOC_SOF_IPC3
 	select SND_SOC_SOF_PCI_DEV
 	select SND_AMD_ACP_CONFIG
+	select SND_SOC_SOF_XTENSA
 	select SND_SOC_ACPI if ACPI
 	help
 	  This option is not user-selectable but automatically handled by
sound/soc/sof/amd/acp-common.c +108 -0

129 lines not on this page · raw message

sound/soc/sof/amd/acp-ipc.c +13 -0
index dd6e53c63407..5a02753c4610 100644
@@ -154,8 +154,15 @@ irqreturn_t acp_sof_ipc_irq_thread(int irq, void *context)
 				     offsetof(struct scratch_ipc_conf, sof_dsp_ack_write);
 	bool ipc_irq = false;
 	int dsp_msg, dsp_ack;
+	unsigned int status;
 
 	if (sdev->first_boot && sdev->fw_state != SOF_FW_BOOT_COMPLETE) {
+		acp_mailbox_read(sdev, sdev->dsp_box.offset, &status, sizeof(status));
+		if ((status & SOF_IPC_PANIC_MAGIC_MASK) == SOF_IPC_PANIC_MAGIC) {
+			snd_sof_dsp_panic(sdev, sdev->dsp_box.offset + sizeof(status),
+					  true);
+			return IRQ_HANDLED;
+		}
 		snd_sof_ipc_msgs_rx(sdev);
 		acp_dsp_ipc_host_done(sdev);
 		return IRQ_HANDLED;
@@ -180,6 +187,12 @@ irqreturn_t acp_sof_ipc_irq_thread(int irq, void *context)
 		ipc_irq = true;
 	}
 
+	acp_mailbox_read(sdev, sdev->debug_box.offset, &status, sizeof(u32));
+	if ((status & SOF_IPC_PANIC_MAGIC_MASK) == SOF_IPC_PANIC_MAGIC) {
+		snd_sof_dsp_panic(sdev, sdev->dsp_oops_offset, true);
+		return IRQ_HANDLED;
+	}
+
 	if (!ipc_irq)
 		dev_dbg_ratelimited(sdev->dev, "nothing to do in IPC IRQ thread\n");
 
sound/soc/sof/amd/acp.h +6 -0
index 76ad963faec1..09e16ef8afa0 100644
@@ -69,6 +69,9 @@
 #define BOX_SIZE_512				0x200
 #define BOX_SIZE_1024				0x400
 
+#define EXCEPT_MAX_HDR_SIZE			0x400
+#define AMD_STACK_DUMP_SIZE			32
+
 enum clock_source {
 	ACP_CLOCK_96M = 0,
 	ACP_CLOCK_48M,
@@ -254,6 +257,9 @@ int acp_sof_trace_release(struct snd_sof_dev *sdev);
 int amd_sof_acp_suspend(struct snd_sof_dev *sdev, u32 target_state);
 int amd_sof_acp_resume(struct snd_sof_dev *sdev);
 
+void amd_sof_ipc_dump(struct snd_sof_dev *sdev);
+void amd_sof_dump(struct snd_sof_dev *sdev, u32 flags);
+
 static inline const struct sof_amd_acp_desc *get_chip_info(struct snd_sof_pdata *pdata)
 {
 	const struct sof_dev_desc *desc = pdata->desc;
Signature · 1 line
2.25.1
maintainer
#3 lore raw
In reply to V sujith kumar Reddy
Quoted 9 lines · V sujith kumar Reddy

This patch series consists of
>> Use poll function instead of simple read ACP_SHA_DSP_FW_QUALIFIER >> Add support for IPC and DSP dumps

Ajye Huang (1):
ASoC: SOF: amd: Use poll function instead to read
ACP_SHA_DSP_FW_QUALIFIER

[...]

Applied to

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

Thanks!

[1/2] ASoC: SOF: amd: Use poll function instead to read ACP_SHA_DSP_FW_QUALIFIER

      commit: 2a2f5f2384b9791a028901aac3f49c488839d073
[2/2] ASoC : SOF: amd: Add support for IPC and DSP dumps
      commit: 41cfad23b5ebef2dbddecff2ddeb27ca973f98a8

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