Skip to content

Commit ac84ca8

Browse files
cristiccbroonie
authored andcommitted
ASoC: SOF: amd: Handle IPC replies before FW_BOOT_COMPLETE
In some cases, e.g. during resuming from suspend, there is a possibility that some IPC reply messages get received by the host while the DSP firmware has not yet reached the complete boot state. Detect when this happens and do not attempt to process the unexpected replies from DSP. Instead, provide proper debugging support. Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Link: https://patch.msgid.link/20250207-sof-vangogh-fixes-v1-3-67824c1e4c9a@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 2ecbc2e commit ac84ca8

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

sound/soc/sof/amd/acp-ipc.c

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ irqreturn_t acp_sof_ipc_irq_thread(int irq, void *context)
167167

168168
if (sdev->first_boot && sdev->fw_state != SOF_FW_BOOT_COMPLETE) {
169169
acp_mailbox_read(sdev, sdev->dsp_box.offset, &status, sizeof(status));
170+
170171
if ((status & SOF_IPC_PANIC_MAGIC_MASK) == SOF_IPC_PANIC_MAGIC) {
171172
snd_sof_dsp_panic(sdev, sdev->dsp_box.offset + sizeof(status),
172173
true);
@@ -188,13 +189,21 @@ irqreturn_t acp_sof_ipc_irq_thread(int irq, void *context)
188189

189190
dsp_ack = snd_sof_dsp_read(sdev, ACP_DSP_BAR, ACP_SCRATCH_REG_0 + dsp_ack_write);
190191
if (dsp_ack) {
191-
spin_lock_irq(&sdev->ipc_lock);
192-
/* handle immediate reply from DSP core */
193-
acp_dsp_ipc_get_reply(sdev);
194-
snd_sof_ipc_reply(sdev, 0);
195-
/* set the done bit */
196-
acp_dsp_ipc_dsp_done(sdev);
197-
spin_unlock_irq(&sdev->ipc_lock);
192+
if (likely(sdev->fw_state == SOF_FW_BOOT_COMPLETE)) {
193+
spin_lock_irq(&sdev->ipc_lock);
194+
195+
/* handle immediate reply from DSP core */
196+
acp_dsp_ipc_get_reply(sdev);
197+
snd_sof_ipc_reply(sdev, 0);
198+
/* set the done bit */
199+
acp_dsp_ipc_dsp_done(sdev);
200+
201+
spin_unlock_irq(&sdev->ipc_lock);
202+
} else {
203+
dev_dbg_ratelimited(sdev->dev, "IPC reply before FW_BOOT_COMPLETE: %#x\n",
204+
dsp_ack);
205+
}
206+
198207
ipc_irq = true;
199208
}
200209

0 commit comments

Comments
 (0)