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-hsw.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/sound/soc/sof/hw-hsw.c b/sound/soc/sof/hw-hsw.c index 7a40806..b9271b2 100644 --- a/sound/soc/sof/hw-hsw.c +++ b/sound/soc/sof/hw-hsw.c @@ -293,12 +293,10 @@ static void hsw_get_registers(struct snd_sof_dev *sdev, u32 *stack, size_t stack_words) { /* first read regsisters */ - hsw_mailbox_read(sdev, sdev->host_box.offset + EXCEPT_OFFSET, - xoops, sizeof(*xoops)); + hsw_mailbox_read(sdev, sdev->dsp_oops_offset, xoops, sizeof(*xoops));
/* the get the stack */ - hsw_mailbox_read(sdev, sdev->host_box.offset + EXCEPT_OFFSET + - sizeof(*xoops), stack, + hsw_mailbox_read(sdev, sdev->dsp_oops_offset + sizeof(*xoops), stack, stack_words * sizeof(u32)); }
@@ -376,7 +374,14 @@ static irqreturn_t hsw_irq_thread(int irq, void *context) /* new message from DSP */ if (ipcd & SHIM_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... */ @@ -450,6 +455,13 @@ static void hsw_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[HSW_DSP_BAR] + + elem->offset + MBOX_OFFSET, + elem->size, "exception"); + break; default: dev_err(sdev->dev, "error: get illegal window info\n"); return;