Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions include/uapi/sound/sof-ipc.h
Original file line number Diff line number Diff line change
Expand Up @@ -952,4 +952,14 @@ struct sof_ipc_dsp_oops_xtensa {
uint32_t stack;
} __attribute__((packed));

/*
* Commom debug
*/

/* panic info include filename and line number */
struct sof_ipc_panic_info {
char filename[32];
uint32_t linenum;
} __attribute__((packed));

#endif
7 changes: 5 additions & 2 deletions sound/soc/sof/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,9 @@ static const struct sof_panic_msg panic_msg[] = {
};

int snd_sof_get_status(struct snd_sof_dev *sdev, u32 panic_code,
u32 tracep_code, void *oops, void *stack,
size_t stack_words)
u32 tracep_code, void *oops,
struct sof_ipc_panic_info *panic_info,
void *stack, size_t stack_words)
{
u32 code;
int i;
Expand Down Expand Up @@ -179,6 +180,8 @@ int snd_sof_get_status(struct snd_sof_dev *sdev, u32 panic_code,
dev_err(sdev->dev, "error: trace point %8.8x\n", tracep_code);

out:
dev_err(sdev->dev, "error: panic happen at %s:%d\n",
panic_info->filename, panic_info->linenum);
sof_oops(sdev, oops);
sof_stack(sdev, oops, stack, stack_words);
return -EFAULT;
Expand Down
18 changes: 13 additions & 5 deletions sound/soc/sof/intel/bdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,27 +296,35 @@ static int bdw_set_dsp_D0(struct snd_sof_dev *sdev)

static void bdw_get_registers(struct snd_sof_dev *sdev,
struct sof_ipc_dsp_oops_xtensa *xoops,
struct sof_ipc_panic_info *panic_info,
u32 *stack, size_t stack_words)
{
/* first read regsisters */
bdw_mailbox_read(sdev, sdev->dsp_oops_offset, xoops, sizeof(*xoops));

/* the get the stack */
bdw_mailbox_read(sdev, sdev->dsp_oops_offset + sizeof(*xoops), stack,
stack_words * sizeof(u32));
/* then get panic info */
bdw_mailbox_read(sdev, sdev->dsp_oops_offset + sizeof(*xoops),
panic_info, sizeof(*panic_info));

/* then get the stack */
bdw_mailbox_read(sdev, sdev->dsp_oops_offset + sizeof(*xoops) +
sizeof(*panic_info), stack,
stack_words * sizeof(u32));
}

static void bdw_dump(struct snd_sof_dev *sdev, u32 flags)
{
struct sof_ipc_dsp_oops_xtensa xoops;
struct sof_ipc_panic_info panic_info;
u32 stack[BDW_STACK_DUMP_SIZE];
u32 status, panic;

/* now try generic SOF status messages */
status = snd_sof_dsp_read(sdev, BDW_DSP_BAR, SHIM_IPCD);
panic = snd_sof_dsp_read(sdev, BDW_DSP_BAR, SHIM_IPCX);
bdw_get_registers(sdev, &xoops, stack, BDW_STACK_DUMP_SIZE);
snd_sof_get_status(sdev, status, panic, &xoops, stack,
bdw_get_registers(sdev, &xoops, &panic_info, stack,
BDW_STACK_DUMP_SIZE);
snd_sof_get_status(sdev, status, panic, &xoops, &panic_info, stack,
BDW_STACK_DUMP_SIZE);
}

Expand Down
18 changes: 13 additions & 5 deletions sound/soc/sof/intel/byt.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,27 +314,35 @@ static void byt_mailbox_read(struct snd_sof_dev *sdev, u32 offset,

static void byt_get_registers(struct snd_sof_dev *sdev,
struct sof_ipc_dsp_oops_xtensa *xoops,
struct sof_ipc_panic_info *panic_info,
u32 *stack, size_t stack_words)
{
/* first read regsisters */
byt_mailbox_read(sdev, sdev->dsp_oops_offset, xoops, sizeof(*xoops));

/* the get the stack */
byt_mailbox_read(sdev, sdev->dsp_oops_offset + sizeof(*xoops), stack,
stack_words * sizeof(u32));
/* then get panic info */
byt_mailbox_read(sdev, sdev->dsp_oops_offset + sizeof(*xoops),
panic_info, sizeof(*panic_info));

/* then get the stack */
byt_mailbox_read(sdev, sdev->dsp_oops_offset + sizeof(*xoops) +
sizeof(*panic_info), stack,
stack_words * sizeof(u32));
}

static void byt_dump(struct snd_sof_dev *sdev, u32 flags)
{
struct sof_ipc_dsp_oops_xtensa xoops;
struct sof_ipc_panic_info panic_info;
u32 stack[BYT_STACK_DUMP_SIZE];
u32 status, panic;

/* now try generic SOF status messages */
status = snd_sof_dsp_read(sdev, BYT_DSP_BAR, SHIM_IPCD);
panic = snd_sof_dsp_read(sdev, BYT_DSP_BAR, SHIM_IPCX);
byt_get_registers(sdev, &xoops, stack, BYT_STACK_DUMP_SIZE);
snd_sof_get_status(sdev, status, panic, &xoops, stack,
byt_get_registers(sdev, &xoops, &panic_info, stack,
BYT_STACK_DUMP_SIZE);
snd_sof_get_status(sdev, status, panic, &xoops, &panic_info, stack,
BYT_STACK_DUMP_SIZE);
}

Expand Down
15 changes: 11 additions & 4 deletions sound/soc/sof/intel/hda.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,19 +164,26 @@ static void hda_dsp_get_status(struct snd_sof_dev *sdev)

static void hda_dsp_get_registers(struct snd_sof_dev *sdev,
struct sof_ipc_dsp_oops_xtensa *xoops,
struct sof_ipc_panic_info *panic_info,
u32 *stack, size_t stack_words)
{
/* first read registers */
hda_dsp_block_read(sdev, sdev->dsp_oops_offset, xoops, sizeof(*xoops));

/* then get panic info */
hda_dsp_block_read(sdev, sdev->dsp_oops_offset + sizeof(*xoops),
panic_info, sizeof(*panic_info));

/* then get the stack */
hda_dsp_block_read(sdev, sdev->dsp_oops_offset + sizeof(*xoops), stack,
hda_dsp_block_read(sdev, sdev->dsp_oops_offset + sizeof(*xoops) +
sizeof(*panic_info), stack,
stack_words * sizeof(u32));
}

void hda_dsp_dump(struct snd_sof_dev *sdev, u32 flags)
{
struct sof_ipc_dsp_oops_xtensa xoops;
struct sof_ipc_panic_info panic_info;
u32 stack[HDA_DSP_STACK_DUMP_SIZE];
u32 status, panic;

Expand All @@ -189,10 +196,10 @@ void hda_dsp_dump(struct snd_sof_dev *sdev, u32 flags)
panic = snd_sof_dsp_read(sdev, HDA_DSP_BAR, HDA_DSP_SRAM_REG_FW_TRACEP);

if (sdev->boot_complete) {
hda_dsp_get_registers(sdev, &xoops, stack,
hda_dsp_get_registers(sdev, &xoops, &panic_info, stack,
HDA_DSP_STACK_DUMP_SIZE);
snd_sof_get_status(sdev, status, panic, &xoops, stack,
HDA_DSP_STACK_DUMP_SIZE);
snd_sof_get_status(sdev, status, panic, &xoops, &panic_info,
stack, HDA_DSP_STACK_DUMP_SIZE);
} else {
dev_err(sdev->dev, "error: status = 0x%8.8x panic = 0x%8.8x\n",
status, panic);
Expand Down
18 changes: 13 additions & 5 deletions sound/soc/sof/intel/hsw.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,27 +295,35 @@ static int hsw_set_dsp_D0(struct snd_sof_dev *sdev)

static void hsw_get_registers(struct snd_sof_dev *sdev,
struct sof_ipc_dsp_oops_xtensa *xoops,
struct sof_ipc_panic_info *panic_info,
u32 *stack, size_t stack_words)
{
/* first read regsisters */
hsw_mailbox_read(sdev, sdev->dsp_oops_offset, xoops, sizeof(*xoops));

/* the get the stack */
hsw_mailbox_read(sdev, sdev->dsp_oops_offset + sizeof(*xoops), stack,
stack_words * sizeof(u32));
/* then get panic info */
hsw_mailbox_read(sdev, sdev->dsp_oops_offset + sizeof(*xoops),
panic_info, sizeof(*panic_info));

/* then get the stack */
hsw_mailbox_read(sdev, sdev->dsp_oops_offset + sizeof(*xoops) +
sizeof(*panic_info), stack,
stack_words * sizeof(u32));
}

static void hsw_dump(struct snd_sof_dev *sdev, u32 flags)
{
struct sof_ipc_dsp_oops_xtensa xoops;
struct sof_ipc_panic_info panic_info;
u32 stack[HSW_STACK_DUMP_SIZE];
u32 status, panic;

/* now try generic SOF status messages */
status = snd_sof_dsp_read(sdev, HSW_DSP_BAR, SHIM_IPCD);
panic = snd_sof_dsp_read(sdev, HSW_DSP_BAR, SHIM_IPCX);
hsw_get_registers(sdev, &xoops, stack, HSW_STACK_DUMP_SIZE);
snd_sof_get_status(sdev, status, panic, &xoops, stack,
hsw_get_registers(sdev, &xoops, &panic_info, stack,
HSW_STACK_DUMP_SIZE);
snd_sof_get_status(sdev, status, panic, &xoops, &panic_info, stack,
HSW_STACK_DUMP_SIZE);
}

Expand Down
5 changes: 3 additions & 2 deletions sound/soc/sof/sof-priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,9 @@ int snd_sof_trace_update_pos(struct snd_sof_dev *sdev,
struct sof_ipc_dma_trace_posn *posn);
void snd_sof_trace_notify_for_error(struct snd_sof_dev *sdev);
int snd_sof_get_status(struct snd_sof_dev *sdev, u32 panic_code,
u32 tracep_code, void *oops, void *stack,
size_t stack_size);
u32 tracep_code, void *oops,
struct sof_ipc_panic_info *panic_info,
void *stack, size_t stack_size);
int snd_sof_init_trace_ipc(struct snd_sof_dev *sdev);

/*
Expand Down