All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Cc: mst@redhat.com, eauger@redhat.com, peter.maydell@linaro.org,
	shannon.zhaosl@gmail.com, rad@semihalf.com,
	leif.lindholm@oss.qualcomm.com, qemu-arm@nongnu.org
Subject: [PATCH v3 00/17] Add watchdog support to arm/virt board
Date: Wed, 24 Jun 2026 12:28:13 +0200	[thread overview]
Message-ID: <20260624102830.1355552-1-imammedo@redhat.com> (raw)

This series adds SBSA GWDT to the arm/virt machine with a WDAT table
tailored for it and necessary tweaks to make it usable with the
WDAT driver.

In addition to WDAT, it also adds a native variant with GWDT
described in FDT and GTDT (works on Linux, broken on Windows
without patches 16-17).

Patches 14-17 fix GWDT handling of direct WCV register writes
to match the SBSA spec. This fixes Windows 11 reboots when GWDT
is present without WDAT.
This is making GTDT watchdog sort of 'work' with Windows, modulo
that Windows sets timeout too far in the future, so in practice
watchdog would never trigger. (WDAT variant doesn't have this
issue).

One can test it launching VM with:
    -device sbsa-gwdt,wdat=on

to trace access to GWDT registers add:
    -trace "sbsa_gwdt*"

To verify the guest uses watchdog use following steps to trigger
watchdog reboot:
  * on Linux: enable watchdog service, check with wdctl, then:
      echo c > /proc/sysrq-trigger
  * on Windows: kill svchost in admin mode 'cmd' shell:
      taskkill /f /im svchost.exe

Tested with Fedora 43 & Windows 11 (aarch64, KVM on Jetson)

git tree: https://gitlab.com/imammedo/qemu/-/commits/gwdt_v3

1) http://msdn.microsoft.com/en-us/windows/hardware/gg463320.aspx

Changelog:
  v3:
    * drop x86 patches (already merged)
    * (Eric) rename device type from sbsa_gwdt to sbsa-gwdt (new patch 3)
    * arm: virt: create sbsa-gwdt watchdog (patch 4):
      - (Eric) assign MMIO/IRQ statically, drop dynamic sysbus machinery
      - (Peter) set watchdog freq to system counter clock explicitly
    * arm: sbsa-gwdt: add 'wdat' option (patch 5):
      - split out from v2's monolithic patch 11
    * acpi: introduce WDAT table for GWDT (patch 6):
      - (Eric) split out from v2's patch 11
      - add/improve comments
      - use 'freq' argument passed down by caller
      - simplify magic val on WRR write and add comment
      - group table records by used register
    * arm: virt: add support for WDAT based watchdog (patch 7):
      - (Eric) split out from v2's patch 11
      - skip FDT watchdog node creation in wdat mode
      - skip setting cntfrq clock-frequency in wdat mode
    * sbsa-gwdt: reschedule timer on direct WCV load (patch 16):
      - improved commit message with spec references and
        description of Windows GTDT-mode behavior
    * sbsa-gwdt: limit compare_value to INT64_MAX (patch 17):
      - rewritten commit message: document QEMU timer API
        limitation vs spec, Windows write sequence, and
        vCPU preemption fragility under virtualization

  v2:
    * ditch generic '-machine acpi-watchdog' option in favor of
      board specific: arm/virt: -device sbsa_gwdt,wdat={on|off}
    * arm/virt: add FDT and GTDT ACPI entries for GWDT
    * arm/virt: add test case for GTDT
    * optional GWDT cleanup/fixes for WCV register update

  previous revisions:
    v2: https://patchew.org/QEMU/20260303092532.2410177-1-imammedo@redhat.com/
    v1: https://patchew.org/QEMU/20260206131438.1857182-1-imammedo@redhat.com/

Igor Mammedov (17):
  arm: sbsa_gwdt: fixup default "clock-frequency"
  arm: add tracing events to sbsa_gwdt
  arm: sbsa_gwdt: rename device type to sbsa-gwdt
  arm: virt: create sbsa-gwdt watchdog
  arm: sbsa-gwdt: add 'wdat' option
  acpi: introduce WDAT table for  GWDT
  arm: virt: add support for WDAT based watchdog
  tests: acpi: arm/virt: whitelist new WDAT table
  tests: acpi: arm/virt: add WDAT table test case
  tests: acpi: arm/virt: update expected WDAT blob
  tests: acpi: arm/virt: whitelist GTDT table
  tests: acpi: arm/virt: add GTDT watchdog table test case
  tests: acpi: arm/virt: update expected GTDT blob
  sbsa-gwdt: reduce code ident
  sbsa-gwdt: move all foo_REFRESH logic under REFRESH condition
  sbsa-gwdt: reschedule timer on direct WCV load
  sbsa-gwdt: limit compare_value to INT64_MAX

 include/hw/acpi/wdat-gwdt.h            |  19 +++++
 include/hw/arm/virt.h                  |   3 +
 include/hw/watchdog/sbsa_gwdt.h        |   3 +-
 hw/acpi/meson.build                    |   2 +
 hw/acpi/wdat-gwdt-stub.c               |  16 ++++
 hw/acpi/wdat-gwdt.c                    |  99 +++++++++++++++++++++++++
 hw/arm/Kconfig                         |   1 +
 hw/arm/virt-acpi-build.c               |  51 ++++++++++++-
 hw/arm/virt.c                          |  39 ++++++++++
 hw/core/sysbus-fdt.c                   |   2 +
 hw/watchdog/sbsa_gwdt.c                |  66 +++++++++++------
 hw/watchdog/trace-events               |   9 +++
 tests/data/acpi/aarch64/virt/GTDT.gwdt | Bin 0 -> 132 bytes
 tests/data/acpi/aarch64/virt/WDAT.wdat | Bin 0 -> 260 bytes
 tests/qtest/bios-tables-test.c         |  41 ++++++++++
 15 files changed, 325 insertions(+), 26 deletions(-)
 create mode 100644 include/hw/acpi/wdat-gwdt.h
 create mode 100644 hw/acpi/wdat-gwdt-stub.c
 create mode 100644 hw/acpi/wdat-gwdt.c
 create mode 100644 tests/data/acpi/aarch64/virt/GTDT.gwdt
 create mode 100644 tests/data/acpi/aarch64/virt/WDAT.wdat

-- 
2.47.3



             reply	other threads:[~2026-06-24 10:30 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-24 10:28 Igor Mammedov [this message]
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
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=20260624102830.1355552-1-imammedo@redhat.com \
    --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.