panic: fix faulty panic handling

This commit will change the order of functions in panic_rewind() to fix SOF_IPC_PANIC_STACK in dump_stack().
Thats because arch_dump_regs() function is not able to make a 100% safe return

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
This commit is contained in:
Adrian Bonislawski 2019-04-02 16:19:23 +02:00 committed by Liam Girdwood
parent cbd3e07031
commit 2ec2c2101b
2 changed files with 11 additions and 9 deletions

View File

@ -73,16 +73,13 @@ static inline void fill_core_dump(struct sof_ipc_dsp_oops_xtensa *oops,
arch_dump_regs_a((void *)&oops->exccause, ps);
}
static inline void *arch_dump_regs(uint32_t ps)
static inline void arch_dump_regs(uint32_t ps)
{
void *buf = (void *)mailbox_get_exception_base();
fill_core_dump(buf, ps);
dcache_writeback_region(buf, sizeof(struct sof_ipc_dsp_oops_xtensa));
/* tell caller extended data can be placed hereafter */
return ((uint8_t *)buf + sizeof(struct sof_ipc_dsp_oops_xtensa));
}
#endif

View File

@ -61,8 +61,8 @@ void panic_rewind(uint32_t p, uint32_t stack_rewind_frames,
/* disable all IRQs */
oldps = interrupt_global_disable();
/* dump DSP core registers */
ext_offset = arch_dump_regs(oldps);
ext_offset = (void *)mailbox_get_exception_base() +
sizeof(struct sof_ipc_dsp_oops_xtensa);
/* dump panic info, filename ane linenum */
dump_panicinfo(ext_offset, panic_info);
@ -73,14 +73,19 @@ void panic_rewind(uint32_t p, uint32_t stack_rewind_frames,
/* dump stack frames */
p = dump_stack(p, ext_offset, stack_rewind_frames, count);
/* panic - send IPC oops message to host */
platform_panic(p);
/* flush last trace messages */
#if CONFIG_TRACE
trace_flush();
#endif
/* dump DSP core registers
* after arch_dump_regs() use only inline funcs if needed
*/
arch_dump_regs(oldps);
/* panic - send IPC oops message to host */
platform_panic(p);
/* and loop forever */
while (1)
;