[PATCH 0/6] sbsa-gwdt cleanup and fixes

Igor Mammedov posted 6 patches 3 weeks, 3 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260902122646.2848464-1-imammedo@redhat.com
Maintainers: Peter Maydell <peter.maydell@linaro.org>, Leif Lindholm <leif.lindholm@oss.qualcomm.com>
hw/watchdog/sbsa_gwdt.c | 81 +++++++++++++++++++++++++++--------------
1 file changed, 54 insertions(+), 27 deletions(-)
[PATCH 0/6] sbsa-gwdt cleanup and fixes
Posted by Igor Mammedov 3 weeks, 3 days ago
Series picks up dropped gwdt fixes from

  [PATCH v3 00/17] Add watchdog support to arm/virt board
  https://patchew.org/QEMU/20260624102830.1355552-1-imammedo@redhat.com/

patches were basically rewritten to make changes simpler/easier to reson about.

patch 6/6 is partial fix with open question:

sbsa-gwdt currently mantains WVC in since VM start ticks, which works fine under
TCG. However under KVM those system counter domains diverge and CNTPCT in guest
starts to return host's value. As result WCV reads/writes got mixed up with
QEMU still assuming VM timeframe while guest using host's one.
Question is how should we fix it?

Igor Mammedov (6):
  sbsa-gwdt: reduce code ident
  arm: gwdt: consolidate clear WS0 and WS1 on explicit refresh
  arm: gwdt: simplify WCV update condition
  sbsa-gwdt: rename sbsa_gwdt_update_timer() to
    sbsa_gwdt_wor_update_timer()
  sbsa-gwdt: don't arm timer for compare values above INT64_MAX
  sbsa-gwdt: reschedule timer on direct WCV load

 hw/watchdog/sbsa_gwdt.c | 81 +++++++++++++++++++++++++++--------------
 1 file changed, 54 insertions(+), 27 deletions(-)

-- 
2.52.0
Re: [PATCH 0/6] sbsa-gwdt cleanup and fixes
Posted by Peter Maydell 2 weeks, 4 days ago
On Wed, 2 Sept 2026 at 13:26, Igor Mammedov <imammedo@redhat.com> wrote:
>
>
> Series picks up dropped gwdt fixes from
>
>   [PATCH v3 00/17] Add watchdog support to arm/virt board
>   https://patchew.org/QEMU/20260624102830.1355552-1-imammedo@redhat.com/
>
> patches were basically rewritten to make changes simpler/easier to reson about.
>
> patch 6/6 is partial fix with open question:
>
> sbsa-gwdt currently mantains WVC in since VM start ticks, which works fine under
> TCG. However under KVM those system counter domains diverge and CNTPCT in guest
> starts to return host's value. As result WCV reads/writes got mixed up with
> QEMU still assuming VM timeframe while guest using host's one.
> Question is how should we fix it?

Presumably we should be dealing in deltas from the
QEMU_CLOCK_VIRTUAL value?

Anyway, for this series, since the only thing I wanted to change
was expanding a comment, I'll apply this to target-arm.next and
make that tweak there.

-- PMM
Re: [PATCH 0/6] sbsa-gwdt cleanup and fixes
Posted by Igor Mammedov 2 weeks, 3 days ago
On Tue, 8 Sep 2026 16:08:35 +0100
Peter Maydell <peter.maydell@linaro.org> wrote:

> On Wed, 2 Sept 2026 at 13:26, Igor Mammedov <imammedo@redhat.com> wrote:
> >
> >
> > Series picks up dropped gwdt fixes from
> >
> >   [PATCH v3 00/17] Add watchdog support to arm/virt board
> >   https://patchew.org/QEMU/20260624102830.1355552-1-imammedo@redhat.com/
> >
> > patches were basically rewritten to make changes simpler/easier to reson about.
> >
> > patch 6/6 is partial fix with open question:
> >
> > sbsa-gwdt currently mantains WVC in since VM start ticks, which works fine under
> > TCG. However under KVM those system counter domains diverge and CNTPCT in guest
> > starts to return host's value. As result WCV reads/writes got mixed up with
> > QEMU still assuming VM timeframe while guest using host's one.
> > Question is how should we fix it?  
> 
> Presumably we should be dealing in deltas from the
> QEMU_CLOCK_VIRTUAL value?

deltas could works as workaround at cost of polluting sbsa-gwdt
device model with KVM quirk. but then real fun begins when we
bring in picture migration (even not counting CNTPCT jump),
WCV would either diverge or jump as well => more KVM quirks
in whatchdog code to deal with.

I'd think that we would want to track QEMU_CLOCK_VIRTUAL in WCV,
basically make CNTPCT = CNTVCT and treat as such everywhere.

What is lost on me is history/reasoning why CNTPCT tracks host value?
Why can't we make it track virtual clock instead (there is KVM_ARM_SET_COUNTER_OFFSET
that supposedly should do the job)?

> Anyway, for this series, since the only thing I wanted to change
> was expanding a comment, I'll apply this to target-arm.next and
> make that tweak there.

Thanks!
> 
> -- PMM
>