Skip to content

Commit 012e974

Browse files
groeckjcmvbkbc
authored andcommitted
xtensa: xtfpga: Try software restart before simulating CPU reset
Rebooting xtensa images loaded with the '-kernel' option in qemu does not work. When executing a reboot command, the qemu session either hangs or experiences an endless sequence of error messages. Kernel panic - not syncing: Unrecoverable error in exception handler Reset code jumps to the CPU restart address, but Linux can not recover from there because code and data in the kernel init sections have been discarded and overwritten at this point. XTFPGA platforms have a means to reset the CPU by writing 0xdead into a specific FPGA IO address. When used in QEMU the kernel image loaded with the '-kernel' option gets restored to its original state allowing the machine to boot successfully. Use that mechanism to attempt a platform reset. If it does not work, fall back to the existing mechanism. Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: Max Filippov <[email protected]>
1 parent f3d7c2c commit 012e974

File tree

1 file changed

+6
-2
lines changed
  • arch/xtensa/platforms/xtfpga

1 file changed

+6
-2
lines changed

arch/xtensa/platforms/xtfpga/setup.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,12 @@ void platform_power_off(void)
5151

5252
void platform_restart(void)
5353
{
54-
/* Flush and reset the mmu, simulate a processor reset, and
55-
* jump to the reset vector. */
54+
/* Try software reset first. */
55+
WRITE_ONCE(*(u32 *)XTFPGA_SWRST_VADDR, 0xdead);
56+
57+
/* If software reset did not work, flush and reset the mmu,
58+
* simulate a processor reset, and jump to the reset vector.
59+
*/
5660
cpu_reset();
5761
/* control never gets here */
5862
}

0 commit comments

Comments
 (0)