Commit b9f0bfd1 authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Mark Brown

ASoC: SOF: dsp_arch_ops: add kernel log level parameter for oops and stack

To allow custom log level to be used for the DSP oops and stack print, add
a kernel log level parameter to the two ops.

Modify the xtensa oops and stack functions tom use this new log level
parameter.

Pass KER_ERR from snd_sof_get_status() to make sure that there is no
functional change with this new parameter.
Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarChao Song <chao.song@intel.com>
Reviewed-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211223113628.18582-17-peter.ujfalusi@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent fdc573b1
...@@ -106,8 +106,8 @@ void snd_sof_get_status(struct snd_sof_dev *sdev, u32 panic_code, ...@@ -106,8 +106,8 @@ void snd_sof_get_status(struct snd_sof_dev *sdev, u32 panic_code,
out: out:
dev_err(sdev->dev, "panic at %s:%d\n", panic_info->filename, dev_err(sdev->dev, "panic at %s:%d\n", panic_info->filename,
panic_info->linenum); panic_info->linenum);
sof_oops(sdev, oops); sof_oops(sdev, KERN_ERR, oops);
sof_stack(sdev, oops, stack, stack_words); sof_stack(sdev, KERN_ERR, oops, stack, stack_words);
} }
EXPORT_SYMBOL(snd_sof_get_status); EXPORT_SYMBOL(snd_sof_get_status);
......
...@@ -309,8 +309,8 @@ struct snd_sof_dsp_ops { ...@@ -309,8 +309,8 @@ struct snd_sof_dsp_ops {
/* DSP architecture specific callbacks for oops and stack dumps */ /* DSP architecture specific callbacks for oops and stack dumps */
struct dsp_arch_ops { struct dsp_arch_ops {
void (*dsp_oops)(struct snd_sof_dev *sdev, void *oops); void (*dsp_oops)(struct snd_sof_dev *sdev, const char *level, void *oops);
void (*dsp_stack)(struct snd_sof_dev *sdev, void *oops, void (*dsp_stack)(struct snd_sof_dev *sdev, const char *level, void *oops,
u32 *stack, u32 stack_words); u32 *stack, u32 stack_words);
}; };
...@@ -573,16 +573,17 @@ int snd_sof_debugfs_add_region_item_iomem(struct snd_sof_dev *sdev, ...@@ -573,16 +573,17 @@ int snd_sof_debugfs_add_region_item_iomem(struct snd_sof_dev *sdev,
/* /*
* DSP Architectures. * DSP Architectures.
*/ */
static inline void sof_stack(struct snd_sof_dev *sdev, void *oops, u32 *stack, static inline void sof_stack(struct snd_sof_dev *sdev, const char *level,
u32 stack_words) void *oops, u32 *stack, u32 stack_words)
{ {
sof_dsp_arch_ops(sdev)->dsp_stack(sdev, oops, stack, stack_words); sof_dsp_arch_ops(sdev)->dsp_stack(sdev, level, oops, stack,
stack_words);
} }
static inline void sof_oops(struct snd_sof_dev *sdev, void *oops) static inline void sof_oops(struct snd_sof_dev *sdev, const char *level, void *oops)
{ {
if (sof_dsp_arch_ops(sdev)->dsp_oops) if (sof_dsp_arch_ops(sdev)->dsp_oops)
sof_dsp_arch_ops(sdev)->dsp_oops(sdev, oops); sof_dsp_arch_ops(sdev)->dsp_oops(sdev, level, oops);
} }
extern const struct dsp_arch_ops sof_xtensa_arch_ops; extern const struct dsp_arch_ops sof_xtensa_arch_ops;
......
...@@ -81,33 +81,39 @@ static const struct xtensa_exception_cause xtensa_exception_causes[] = { ...@@ -81,33 +81,39 @@ static const struct xtensa_exception_cause xtensa_exception_causes[] = {
}; };
/* only need xtensa atm */ /* only need xtensa atm */
static void xtensa_dsp_oops(struct snd_sof_dev *sdev, void *oops) static void xtensa_dsp_oops(struct snd_sof_dev *sdev, const char *level, void *oops)
{ {
struct sof_ipc_dsp_oops_xtensa *xoops = oops; struct sof_ipc_dsp_oops_xtensa *xoops = oops;
int i; int i;
dev_err(sdev->dev, "error: DSP Firmware Oops\n"); dev_printk(level, sdev->dev, "error: DSP Firmware Oops\n");
for (i = 0; i < ARRAY_SIZE(xtensa_exception_causes); i++) { for (i = 0; i < ARRAY_SIZE(xtensa_exception_causes); i++) {
if (xtensa_exception_causes[i].id == xoops->exccause) { if (xtensa_exception_causes[i].id == xoops->exccause) {
dev_err(sdev->dev, "error: Exception Cause: %s, %s\n", dev_printk(level, sdev->dev,
xtensa_exception_causes[i].msg, "error: Exception Cause: %s, %s\n",
xtensa_exception_causes[i].description); xtensa_exception_causes[i].msg,
xtensa_exception_causes[i].description);
} }
} }
dev_err(sdev->dev, "EXCCAUSE 0x%8.8x EXCVADDR 0x%8.8x PS 0x%8.8x SAR 0x%8.8x\n", dev_printk(level, sdev->dev,
xoops->exccause, xoops->excvaddr, xoops->ps, xoops->sar); "EXCCAUSE 0x%8.8x EXCVADDR 0x%8.8x PS 0x%8.8x SAR 0x%8.8x\n",
dev_err(sdev->dev, "EPC1 0x%8.8x EPC2 0x%8.8x EPC3 0x%8.8x EPC4 0x%8.8x", xoops->exccause, xoops->excvaddr, xoops->ps, xoops->sar);
xoops->epc1, xoops->epc2, xoops->epc3, xoops->epc4); dev_printk(level, sdev->dev,
dev_err(sdev->dev, "EPC5 0x%8.8x EPC6 0x%8.8x EPC7 0x%8.8x DEPC 0x%8.8x", "EPC1 0x%8.8x EPC2 0x%8.8x EPC3 0x%8.8x EPC4 0x%8.8x",
xoops->epc5, xoops->epc6, xoops->epc7, xoops->depc); xoops->epc1, xoops->epc2, xoops->epc3, xoops->epc4);
dev_err(sdev->dev, "EPS2 0x%8.8x EPS3 0x%8.8x EPS4 0x%8.8x EPS5 0x%8.8x", dev_printk(level, sdev->dev,
xoops->eps2, xoops->eps3, xoops->eps4, xoops->eps5); "EPC5 0x%8.8x EPC6 0x%8.8x EPC7 0x%8.8x DEPC 0x%8.8x",
dev_err(sdev->dev, "EPS6 0x%8.8x EPS7 0x%8.8x INTENABL 0x%8.8x INTERRU 0x%8.8x", xoops->epc5, xoops->epc6, xoops->epc7, xoops->depc);
xoops->eps6, xoops->eps7, xoops->intenable, xoops->interrupt); dev_printk(level, sdev->dev,
"EPS2 0x%8.8x EPS3 0x%8.8x EPS4 0x%8.8x EPS5 0x%8.8x",
xoops->eps2, xoops->eps3, xoops->eps4, xoops->eps5);
dev_printk(level, sdev->dev,
"EPS6 0x%8.8x EPS7 0x%8.8x INTENABL 0x%8.8x INTERRU 0x%8.8x",
xoops->eps6, xoops->eps7, xoops->intenable, xoops->interrupt);
} }
static void xtensa_stack(struct snd_sof_dev *sdev, void *oops, u32 *stack, static void xtensa_stack(struct snd_sof_dev *sdev, const char *level, void *oops,
u32 stack_words) u32 *stack, u32 stack_words)
{ {
struct sof_ipc_dsp_oops_xtensa *xoops = oops; struct sof_ipc_dsp_oops_xtensa *xoops = oops;
u32 stack_ptr = xoops->plat_hdr.stackptr; u32 stack_ptr = xoops->plat_hdr.stackptr;
...@@ -115,7 +121,7 @@ static void xtensa_stack(struct snd_sof_dev *sdev, void *oops, u32 *stack, ...@@ -115,7 +121,7 @@ static void xtensa_stack(struct snd_sof_dev *sdev, void *oops, u32 *stack,
unsigned char buf[4 * 8 + 3 + 1]; unsigned char buf[4 * 8 + 3 + 1];
int i; int i;
dev_err(sdev->dev, "stack dump from 0x%8.8x\n", stack_ptr); dev_printk(level, sdev->dev, "stack dump from 0x%8.8x\n", stack_ptr);
/* /*
* example output: * example output:
...@@ -124,7 +130,7 @@ static void xtensa_stack(struct snd_sof_dev *sdev, void *oops, u32 *stack, ...@@ -124,7 +130,7 @@ static void xtensa_stack(struct snd_sof_dev *sdev, void *oops, u32 *stack,
for (i = 0; i < stack_words; i += 4) { for (i = 0; i < stack_words; i += 4) {
hex_dump_to_buffer(stack + i, 16, 16, 4, hex_dump_to_buffer(stack + i, 16, 16, 4,
buf, sizeof(buf), false); buf, sizeof(buf), false);
dev_err(sdev->dev, "0x%08x: %s\n", stack_ptr + i * 4, buf); dev_printk(level, sdev->dev, "0x%08x: %s\n", stack_ptr + i * 4, buf);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment