[Sound-open-firmware] [PATCH 7/7] ASoC: SOF: Add exception memory window support for APL and CNL

Xiuli Pan xiuli.pan at linux.intel.com
Wed Mar 21 09:38:59 CET 2018


From: Pan Xiuli <xiuli.pan at linux.intel.com>

Use memory window to handle DSP panic.

Signed-off-by: Pan Xiuli <xiuli.pan at 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-apl.c | 33 +++++++++++++++++++++++++++++----
 1 file changed, 29 insertions(+), 4 deletions(-)

diff --git a/sound/soc/sof/hw-apl.c b/sound/soc/sof/hw-apl.c
index 3db9e6c..7af537d 100644
--- a/sound/soc/sof/hw-apl.c
+++ b/sound/soc/sof/hw-apl.c
@@ -351,10 +351,10 @@ static void apl_get_registers(struct snd_sof_dev *sdev,
 			      u32 *stack, size_t stack_words)
 {
 	/* first read regsisters */
-	apl_block_read(sdev, APL_SRAM_REG_FW_END, xoops, sizeof(*xoops));
+	apl_block_read(sdev, sdev->dsp_oops_offset, xoops, sizeof(*xoops));
 
 	/* the get the stack */
-	apl_block_read(sdev, APL_SRAM_REG_FW_END + sizeof(*xoops), stack,
+	apl_block_read(sdev, sdev->dsp_oops_offset + sizeof(*xoops), stack,
 		       stack_words * sizeof(u32));
 }
 
@@ -1157,6 +1157,16 @@ static void apl_get_windows(struct snd_sof_dev *sdev)
 						    (elem->id),
 						    elem->size, "regs");
 			break;
+		case SOF_IPC_REGION_EXCEPTION:
+			sdev->dsp_oops_offset = elem->offset +
+						SRAM_WINDOW_OFFSET(elem->id);
+			snd_sof_debugfs_create_item(sdev,
+						    sdev->bar[APL_DSP_BAR] +
+						    elem->offset +
+						    SRAM_WINDOW_OFFSET
+						    (elem->id),
+						    elem->size, "exception");
+			break;
 		default:
 			dev_err(sdev->dev, "error: get illegal window info\n");
 			return;
@@ -1300,7 +1310,14 @@ static irqreturn_t apl_irq_thread(int irq, void *context)
 			 msg, msg_ext);
 
 		/* handle messages from DSP */
-		snd_sof_ipc_msgs_rx(sdev);
+		if ((hipct & 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);
+		}
 
 		/* clear busy interrupt */
 		snd_sof_dsp_update_bits_forced(sdev, APL_DSP_BAR,
@@ -1389,7 +1406,15 @@ static irqreturn_t cnl_irq_thread(int irq, void *context)
 			 msg, msg_ext);
 
 		/* handle messages from DSP */
-		snd_sof_ipc_msgs_rx(sdev);
+		if ((hipctdr & 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);
+		}
 
 		/* clear busy interrupt */
 		snd_sof_dsp_update_bits_forced(sdev, APL_DSP_BAR,
-- 
2.7.4



More information about the Sound-open-firmware mailing list