All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Igor Mammedov <imammedo@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	qemu-devel@nongnu.org, mst@redhat.com, anisinha@redhat.com,
	pbonzini@redhat.com, shannon.zhaosl@gmail.com, philmd@linaro.org,
	zhao1.liu@intel.com, rad@semihalf.com,
	leif.lindholm@oss.qualcomm.com
Subject: Re: [PATCH 08/11] arm: virt: create GWDT watchdog paired with WDAT ACPI table
Date: Wed, 25 Feb 2026 15:19:56 +0000	[thread overview]
Message-ID: <aZ8THMubft44Q3E-@redhat.com> (raw)
In-Reply-To: <20260219131751.4e4e4e0e@imammedo>

On Thu, Feb 19, 2026 at 01:17:51PM +0100, Igor Mammedov wrote:
> On Wed, 18 Feb 2026 19:08:36 +0000
> Peter Maydell <peter.maydell@linaro.org> wrote:
> 
> > On Fri, 6 Feb 2026 at 13:15, Igor Mammedov <imammedo@redhat.com> wrote:
> > >
> > > Add SBSA generic watchdog to virt machine type with
> > > all necessary wiring for ACPI watchdog. Which includes
> > > setting its frequency to 1KHz (max that WDAT is able to handle).
> > >
> > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > > ---  
> > 
> > > diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> > > index 390845c503..caf5700ed2 100644
> > > --- a/hw/arm/virt.c
> > > +++ b/hw/arm/virt.c
> > > @@ -93,6 +93,7 @@
> > >  #include "hw/cxl/cxl.h"
> > >  #include "hw/cxl/cxl_host.h"
> > >  #include "qemu/guest-random.h"
> > > +#include "hw/watchdog/sbsa_gwdt.h"
> > >
> > >  static GlobalProperty arm_virt_compat[] = {
> > >      { TYPE_VIRTIO_IOMMU_PCI, "aw-bits", "48" },
> > > @@ -194,6 +195,8 @@ static const MemMapEntry base_memmap[] = {
> > >      [VIRT_PVTIME] =             { 0x090a0000, 0x00010000 },
> > >      [VIRT_SECURE_GPIO] =        { 0x090b0000, 0x00001000 },
> > >      [VIRT_ACPI_PCIHP] =         { 0x090c0000, ACPI_PCIHP_SIZE },
> > > +    [VIRT_GWDT_REFRESH] =       { 0x090d0000, 0x00001000 },
> > > +    [VIRT_GWDT_CONTROL] =       { 0x090d1000, 0x00001000 },
> > >      [VIRT_MMIO] =               { 0x0a000000, 0x00000200 },
> > >      /* ...repeating for a total of NUM_VIRTIO_TRANSPORTS, each of that size */
> > >      [VIRT_PLATFORM_BUS] =       { 0x0c000000, 0x02000000 },
> > > @@ -245,12 +248,32 @@ static const int a15irqmap[] = {
> > >      [VIRT_GPIO] = 7,
> > >      [VIRT_UART1] = 8,
> > >      [VIRT_ACPI_GED] = 9,
> > > +    [VIRT_GWDT_WS0] = 10,
> > >      [VIRT_MMIO] = 16, /* ...to 16 + NUM_VIRTIO_TRANSPORTS - 1 */
> > >      [VIRT_GIC_V2M] = 48, /* ...to 48 + NUM_GICV2M_SPIS - 1 */
> > >      [VIRT_SMMU] = 74,    /* ...to 74 + NUM_SMMU_IRQS - 1 */
> > >      [VIRT_PLATFORM_BUS] = 112, /* ...to 112 + PLATFORM_BUS_NUM_IRQS -1 */
> > >  };
> > >
> > > +static void create_wdt(const VirtMachineState *vms)
> > > +{
> > > +    hwaddr rbase = vms->memmap[VIRT_GWDT_REFRESH].base;
> > > +    hwaddr cbase = vms->memmap[VIRT_GWDT_CONTROL].base;
> > > +    int irq = vms->irqmap[VIRT_GWDT_WS0];
> > > +    DeviceState *dev = qdev_new(TYPE_WDT_SBSA);
> > > +    SysBusDevice *s = SYS_BUS_DEVICE(dev);
> > > +
> > > +    /*
> > > +     * Set watchdog tick freq to 1Kz as it's the max WDAT driver
> > > +     * is able to handle.
> > > +     */
> > > +    qdev_prop_set_uint64(dev, "clock-frequency", 1000 /* 1KHz */);
> > > +    sysbus_realize_and_unref(s, &error_fatal);
> > > +    sysbus_mmio_map(s, 0, rbase);
> > > +    sysbus_mmio_map(s, 1, cbase);
> > > +    sysbus_connect_irq(s, 0, qdev_get_gpio_in(vms->gic, irq));
> > > +}  
> > 
> > Please can you also add support for exposing this device
> > in the device tree ?
> 
> It's possible,
> but we probably should not enable it if acpi variant was requested,
> to avoid confusion on guest side.
> 
> For Windows it doesn't really mater, for linux it does.
> on x86 linux guest uses a quirk to disable native iTCO watchdog
> in favor of WDAT one if later is present.
> I assume quirk is not desirable so we should expose only a preferred
> variant.
> 
> > 
> > > +
> > >  static void create_randomness(MachineState *ms, const char *node)
> > >  {
> > >      struct {
> > > @@ -2515,6 +2538,9 @@ static void machvirt_init(MachineState *machine)
> > >      vms->highmem_ecam &= (!firmware_loaded || aarch64);
> > >
> > >      create_rtc(vms);
> > > +    if (machine->acpi_watchdog) {
> > > +        create_wdt(vms);
> > > +    }  
> > 
> > Can we have a command line option name that isn't ACPI
> > specific, please? There's nothing inherent to ACPI about
> > "I would like a watchdog device".
> 
> that is specifically asking for ACPI flavor being used/configured.
> acpi specific option conflates 2 things:
>    1. watchdog device creation (of the board choice) with properties tuned for WDAT usage
>    2. how to expose it on firmware level (in this case ACPI WDAT table)
> 
> other option, I've considered was
>  -device some_wd[,fw=dt|acpi|none]
> but then 'fw' is not exactly device property but rather a machine one
> (we can 'abuse' it/use as a proxy of cause).
> However it doesn't work for boards that have builtin watchdog.

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'

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.
> 
> Hence in this version, I've used a generic machine property approach
> that exposes feature in uniform way across boards.
> 
> enum might work, but ...
>   machine.watchdog = [acpi | what else could we put here???]
> 
> I'm not married to a way how we expose/configure it and will rewrite
> it to something that works for majority.
> 
> > thanks
> > -- PMM
> > 
> 

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 :|



  parent reply	other threads:[~2026-02-25 15:20 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-06 13:14 [PATCH 00/11] Introduce ACPI watchdog for Q35 and arm/virt boards Igor Mammedov
2026-02-06 13:14 ` [PATCH 01/11] acpi: add API to build WDAT instructions Igor Mammedov
2026-02-16  8:12   ` Ani Sinha
2026-02-06 13:14 ` [PATCH 02/11] machine: add "acpi-watchdog" property Igor Mammedov
2026-02-16  8:23   ` Ani Sinha
2026-02-26 17:08   ` Philippe Mathieu-Daudé
2026-02-27  8:23     ` Igor Mammedov
2026-02-06 13:14 ` [PATCH 03/11] x86: q35: generate WDAT ACPI table Igor Mammedov
2026-02-16 10:51   ` Ani Sinha
2026-02-06 13:14 ` [PATCH 04/11] tests: acpi: x86/q35: whitelist new WDAT table Igor Mammedov
2026-02-16  9:50   ` Ani Sinha
2026-02-06 13:14 ` [PATCH 05/11] tests: acpi: x86/q35: add WDAT table test case Igor Mammedov
2026-02-16  9:51   ` Ani Sinha
2026-02-06 13:14 ` [PATCH 06/11] tests: acpi: x86/q35: update expected WDAT blob Igor Mammedov
2026-02-17  5:34   ` Ani Sinha
2026-02-06 13:14 ` [PATCH 07/11] arm: add tracing events to sbsa_gwdt Igor Mammedov
2026-02-16 10:22   ` Ani Sinha
2026-02-06 13:14 ` [PATCH 08/11] arm: virt: create GWDT watchdog paired with WDAT ACPI table Igor Mammedov
2026-02-18 19:08   ` Peter Maydell
2026-02-19 12:17     ` Igor Mammedov
2026-02-19 13:00       ` Peter Maydell
2026-02-19 14:55         ` Igor Mammedov
2026-02-19 16:04           ` Peter Maydell
2026-02-23  9:28             ` Igor Mammedov
2026-02-25 15:11             ` Daniel P. Berrangé
2026-02-25 15:19       ` Daniel P. Berrangé [this message]
2026-02-26 12:56         ` Igor Mammedov
2026-02-27  7:24           ` Markus Armbruster
2026-02-27  9:01             ` Daniel P. Berrangé
2026-02-27 10:01               ` Igor Mammedov
2026-02-27 10:18                 ` Daniel P. Berrangé
2026-02-27 11:41                   ` Igor Mammedov
2026-02-27  9:42             ` Igor Mammedov
2026-02-27 12:10               ` Markus Armbruster
2026-02-27 13:14                 ` Peter Maydell
2026-02-27 14:51                   ` Markus Armbruster
2026-02-27 15:01                     ` Peter Maydell
2026-03-02  5:32                       ` Markus Armbruster
2026-02-06 13:14 ` [PATCH 09/11] tests: acpi: arm/virt: whitelist new WDAT table Igor Mammedov
2026-02-06 13:14 ` [PATCH 10/11] tests: acpi: arm/virt: add WDAT table test case Igor Mammedov
2026-02-06 13:14 ` [PATCH 11/11] tests: acpi: arm/virt: update expected WDAT blob Igor Mammedov
2026-02-16  7:39 ` [PATCH 00/11] Introduce ACPI watchdog for Q35 and arm/virt boards Ani Sinha
2026-02-16  8:46   ` Mohamed Mediouni
2026-02-18  9:29   ` Igor Mammedov
2026-02-18 19:10 ` Peter Maydell
2026-02-19 12:27   ` Igor Mammedov
2026-02-19 14:05     ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aZ8THMubft44Q3E-@redhat.com \
    --to=berrange@redhat.com \
    --cc=anisinha@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=leif.lindholm@oss.qualcomm.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rad@semihalf.com \
    --cc=shannon.zhaosl@gmail.com \
    --cc=zhao1.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.