From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, leif.lindholm@oss.qualcomm.com,
eauger@redhat.com
Subject: [PATCH 6/6] sbsa-gwdt: reschedule timer on direct WCV load
Date: Wed, 2 Sep 2026 14:26:46 +0200 [thread overview]
Message-ID: <20260902122646.2848464-7-imammedo@redhat.com> (raw)
In-Reply-To: <20260902122646.2848464-1-imammedo@redhat.com>
According to spec[1]:
"The compare value can either be loaded directly or indirectly on an
explicit refresh or timeout refresh"
QEMU accepts writes to WCV but doesn't reschedule the timer,
which it should per the spec pseudo code:
"TimeoutRefresh = ( SystemCounter [63:0] > CompareValue [63:0])"
Fix it by updating the timer on WCV write.
partialy[2] fixes Windows in GTDT mode, which never issues a WRR refresh.
Instead, it programs WOR to ~4 sec, enables WCS, and immediately
writes a large absolute value into WCV to push the timeout far
into the future. Without this, QEMU ignores the WCV write,
the short WOR expires, and the guest reboots unexpectedly.
1) Arm® Server Base System Architecture 6.0
Platform Design Document
DEN0029D 6.0
"A.2 Watchdog Operation"
2) under KVM system counter (CNTPCT) as read by guest apprears to
produce host's value, so watchdog timeout effectively gets
extended on host uptime offset. But that's a separate issue
to be fixed.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
hw/watchdog/sbsa_gwdt.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/hw/watchdog/sbsa_gwdt.c b/hw/watchdog/sbsa_gwdt.c
index 0a1d981072..9ed109d6eb 100644
--- a/hw/watchdog/sbsa_gwdt.c
+++ b/hw/watchdog/sbsa_gwdt.c
@@ -148,6 +148,13 @@ static void sbsa_gwdt_wor_update_timer(SBSA_GWDTState *s, WdtRefreshType rtype)
sbsa_gwdt_set_timer(s, timeout);
}
+static void sbsa_gwdt_wcv_update_timer(SBSA_GWDTState *s)
+{
+ if (s->wcs & SBSA_GWDT_WCS_EN) {
+ sbsa_gwdt_set_timer(s, (uint64_t)s->wcvu << 32 | s->wcvl);
+ }
+}
+
static void sbsa_gwdt_rwrite(void *opaque, hwaddr offset, uint64_t data,
unsigned size) {
SBSA_GWDTState *s = SBSA_GWDT(opaque);
@@ -187,10 +194,12 @@ static void sbsa_gwdt_write(void *opaque, hwaddr offset, uint64_t data,
case SBSA_GWDT_WCV:
s->wcvl = data;
+ sbsa_gwdt_wcv_update_timer(s);
break;
case SBSA_GWDT_WCVU:
s->wcvu = data;
+ sbsa_gwdt_wcv_update_timer(s);
break;
default:
--
2.52.0
next prev parent reply other threads:[~2026-09-02 12:28 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 12:26 [PATCH 0/6] sbsa-gwdt cleanup and fixes Igor Mammedov
2026-09-02 12:26 ` [PATCH 1/6] sbsa-gwdt: reduce code ident Igor Mammedov
2026-09-08 14:28 ` Peter Maydell
2026-09-08 14:47 ` Igor Mammedov
2026-09-02 12:26 ` [PATCH 2/6] arm: gwdt: consolidate clear WS0 and WS1 on explicit refresh Igor Mammedov
2026-09-08 14:34 ` Peter Maydell
2026-09-02 12:26 ` [PATCH 3/6] arm: gwdt: simplify WCV update condition Igor Mammedov
2026-09-08 14:49 ` Peter Maydell
2026-09-02 12:26 ` [PATCH 4/6] sbsa-gwdt: rename sbsa_gwdt_update_timer() to sbsa_gwdt_wor_update_timer() Igor Mammedov
2026-09-08 14:56 ` Peter Maydell
2026-09-02 12:26 ` [PATCH 5/6] sbsa-gwdt: don't arm timer for compare values above INT64_MAX Igor Mammedov
2026-09-08 14:57 ` Peter Maydell
2026-09-02 12:26 ` Igor Mammedov [this message]
2026-09-08 14:57 ` [PATCH 6/6] sbsa-gwdt: reschedule timer on direct WCV load Peter Maydell
2026-09-08 15:08 ` [PATCH 0/6] sbsa-gwdt cleanup and fixes Peter Maydell
2026-09-09 8:17 ` 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=20260902122646.2848464-7-imammedo@redhat.com \
--to=imammedo@redhat.com \
--cc=eauger@redhat.com \
--cc=leif.lindholm@oss.qualcomm.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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.