Skip to content

Add watchdog support to arm/virt board

Igor Mammedov qemu-arm qemu-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest13 patches 1 replyIn review
  2. v317 patches 14 repliesSuperseded

Changes in v4 from the cover letter · 23 lines

* drop independed patches 14-17 for a separate spin-off (sbsa-gwdt fixes for WCV register writes)
* arm: sbsa_gwdt: rename device type to sbsa-gwdt (patch 3):
- collect Reviewed-by from Eric
* arm: virt: create sbsa-gwdt watchdog (patch 4):
(Eric)
- reorder [VIRT_GWDT_WS0] in irqmap after [VIRT_ACPI_GED]
- add missing blank line in pre_plug handler
- extract FDT node creation into create_gwdt_dt_bindings() helper
- add watchdog documentation to docs/system/arm/virt.rst
- add comment above dc->user_creatable about requiring machine-specific wiring
* acpi: introduce WDAT table for GWDT (patch 6):
(Eric)
- fix comment alignment
- collect Reviewed-by
* arm: virt: add support for WDAT based watchdog (patch 7):
(Eric)
- remove unused 'wdt' parameter from build_gtdt()
- add Native/WDAT modes documentation to docs/system/arm/virt.rst
- collect Reviewed-by
* tests: acpi: arm/virt: update expected WDAT blob (patch 10):
- collect Reviewed-by from Eric
* tests: acpi: arm/virt: add GTDT watchdog table test case (patch 12):
(Eric) fix whitespace in test command string (moved from patch 17)

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13arm: sbsa_gwdt: fixup default "clock-frequency"hw/watchdog/sbsa_gwdt.c+2 -30 replies
2/13arm: add tracing events to sbsa_gwdthw/watchdog/sbsa_gwdt.c hw/watchdog/trace-events+17 -00 replies
3/13arm: sbsa_gwdt: rename device type to sbsa-gwdtinclude/hw/watchdog/sbsa_gwdt.h+1 -10 replies
4/13arm: virt: create sbsa-gwdt watchdogdocs/system/arm/virt.rst hw/arm/Kconfig hw/arm/virt-acpi-build.c +4 more+88 -21 reply
5/13arm: sbsa-gwdt: add 'wdat' optionhw/watchdog/sbsa_gwdt.c include/hw/watchdog/sbsa_gwdt.h+10 -00 replies
6/13acpi: introduce WDAT table for GWDThw/acpi/meson.build hw/acpi/wdat-gwdt-stub.c hw/acpi/wdat-gwdt.c +1 more+136 -00 replies
7/13arm: virt: add support for WDAT based watchdogdocs/system/arm/virt.rst hw/arm/virt-acpi-build.c hw/arm/virt.c+49 -120 replies
8/13tests: acpi: arm/virt: whitelist new WDAT tabletests/data/acpi/aarch64/virt/WDAT.wdat tests/qtest/bios-tables-test-allowed-diff.h+1 -00 replies
9/13tests: acpi: arm/virt: add WDAT table test casetests/qtest/bios-tables-test.c+21 -00 replies
10/13tests: acpi: arm/virt: update expected WDAT blobtests/data/acpi/aarch64/virt/WDAT.wdat tests/qtest/bios-tables-test-allowed-diff.h+0 -10 replies
11/13tests: acpi: arm/virt: whitelist GTDT tabletests/qtest/bios-tables-test-allowed-diff.h+1 -00 replies
12/13tests: acpi: arm/virt: add GTDT watchdog table test casetests/qtest/bios-tables-test.c+20 -00 replies
13/13tests: acpi: arm/virt: update expected GTDT blobtests/data/acpi/aarch64/virt/GTDT.gwdt tests/qtest/bios-tables-test-allowed-diff.h+0 -10 replies

Reviews trailers per patch

All 13 patches have a Reviewed-by or Acked-by.

PatchEric AugerAni Sinha
1/13R-b
2/13R-b R-b
3/13R-b
4/13R-b
5/13R-b
6/13R-b
7/13R-b
8/13R-b
9/13R-b
10/13R-b
11/13R-b
12/13R-b
13/13R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 00/13] Add watchdog support to arm/virt board

This series adds SBSA GWDT to the arm/virt machine with a WDAT table designed 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.

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_v4

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

Changelog:
v4:
* drop independed patches 14-17 for a separate spin-off (sbsa-gwdt fixes for WCV register writes)
* arm: sbsa_gwdt: rename device type to sbsa-gwdt (patch 3):
- collect Reviewed-by from Eric
* arm: virt: create sbsa-gwdt watchdog (patch 4):
(Eric)
- reorder [VIRT_GWDT_WS0] in irqmap after [VIRT_ACPI_GED]
- add missing blank line in pre_plug handler
- extract FDT node creation into create_gwdt_dt_bindings() helper
- add watchdog documentation to docs/system/arm/virt.rst
- add comment above dc->user_creatable about requiring machine-specific wiring
* acpi: introduce WDAT table for GWDT (patch 6):
(Eric)
- fix comment alignment
- collect Reviewed-by
* arm: virt: add support for WDAT based watchdog (patch 7):
(Eric)
- remove unused 'wdt' parameter from build_gtdt()
- add Native/WDAT modes documentation to docs/system/arm/virt.rst
- collect Reviewed-by
* tests: acpi: arm/virt: update expected WDAT blob (patch 10):
- collect Reviewed-by from Eric
* tests: acpi: arm/virt: add GTDT watchdog table test case (patch 12):
(Eric) fix whitespace in test command string (moved from patch 17)

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:

    v3: https://patchew.org/QEMU/[email protected]/
    v2: https://patchew.org/QEMU/[email protected]/
    v1: https://patchew.org/QEMU/[email protected]/

Igor Mammedov (13):
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

 include/hw/acpi/wdat-gwdt.h            |  19 +++++
 include/hw/arm/virt.h                  |   3 +
 include/hw/watchdog/sbsa_gwdt.h        |   3 +-
 docs/system/arm/virt.rst               |  24 ++++++
 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                          |  48 ++++++++++++
 hw/core/sysbus-fdt.c                   |   2 +
 hw/watchdog/sbsa_gwdt.c                |  24 +++++-
 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 ++++++++++
 16 files changed, 334 insertions(+), 8 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
Signature · 1 line
2.47.3