From: Pan Xiuli xiuli.pan@linux.intel.com
Use memory window to handle DSP panic.
Signed-off-by: Pan Xiuli xiuli.pan@linux.intel.com
--- Test with: Mininow max rt5651 and GP-MRB nocodec and CNL nocodec SOF 1.1-stable: ffd9093267aa8d3deeffeb09b73c8b0789ad4071 SOF-Tool 1.1-stable: cc91c73aa3e91eea35abdeb76d578b97f718feff https://github.com/plbossart/sound/tree/topic/sof-v4.14: 4881a4bd906f8b52bebd209b88ff920005550d53 --- sound/soc/sof/hw-byt.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/sound/soc/sof/hw-byt.c b/sound/soc/sof/hw-byt.c index c7a88a2..b1ea5f9 100644 --- a/sound/soc/sof/hw-byt.c +++ b/sound/soc/sof/hw-byt.c @@ -220,6 +220,13 @@ static void byt_get_windows(struct snd_sof_dev *sdev) elem->offset + MBOX_OFFSET, elem->size, "regs"); break; + case SOF_IPC_REGION_EXCEPTION: + sdev->dsp_oops_offset = elem->offset + MBOX_OFFSET; + snd_sof_debugfs_create_item(sdev, + sdev->bar[BYT_DSP_BAR] + + elem->offset + MBOX_OFFSET, + elem->size, "exception"); + break; default: dev_err(sdev->dev, "error: get illegal window info\n"); return; @@ -306,12 +313,10 @@ static void byt_get_registers(struct snd_sof_dev *sdev, u32 *stack, size_t stack_words) { /* first read regsisters */ - byt_mailbox_read(sdev, sdev->host_box.offset + EXCEPT_OFFSET, - xoops, sizeof(*xoops)); + byt_mailbox_read(sdev, sdev->dsp_oops_offset, xoops, sizeof(*xoops));
/* the get the stack */ - byt_mailbox_read(sdev, sdev->host_box.offset + EXCEPT_OFFSET + - sizeof(*xoops), stack, + byt_mailbox_read(sdev, sdev->dsp_oops_offset + sizeof(*xoops), stack, stack_words * sizeof(u32)); }
@@ -385,7 +390,14 @@ static irqreturn_t byt_irq_thread(int irq, void *context) ipcd = snd_sof_dsp_read64(sdev, BYT_DSP_BAR, SHIM_IPCD); if (ipcd & SHIM_BYT_IPCD_BUSY) { /* Handle messages from DSP Core */ - snd_sof_ipc_msgs_rx(sdev); + if ((ipcd & SOF_IPC_PANIC_MAGIC_MASK) == SOF_IPC_PANIC_MAGIC) { + dev_err(sdev->dev, "error : DSP panic!\n"); + snd_sof_dsp_cmd_done(sdev); + snd_sof_dsp_dbg_dump(sdev, SOF_DBG_REGS | SOF_DBG_MBOX); + snd_sof_trace_notify_for_error(sdev); + } else { + snd_sof_ipc_msgs_rx(sdev); + } }
/* continue to send any remaining messages... */