On Fri, Feb 27, 2026 at 08:24:42AM +0100, Markus Armbruster wrote:
> Igor Mammedov <[email protected]> writes:
> 
> > On Wed, 25 Feb 2026 15:19:56 +0000
> > Daniel P. Berrangé <[email protected]> wrote:
> >> 
> >> Right, if there was a case where we were already using -device to
> >> create the watchdog, then I would suggest having a simple
> >> 'wadt=on|off' property as standard for any watchdog wanting that
> >> ACPI abstraction wrapper.
> >> 
> >> That could (hypothetically) be the case if we had chosen to add
> >> WADT suport backed by i6300esb, eg -device i6300esb,wadt=on|off
> >> 
> >> For cases built-in to the machine type, I'd suggest <type>-wadt=on|off
> >> 
> >> eg for Q35,  "-machine q35,itco-wadt=on|off"
> >> 
> >> for virt, '-machine virt,gwdt-wadt=on|off'
> >
> > CCin Markus since it touches QAPI stuff.
> >
> > For respin, I've went ahead with a bit more generic approach
> > (as a user, I wouldn't really care what kind of built-in watchdog board 
> > ships,
> > and having 1 property instead total instead of machine specific ones makes 
> > it
> > easier for mgmt layer to deal with).
> >
> > here is current idea:
> >
> > diff --git a/hw/core/machine.c b/hw/core/machine.c
> > index 6411e68856..a0c6719b58 100644
> > --- a/hw/core/machine.c
> > +++ b/hw/core/machine.c
> > @@ -1257,6 +1271,14 @@ static void machine_class_init(ObjectClass *oc, 
> > const void *data)
> >          NULL, NULL);
> >      object_class_property_set_description(oc, "memory",
> >          "Memory size configuration");
> > +
> > +    object_class_property_add_enum(oc, "watchdog", "WatchdogType",
> > +        &WatchdogType_lookup,
> > +        machine_get_watchdog, machine_set_watchdog);
> > +     object_class_property_set_description(oc, "watchdog",
> > +        "Use: auto (watchdog is configured according board defaults),"
> > +        " off (disabled), native (built-in watchdog), wdat (ACPI based 
> > watchdog)]. "
> > +        " Default: auto");
> >  }
> 
> Adds the property to abstract base type "machine", i.e. every machine
> has it.
> 
> Fundamentally assumes there is at most one onboard watchdog of interest.
> 
> I'm lacking context, please bear with me: who or what is going to set
> this property, and for what purpose?
> 
> > diff --git a/qapi/machine-common.json b/qapi/machine-common.json
> > index 92e84dfb14..7f5e10340f 100644
> > --- a/qapi/machine-common.json
> > +++ b/qapi/machine-common.json
> > @@ -9,6 +9,23 @@
> >  # Common machine types
> >  # ********************
> >  ##
> > +##
> > +# @WatchdogType:
> > +#
> > +# On board watchdog configuration.
> > +#
> > +# @auto: Watchdog is configured according to board defaults.
> 
> As far as I can tell, we don't document "boards" (machine types)
> anywhere, let alone "board defaults".  Not this patch's fault, of
> course.  The meaning of @auto remains unclear.
> 
> > +#
> > +# @off: Watchdog disabled (ARM).
> > +#
> > +# @native: Native watchdog (arm/virt: sbsa-gwdt, x86/q53: TCO)
> > +#
> > +# @wdat: ACPI WDAT watchdog.
> > +#
> > +# Since: 10.2
> 
> 11.0
> 
> > +##
> > +{ 'enum': 'WatchdogType',
> > +  'data': [ 'auto', 'off', 'native', 'wdat' ] }
> 
> What do managament applications need to know about onboard watchdog
> configuration?
> 
> Do they need to know what @auto means for the machine type at hand?
> 
> Do they ever need to pick a value?  Do they need to know which values
> work with the machine type then?

Libvirt generally wants to work with & express the exact hardware
and not rely on "auto" settings in QEMU.

So in terms of the built-in watchdog for Q35 we currently express
this explicitly via

    <watchdog model='itco' />

Adding "WADT" is not expressing a new piece of hardware, just a
configuration choice of the iTCO hardware. So from that POV in
libvirt I anticipate expressing it as

    <watchdog model='itco' wadt='yes|no'/>

IMHO, similar reasoning works at the QEMU level - WADT is not a
new type of watchdog hardware, just a config choice supported
with certain specific QEMU watchdogs. So I'd prefer something
closer to what I suggested in the mail that Igor replies to,
where we have a simple boolean flag to control use of WADT,
and other distinct properties if we need other controls on the
watchdog, instead of trying overload multiple distinct settings
into one enum.

For Arm we would similarly want to express the choice of
hardware directly as

   <watchdog model='gwdt'/>

regardless of whether the GWDT ends up being something we have to
add manually with -device, or something built-in to the machine.

> >> Q35 is easier as we rely on the guest quirks to disable direct
> >> access via both paths.
> >> 
> >> With GWDT we need to decide if gwdt-wadt=on should imply DTB
> >> disabled, or if we just expose both & rely on a guest quirk
> >> or worst case, need a separate property to toggle DTB too.
> >> 
> >> > I've used device property for x86 Q35 TCO watchdog and
> >> > then using -global to enable it as workaround in previous version.
> >> > Ugly but doable workaround. It puts a burden on users to learn how
> >> > to configure it for each support watchdog/board combo.
> >> > It's nightmare to discover/maintain though.
> 
> Our unsolved "how to configure onboard devices" problem bites again.
> 
> -global can be pressed into service when there's just once instance of
> the device type.  The drawbacks you describe are real.  I want to see
> less of it, not more.

IIRC, the only place we use -global with watchdogs today is to
set "-global ICH9-LPC.noreboot=off" which was merely to workaround
a historical QEMU bug which exposed a guest watchdog and then
inexplicably made it not work by having it ignore the guest
trigger event. Newer machine types fixed that broken default, but
libvirt keeps setting things explicitly since that's easier than
making machine version specific choices.

I'm not sure we need -global to support the WADT features, as that
seems like it can just a -machine property instead.

With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|


Reply via email to