On 4/19/21 4:54 PM, Alex Bennée wrote:
> From: Bastian Koppelmann <[email protected]>
>
> this device is used to verify the correctness of regression tests by
> allowing guests to write their exit status to this device. This is then
> used by qemu to exit using the written status.
>
> Reviewed-by: Alex Bennée <[email protected]>
> Signed-off-by: Bastian Koppelmann <[email protected]>
> Signed-off-by: Alex Bennée <[email protected]>
> Message-Id: <[email protected]>
> ---
> include/hw/tricore/tricore_testdevice.h | 38 ++++++++++++
> hw/tricore/tricore_testboard.c | 8 +++
> hw/tricore/tricore_testdevice.c | 82 +++++++++++++++++++++++++
> hw/tricore/meson.build | 1 +
> 4 files changed, 129 insertions(+)
> create mode 100644 include/hw/tricore/tricore_testdevice.h
> create mode 100644 hw/tricore/tricore_testdevice.c
> +#include "hw/tricore/tricore_testdevice.h"
> +
> +static void tricore_testdevice_write(void *opaque, hwaddr offset,
> + uint64_t value, unsigned size)
> +{
> + exit(value);
-> qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
I'd rather use a 2 steps check of value such watchdog devices do
(to be sure the guest is still in control and isn't nut).
A general comments, all targets require a such test feature,
so we should have a generic user-creatable sysbus-testdev for that.
Regards,
Phil.