[Sound-open-firmware] [PATCH 0/7] Fix exception support using memory window
From: Pan Xiuli xiuli.pan@linux.intel.com
This patch set need used with patch for SOF:
mailbox: fix mailbox mappings to include exception space.
Pan Xiuli (7): ASoC: SOF: export snd_sof_trace_notify_for_error ASoC: SOF: Add SOF_IPC_REGION_EXCEPTION ASoC: SOF: add dsp_oops_offset for DSP panic ASoC: SOF: Add exception memory window support for BYT ASoC: SOF: Add exception memory window support for HSW ASoC: SOF: Add exception memory window support for BDW ASoC: SOF: Add exception memory window support for APL and CNL
include/uapi/sound/sof-ipc.h | 1 + sound/soc/sof/hw-apl.c | 33 +++++++++++++++++++++++++++++---- sound/soc/sof/hw-bdw.c | 22 +++++++++++++++++----- sound/soc/sof/hw-byt.c | 22 +++++++++++++++++----- sound/soc/sof/hw-hsw.c | 22 +++++++++++++++++----- sound/soc/sof/sof-priv.h | 1 + sound/soc/sof/trace.c | 1 + 7 files changed, 83 insertions(+), 19 deletions(-)
From: Pan Xiuli xiuli.pan@linux.intel.com
Need to use this functionn in other place, export it.
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/trace.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/sound/soc/sof/trace.c b/sound/soc/sof/trace.c index ac50a75..18d4e0a 100644 --- a/sound/soc/sof/trace.c +++ b/sound/soc/sof/trace.c @@ -249,6 +249,7 @@ void snd_sof_trace_notify_for_error(struct snd_sof_dev *sdev) wake_up(&sdev->trace_sleep); } } +EXPORT_SYMBOL(snd_sof_trace_notify_for_error);
void snd_sof_release_trace(struct snd_sof_dev *sdev) {
From: Pan Xiuli xiuli.pan@linux.intel.com
To store panic info in SOF_IPC_REGION_EXCEPTION memory window.
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 --- include/uapi/sound/sof-ipc.h | 1 + 1 file changed, 1 insertion(+)
diff --git a/include/uapi/sound/sof-ipc.h b/include/uapi/sound/sof-ipc.h index ec34ad0..d094d32 100644 --- a/include/uapi/sound/sof-ipc.h +++ b/include/uapi/sound/sof-ipc.h @@ -764,6 +764,7 @@ enum sof_ipc_region { SOF_IPC_REGION_DEBUG, SOF_IPC_REGION_STREAM, SOF_IPC_REGION_REGS, + SOF_IPC_REGION_EXCEPTION, };
struct sof_ipc_ext_data_hdr {
From: Pan Xiuli xiuli.pan@linux.intel.com
Store the offset to get the data stored in exception memory window.
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/sof-priv.h | 1 + 1 file changed, 1 insertion(+)
diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index 5a9f19b..7460423 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -339,6 +339,7 @@ struct snd_sof_dev { void __iomem *bar[SND_SOF_BARS]; /* DSP base address */ int mmio_bar; int mailbox_bar; + size_t dsp_oops_offset;
/* debug */ struct dentry *debugfs_root;
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... */
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;
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-bdw.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/sound/soc/sof/hw-bdw.c b/sound/soc/sof/hw-bdw.c index c50e4ca..d2de722 100644 --- a/sound/soc/sof/hw-bdw.c +++ b/sound/soc/sof/hw-bdw.c @@ -296,12 +296,10 @@ static void bdw_get_registers(struct snd_sof_dev *sdev, u32 *stack, size_t stack_words) { /* first read regsisters */ - bdw_mailbox_read(sdev, sdev->host_box.offset + EXCEPT_OFFSET, - xoops, sizeof(*xoops)); + bdw_mailbox_read(sdev, sdev->dsp_oops_offset, xoops, sizeof(*xoops));
/* the get the stack */ - bdw_mailbox_read(sdev, sdev->host_box.offset + EXCEPT_OFFSET + - sizeof(*xoops), stack, + bdw_mailbox_read(sdev, sdev->dsp_oops_offset + sizeof(*xoops), stack, stack_words * sizeof(u32)); }
@@ -376,7 +374,14 @@ static irqreturn_t bdw_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 bdw_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[BDW_DSP_BAR] + + elem->offset + MBOX_OFFSET, + elem->size, "exception"); + break; default: dev_err(sdev->dev, "error: get illegal window info\n"); return;
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-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,
Applied to topic/sof-v4.14
On 3/21/18 1:38 AM, Xiuli Pan wrote:
From: Pan Xiuli <xiuli.pan@linux.intel.com
This patch set need used with patch for SOF:
mailbox: fix mailbox mappings to include exception space.
Pan Xiuli (7): ASoC: SOF: export snd_sof_trace_notify_for_error ASoC: SOF: Add SOF_IPC_REGION_EXCEPTION ASoC: SOF: add dsp_oops_offset for DSP panic ASoC: SOF: Add exception memory window support for BYT ASoC: SOF: Add exception memory window support for HSW ASoC: SOF: Add exception memory window support for BDW ASoC: SOF: Add exception memory window support for APL and CNL
include/uapi/sound/sof-ipc.h | 1 + sound/soc/sof/hw-apl.c | 33 +++++++++++++++++++++++++++++---- sound/soc/sof/hw-bdw.c | 22 +++++++++++++++++----- sound/soc/sof/hw-byt.c | 22 +++++++++++++++++----- sound/soc/sof/hw-hsw.c | 22 +++++++++++++++++----- sound/soc/sof/sof-priv.h | 1 + sound/soc/sof/trace.c | 1 + 7 files changed, 83 insertions(+), 19 deletions(-)
participants (2)
-
Pierre-Louis Bossart
-
Xiuli Pan