it will be used to make QEMU generate WDAT ACPI table,
that describes TCO watchdog in platfom independed way
and allows guest to use generic 'wdat' driver.
To enable it use '-global ICH9-LPC.wdat=on' option.

PS:
On linux wdat driver takes ove TCO watchdog if WDAT
table is present, hence 'wdat=off' by default to
avoid guest visible change on existing VMs.

Signed-off-by: Igor Mammedov <[email protected]>
---
 include/hw/acpi/ich9.h | 1 +
 hw/acpi/ich9.c         | 5 +++++
 hw/isa/lpc_ich9.c      | 1 +
 3 files changed, 7 insertions(+)

diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h
index 245fe08dc2..c84e17f9f6 100644
--- a/include/hw/acpi/ich9.h
+++ b/include/hw/acpi/ich9.h
@@ -69,6 +69,7 @@ typedef struct ICH9LPCPMRegs {
     bool smm_compat;
     bool enable_tco;
     TCOIORegs tco_regs;
+    bool enable_wdat;
 
     bool swsmi_timer_enabled;
     bool periodic_timer_enabled;
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index 2b3b493c01..08a01aa1aa 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -321,6 +321,11 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, 
qemu_irq sci_irq)
         acpi_pm_tco_init(&pm->tco_regs, &pm->io);
     }
 
+    if (pm->enable_wdat && !pm->enable_tco) {
+        error_setg(&error_fatal,
+            "'wdat' can not be enabled without 'enable_tco=on'");
+    }
+
     if (pm->acpi_pci_hotplug.use_acpi_hotplug_bridge) {
         object_property_set_link(OBJECT(lpc_pci), "bus",
                                  OBJECT(pci_get_bus(lpc_pci)), &error_abort);
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index c9cb8f7779..ce9cf87363 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -832,6 +832,7 @@ static const VMStateDescription vmstate_ich9_lpc = {
 
 static const Property ich9_lpc_properties[] = {
     DEFINE_PROP_BOOL("noreboot", ICH9LPCState, pin_strap.spkr_hi, false),
+    DEFINE_PROP_BOOL("wdat", ICH9LPCState, pm.enable_wdat, false),
     DEFINE_PROP_BOOL("smm-compat", ICH9LPCState, pm.smm_compat, false),
     DEFINE_PROP_BOOL("smm-enabled", ICH9LPCState, pm.smm_enabled, false),
     DEFINE_PROP_BIT64("x-smi-broadcast", ICH9LPCState, smi_host_features,
-- 
2.47.3


Reply via email to