Hello Alexey,
On 6/8/22 05:01, Alexey Kardashevskiy wrote:
The new PAPR 2.12 defines a watchdog facility managed via the new
H_WATCHDOG hypercall.
This adds H_WATCHDOG support which a proposed driver for pseries uses:
https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=303120
This was tested by running QEMU with a debug kernel and command line:
-append \
"pseries-wdt.timeout=60 pseries-wdt.nowayout=1 pseries-wdt.action=2"
and running "echo V > /dev/watchdog0" inside the VM.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
include/hw/ppc/spapr.h | 23 +++-
hw/ppc/spapr.c | 5 +
hw/ppc/spapr_watchdog.c | 239 ++++++++++++++++++++++++++++++++++++++++
Watchdogs are under :
hw/watchdog/
hw/ppc/meson.build | 1 +
hw/ppc/trace-events | 7 ++
5 files changed, 274 insertions(+), 1 deletion(-)
create mode 100644 hw/ppc/spapr_watchdog.c
diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
index 072dda2c7265..39aa8609df7b 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -164,6 +164,19 @@ struct SpaprMachineClass {
SpaprIrq *irq;
};
+#define WDT_MAX_WATCHDOGS 4 /* Maximum number of watchdog
devices */
+
+#define WDT_HARD_POWER_OFF 0
+#define WDT_HARD_RESTART 1
+#define WDT_DUMP_RESTART 2
+
+typedef struct SpaprWatchdog {
+ unsigned num;
+ QEMUTimer timer;
+ uint8_t action;
+ uint64_t timeout;
+} SpaprWatchdog;
couldn't we QOM'ify this model ?