]> git.baikalelectronics.ru Git - kernel.git/commit
xtensa: xtfpga: Try software restart before simulating CPU reset
authorGuenter Roeck <linux@roeck-us.net>
Sun, 1 Aug 2021 17:36:59 +0000 (10:36 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Oct 2021 07:54:25 +0000 (09:54 +0200)
commit942caae1e8170f4a8a47c818508fc2c0e092f82d
treeda8ccffed3f8e6fbd7f41acbdea95eb1383fe954
parentd94bacc3abf6de06cdad1517f92fef41606b6b38
xtensa: xtfpga: Try software restart before simulating CPU reset

[ Upstream commit 012e974501a270d8dfd4ee2039e1fdf7579c907e ]

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 <linux@roeck-us.net>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/xtensa/platforms/xtfpga/setup.c