hw/intc/armv7m_nvic: Provide default "reset the system" behaviour for SYSRESETREQ
commit9e60d759d38d1faae1d85de2c53411e635be3cf2
authorPeter Maydell <peter.maydell@linaro.org>
Mon, 3 Aug 2020 16:55:03 +0000 (3 17:55 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Mon, 3 Aug 2020 16:55:03 +0000 (3 17:55 +0100)
tree5e90a2b63fbc1a1a169ff06c3a49144d40c13764
parentfaf7c6de34fb8eaa566726cc658ba5ad81fb32af
hw/intc/armv7m_nvic: Provide default "reset the system" behaviour for SYSRESETREQ

The NVIC provides an outbound qemu_irq "SYSRESETREQ" which it signals
when the guest sets the SYSRESETREQ bit in the AIRCR register.  This
matches the hardware design (where the CPU has a signal of this name
and it is up to the SoC to connect that up to an actual reset
mechanism), but in QEMU it mostly results in duplicated code in SoC
objects and bugs where SoC model implementors forget to wire up the
SYSRESETREQ line.

Provide a default behaviour for the case where SYSRESETREQ is not
actually connected to anything: use qemu_system_reset_request() to
perform a system reset.  This will allow us to remove the
implementations of SYSRESETREQ handling from the boards where that's
exactly what it does, and also fixes the bugs in the board models
which forgot to wire up the signal:

 * microbit
 * mps2-an385
 * mps2-an505
 * mps2-an511
 * mps2-an521
 * musca-a
 * musca-b1
 * netduino
 * netduinoplus2

We still allow the board to wire up the signal if it needs to, in case
we need to model more complicated reset controller logic or to model
buggy SoC hardware which forgot to wire up the line itself. But
defaulting to "reset the system" is more often going to be correct
than defaulting to "do nothing".

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20200728103744.6909-3-peter.maydell@linaro.org
hw/intc/armv7m_nvic.c
include/hw/arm/armv7m.h