@samitouri / QOSamiQemu / commits / d30189cce1

x86: q35: add 'wdat' property

Used for enabling WDAT based watchdog for builtin iTCO watchdog. Usage: -M q35,wdat={on|off} By default it is disabled. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Reviewed-by: Ani Sinha <anisinha@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-Id: <20260303092532.2410177-3-imammedo@redhat.com>

Igor Mammedov committed Mar 3, 2026 at 10:25 UTC d30189cce17038ecaeaaacbfee9ab2c1a07c80fa
2 files changed +19
hw/i386/pc_q35.c
+18
@@ -331,6 +331,18 @@ static void pc_q35_init(MachineState *machine)
331 }
332 }
333
334 +static bool pc_q35_machine_get_wdat(Object *o, Error **errp)
335 +{
336 + PCMachineState *pcms = PC_MACHINE(o);
337 + return pcms->wdat_enabled;
338 +}
339 +
340 +static void pc_q35_machine_set_wdat(Object *o, bool value, Error **errp)
341 +{
342 + PCMachineState *pcms = PC_MACHINE(o);
343 + pcms->wdat_enabled = value;
344 +}
345 +
346 #define DEFINE_Q35_MACHINE(major, minor) \
347 DEFINE_PC_VER_MACHINE(pc_q35, "pc-q35", pc_q35_init, false, NULL, major, minor);
348
@@ -343,6 +355,7 @@ static void pc_q35_init(MachineState *machine)
355 static void pc_q35_machine_options(MachineClass *m)
356 {
357 PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
358 + ObjectClass *oc = OBJECT_CLASS(m);
359 pcmc->pci_root_uid = 0;
360 pcmc->default_cpu_version = 1;
361
@@ -361,6 +374,11 @@ static void pc_q35_machine_options(MachineClass *m)
374 machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE);
375 machine_class_allow_dynamic_sysbus_dev(m, TYPE_VMBUS_BRIDGE);
376 machine_class_allow_dynamic_sysbus_dev(m, TYPE_UEFI_VARS_X64);
377 + object_class_property_add_bool(oc, "wdat",
378 + pc_q35_machine_get_wdat, pc_q35_machine_set_wdat);
379 + object_class_property_set_description(oc, "wdat",
380 + "Enable WDAT watchdog support. Default: off");
381 +
382 compat_props_add(m->compat_props,
383 pc_q35_compat_defaults, pc_q35_compat_defaults_len);
384 }
include/hw/i386/pc.h
+1
@@ -45,6 +45,7 @@ typedef struct PCMachineState {
45 const char *south_bridge;
46
47 bool acpi_build_enabled;
48 + bool wdat_enabled;
49 bool smbus_enabled;
50 bool sata_enabled;
51 bool hpet_enabled;