From 51011f7f36b4406718d9698530c4e9d920184755 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Thu, 2 Jul 2026 16:58:48 +0200 Subject: [PATCH] arm: sbsa-gwdt: add 'wdat' option it will be used by arm/virt board, to pick WDAT compatible watchdog impl. and act as switch over to WDAT ACPI table vesus default GTDT ACPI table. Signed-off-by: Igor Mammedov Reviewed-by: Eric Auger Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Message-ID: <20260702145856.1539572-6-imammedo@redhat.com> --- hw/watchdog/sbsa_gwdt.c | 9 +++++++++ include/hw/watchdog/sbsa_gwdt.h | 1 + 2 files changed, 10 insertions(+) diff --git a/hw/watchdog/sbsa_gwdt.c b/hw/watchdog/sbsa_gwdt.c index 49fdd723c2..330a74798a 100644 --- a/hw/watchdog/sbsa_gwdt.c +++ b/hw/watchdog/sbsa_gwdt.c @@ -265,6 +265,14 @@ static void wdt_sbsa_gwdt_realize(DeviceState *dev, Error **errp) sysbus_init_irq(sbd, &s->irq); + /* + * WDAT spec: "The clock interval that the WDT uses must be + * greater than or equal to 1 millisecond." + */ + if (s->wdat) { + s->freq = 1000; + } + s->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, sbsa_gwdt_timer_sysinterrupt, dev); } @@ -276,6 +284,7 @@ static const Property wdt_sbsa_gwdt_props[] = { */ DEFINE_PROP_UINT64("clock-frequency", struct SBSA_GWDTState, freq, 1000000000), + DEFINE_PROP_BOOL("wdat", struct SBSA_GWDTState, wdat, false), }; static void wdt_sbsa_gwdt_class_init(ObjectClass *klass, const void *data) diff --git a/include/hw/watchdog/sbsa_gwdt.h b/include/hw/watchdog/sbsa_gwdt.h index 8941dcff9e..5ad7c7a798 100644 --- a/include/hw/watchdog/sbsa_gwdt.h +++ b/include/hw/watchdog/sbsa_gwdt.h @@ -73,6 +73,7 @@ typedef struct SBSA_GWDTState { uint32_t woru; uint32_t wcvl; uint32_t wcvu; + bool wdat; } SBSA_GWDTState; #endif /* WDT_SBSA_GWDT_H */