qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH qemu] ppc/spapr: Implement H_WATCHDOG


From: Alexey Kardashevskiy
Subject: Re: [PATCH qemu] ppc/spapr: Implement H_WATCHDOG
Date: Wed, 15 Jun 2022 17:11:13 +1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.0



On 6/15/22 14:48, Cédric Le Goater wrote:
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 ?


What is the benefit of that besides inspecting those via QMP?


--
Alexey



reply via email to

[Prev in Thread] Current Thread [Next in Thread]