All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Eric Auger <eauger@redhat.com>
Cc: qemu-devel@nongnu.org, mst@redhat.com, peter.maydell@linaro.org,
	shannon.zhaosl@gmail.com, rad@semihalf.com,
	leif.lindholm@oss.qualcomm.com, qemu-arm@nongnu.org
Subject: Re: [PATCH v3 04/17] arm: virt: create sbsa-gwdt watchdog
Date: Mon, 29 Jun 2026 15:36:42 +0200	[thread overview]
Message-ID: <20260629153642.14ce960e@imammedo> (raw)
In-Reply-To: <db203d86-7280-4210-8640-e94c9f11f9da@redhat.com>

On Mon, 29 Jun 2026 10:37:59 +0200
Eric Auger <eauger@redhat.com> wrote:

> Hi Igor,
> 
> On 6/24/26 12:28 PM, Igor Mammedov wrote:
> > Allow to use SBSA generic watchdog with virt machine type.
> > (includes conditional generation of corresponding FDT and
> > ACPI GTDT descriptors)
> > 
> > Use '-device sbsa-gwdt' to command line to enable it.
> > 
> > Instead of using dynamic sysbus infra to wire up MMIO/IRQ/FDT,
> > statically assign resources in machine's mem/irq maps and wire
> > them up at device (pre_)plug handlers. It's similar to dynamic
> > sysbus wiring, modulo resources are nailed down statically,
> > and wiring is limited to virt machine only.
> > (Benefit is that tests don't break anymore on rebase due to
> > address being stable)
> > 
> > Tested with Fedora 43:
> >   FDT: -M virt,acpi=off -device sbsa-gwdt
> >   ACPI: -M virt -device sbsa-gwdt
> > 
> > Note:
> > Windows sees GTDT, initializes watchdog but instead pinging WRR
> > it sets/advances WOR to way too large value, so it's never going
> > to trigger watchdog reboot (it's Windows driver issue though).
> > 
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> > v3:
> >   - (Eric) assign MMIO/IRQ statically and abandon most of
> >      dynamic sysbus machinery.
> >   - (Peter) set watchdog freq to system clock explicitly,
> >     machine version compat won't work in case host is not runing
> >     1GHz clock. (Tested on Jetson machine)
> > ---
> >  include/hw/arm/virt.h    |  3 +++
> >  hw/arm/Kconfig           |  1 +
> >  hw/arm/virt-acpi-build.c | 29 +++++++++++++++++++++++++++--
> >  hw/arm/virt.c            | 37 +++++++++++++++++++++++++++++++++++++
> >  hw/core/sysbus-fdt.c     |  2 ++
> >  hw/watchdog/sbsa_gwdt.c  |  1 +
> >  6 files changed, 71 insertions(+), 2 deletions(-)
> > 
[...]
> > @@ -3820,6 +3824,10 @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev,
> >          qlist_append_str(reserved_regions, resv_prop_str);
> >          qdev_prop_set_array(dev, "reserved-regions", reserved_regions);
> >          g_free(resv_prop_str);
> > +    } else if (object_dynamic_cast(OBJECT(dev), TYPE_WDT_SBSA)) {
> > +        uint64_t cntfrq = object_property_get_int(OBJECT(qemu_get_cpu(0)),
> > +                                                  "cntfrq", &error_abort);  
> missing extra line.
> > +        qdev_prop_set_uint64(dev, "clock-frequency", cntfrq);  
> 
> Can you explain why you cannot do that in virt_machine_device_plug_cb()?

sure,
all prep work, typically is done at pre_plug time. (it's stage we are allowed to fail)

While at plug time we typically do final (post realize) wiring/exposing model to guest
(no allowed to fail (I need to do cleanup and remove errp from all plug handlers
but that is orthogonal to series))

> >      } else if (object_dynamic_cast(OBJECT(dev), TYPE_ARM_SMMUV3)) {
> >          if (vms->legacy_smmuv3_present || vms->iommu == VIRT_IOMMU_VIRTIO) {
> >              error_setg(errp, "virt machine already has %s set. "
[...]

> > diff --git a/hw/watchdog/sbsa_gwdt.c b/hw/watchdog/sbsa_gwdt.c
> > index acb970e8b3..c4dd8005b7 100644
> > --- a/hw/watchdog/sbsa_gwdt.c
> > +++ b/hw/watchdog/sbsa_gwdt.c
> > @@ -285,6 +285,7 @@ static void wdt_sbsa_gwdt_class_init(ObjectClass *klass, const void *data)
> >      dc->realize = wdt_sbsa_gwdt_realize;
> >      device_class_set_legacy_reset(dc, wdt_sbsa_gwdt_reset);
> >      dc->hotpluggable = false;
> > +    dc->user_creatable = true;
> >      set_bit(DEVICE_CATEGORY_WATCHDOG, dc->categories);
> >      dc->vmsd = &vmstate_sbsa_gwdt;
> >      dc->desc = "SBSA-compliant generic watchdog device";  
> You may document somewhere that the device can be dynamically
> instantiated, in machvirt alone and this required machine specific
> hardwiring.

Any suggestion wrt where to put it? 

> 
> Thanks
> 
> Eric
> 



  reply	other threads:[~2026-06-29 13:37 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-24 10:28 [PATCH v3 00/17] Add watchdog support to arm/virt board Igor Mammedov
2026-06-24 10:28 ` [PATCH v3 01/17] arm: sbsa_gwdt: fixup default "clock-frequency" Igor Mammedov
2026-06-24 10:28 ` [PATCH v3 02/17] arm: add tracing events to sbsa_gwdt Igor Mammedov
2026-06-24 10:28 ` [PATCH v3 03/17] arm: sbsa_gwdt: rename device type to sbsa-gwdt Igor Mammedov
2026-06-29  8:12   ` Eric Auger
2026-06-24 10:28 ` [PATCH v3 04/17] arm: virt: create sbsa-gwdt watchdog Igor Mammedov
2026-06-29  8:37   ` Eric Auger
2026-06-29 13:36     ` Igor Mammedov [this message]
2026-07-01 11:57       ` Eric Auger
2026-07-01 13:24         ` Igor Mammedov
2026-06-24 10:28 ` [PATCH v3 05/17] arm: sbsa-gwdt: add 'wdat' option Igor Mammedov
2026-06-24 10:28 ` [PATCH v3 06/17] acpi: introduce WDAT table for GWDT Igor Mammedov
2026-06-29 12:07   ` Eric Auger
2026-06-24 10:28 ` [PATCH v3 07/17] arm: virt: add support for WDAT based watchdog Igor Mammedov
2026-06-29 12:15   ` Eric Auger
2026-06-24 10:28 ` [PATCH v3 08/17] tests: acpi: arm/virt: whitelist new WDAT table Igor Mammedov
2026-06-24 10:28 ` [PATCH v3 09/17] tests: acpi: arm/virt: add WDAT table test case Igor Mammedov
2026-06-24 10:28 ` [PATCH v3 10/17] tests: acpi: arm/virt: update expected WDAT blob Igor Mammedov
2026-06-29 12:16   ` Eric Auger
2026-06-24 10:28 ` [PATCH v3 11/17] tests: acpi: arm/virt: whitelist GTDT table Igor Mammedov
2026-06-24 10:28 ` [PATCH v3 12/17] tests: acpi: arm/virt: add GTDT watchdog table test case Igor Mammedov
2026-06-24 10:28 ` [PATCH v3 13/17] tests: acpi: arm/virt: update expected GTDT blob Igor Mammedov
2026-06-24 10:28 ` [PATCH v3 14/17] sbsa-gwdt: reduce code ident Igor Mammedov
2026-06-24 10:28 ` [PATCH v3 15/17] sbsa-gwdt: move all foo_REFRESH logic under REFRESH condition Igor Mammedov
2026-06-29 14:03   ` Eric Auger
2026-06-29 14:51   ` Peter Maydell
2026-06-24 10:28 ` [PATCH v3 16/17] sbsa-gwdt: reschedule timer on direct WCV load Igor Mammedov
2026-06-29 14:08   ` Eric Auger
2026-06-24 10:28 ` [PATCH v3 17/17] sbsa-gwdt: limit compare_value to INT64_MAX Igor Mammedov
2026-06-29 14:10   ` Eric Auger
2026-06-29 14:48   ` Peter Maydell
2026-06-30 12:14     ` Igor Mammedov

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=20260629153642.14ce960e@imammedo \
    --to=imammedo@redhat.com \
    --cc=eauger@redhat.com \
    --cc=leif.lindholm@oss.qualcomm.com \
    --cc=mst@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rad@semihalf.com \
    --cc=shannon.zhaosl@gmail.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.