mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ASoC: SOF: amd: Load alternatively signed firmware with an "_l" suffix
@ 2026-11-04 21:53 Mario Limonciello
  2026-11-05 14:03 ` Péter Ujfalusi
  0 siblings, 1 reply; 4+ messages in thread
From: Mario Limonciello @ 2026-11-04 21:53 UTC (permalink / raw)
  To: Liam Girdwood, Peter Ujfalusi, Bard Liao, Daniel Baluta,
	Kai Vehmanen, Pierre-Louis Bossart, Vijendar Mukunda, Mark Brown,
	Jaroslav Kysela, Takashi Iwai
  Cc: sound-open-firmware, linux-sound, linux-kernel, Mario Limonciello

Platforms ship BIOS with either a default or an alternative trust
authority. The PSP validates the signed DSP firmware image so it must
be signed with the matching scheme. Firmware for the alternative scheme
is named with an "_l" suffix before the extension
(e.g. "sof-X-code.bin" becomes "sof-X-code_l.bin").

The PSP reports the signing type in bit 6 of C2PMSG_63
(0 = default, 1 = alternative). Read it over SMN, as is already done
for the other PSP mailbox registers, when building the signed code
image name, and add the "_l" suffix for the alternative scheme.

Reviewed-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 sound/soc/sof/amd/acp.c | 33 ++++++++++++++++++++++++++++++++-
 sound/soc/sof/amd/acp.h |  2 ++
 2 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/sound/soc/sof/amd/acp.c b/sound/soc/sof/amd/acp.c
index 86e2402b8ffd2..2f1a8be8460d4 100644
--- a/sound/soc/sof/amd/acp.c
+++ b/sound/soc/sof/amd/acp.c
@@ -1212,6 +1212,31 @@ static int amd_sof_sdw_exit(struct snd_sof_dev *sdev)
 }
 #endif
 
+/*
+ * The PSP validates the signed DSP firmware, so it must be signed with the
+ * scheme the platform firmware uses: images for the alternative scheme are
+ * named with an "_l" suffix before the extension, the default ones have none.
+ */
+static int amd_sof_acp_get_fw_suffix(struct snd_sof_dev *sdev, const char **suffix)
+{
+	u32 val;
+	int ret;
+
+	ret = amd_smn_read(0, MP0_C2PMSG_63_REG, &val);
+	if (ret) {
+		dev_err(sdev->dev, "failed to read PSP firmware signing type: %d\n", ret);
+		return ret;
+	}
+
+	/* all ones means the register isn't accessible */
+	if (val == 0xffffffff)
+		return -EIO;
+
+	*suffix = (val & MP0_C2PMSG_63_FW_SIGN_ALT) ? "_l" : "";
+
+	return 0;
+}
+
 int amd_sof_acp_probe(struct snd_sof_dev *sdev)
 {
 	struct pci_dev *pci = to_pci_dev(sdev->dev);
@@ -1448,8 +1473,14 @@ int amd_sof_acp7x_probe(struct snd_sof_dev *sdev)
 	sdev->debug_box.size = BOX_SIZE_1024;
 
 	if (adata->acp_sof_signed_firmware_image) {
+		const char *fw_suffix;
+
+		ret = amd_sof_acp_get_fw_suffix(sdev, &fw_suffix);
+		if (ret)
+			goto free_ipc_irq;
+
 		adata->fw_code_bin = devm_kasprintf(sdev->dev, GFP_KERNEL,
-						    "sof-%s-code.bin", chip->name);
+						    "sof-%s-code%s.bin", chip->name, fw_suffix);
 		if (!adata->fw_code_bin) {
 			ret = -ENOMEM;
 			goto free_ipc_irq;
diff --git a/sound/soc/sof/amd/acp.h b/sound/soc/sof/amd/acp.h
index b17a36b31ee0d..81eeeabc5cf5c 100644
--- a/sound/soc/sof/amd/acp.h
+++ b/sound/soc/sof/amd/acp.h
@@ -97,6 +97,8 @@
 #define ACP_EXT_INTR_ERROR_STAT			0x20000000
 #define MP0_C2PMSG_114_REG			0x3810AC8
 #define MP0_C2PMSG_73_REG			0x3810A24
+#define MP0_C2PMSG_63_REG			0x38109FC
+#define MP0_C2PMSG_63_FW_SIGN_ALT		BIT(6)
 #define MBOX_ACP_SHA_DMA_COMMAND		0x70000
 #define MBOX_ACP_IRAM_DRAM_FENCE_COMMAND	0x80000
 #define MBOX_DELAY_US				1000

---
base-commit: 68e9934bd17af558b62cac8a444de28d4d5cdb9f
change-id: 20261104-superm1-lms-sound-c0f429351fc7

Best regards,
--  
Mario Limonciello <mario.limonciello@amd.com>


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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-04 21:53 [PATCH] ASoC: SOF: amd: Load alternatively signed firmware with an "_l" suffix Mario Limonciello
2026-11-05 14:03 ` Péter Ujfalusi
2026-11-05 14:07   ` Mark Brown
2026-11-05 14:16     ` Mario Limonciello

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®