From: Zenghui Yu <zenghui.yu@linux.dev>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH 2/2] hw/intc/arm_gicv3_kvm: Write all 1's to clear enable/active
Date: Wed, 6 Aug 2025 23:01:17 +0800 [thread overview]
Message-ID: <8468541d-4e1e-4e97-aa2f-8ce1527f03bb@linux.dev> (raw)
In-Reply-To: <CAFEAcA_xS6fy+rWt5g_uAgG0nBwEGFts1GZfqSLF0T668WLuiw@mail.gmail.com>
On 2025/8/1 00:59, Peter Maydell wrote:
> On Tue, 29 Jul 2025 at 17:17, Zenghui Yu <zenghui.yu@linux.dev> wrote:
> >
> > Writing 0 to GICD_IC{ENABLE,ACTIVE}R architecturally has no effect on
> > interrupt status (all writes are simply ignored by KVM) and doesn't comply
> > with the intention of "first write to the clear-reg to clear all bits".
> >
> > Write all 1's to actually clear the enable/active status.
> >
> > Signed-off-by: Zenghui Yu <zenghui.yu@linux.dev>
> > ---
> > hw/intc/arm_gicv3_kvm.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c
> > index f798a6e28c..6166283cd1 100644
> > --- a/hw/intc/arm_gicv3_kvm.c
> > +++ b/hw/intc/arm_gicv3_kvm.c
> > @@ -295,7 +295,7 @@ static void kvm_dist_putbmp(GICv3State *s, uint32_t offset,
> > * the 1 bits.
> > */
> > if (clroffset != 0) {
> > - reg = 0;
> > + reg = ~0;
> > kvm_gicd_access(s, clroffset, ®, true);
> > clroffset += 4;
> > }
>
> I guess given what the kernel has implemented that this
> is the correct change, so on that basis
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
>
> I don't understand what the kernel ABI is trying to do here,
> though...
>
> My expectation for user access for all these registers
> where there's a "set" and a "clear" register pair would
> be that they behave the same way. But looking at the
> implementation, GICD_ICPENDR seems to be implemented
> as "reads zero, writes ignored", whereas GICD_ICACTIVER
> implements the "write-1-to-clear" semantics.
>
> This seems to match what is documented, but I don't
> understand why we implemented and documented that:
> https://docs.kernel.org/virt/kvm/devices/arm-vgic-v3.html
I think these 2 paragraphs exactly explain the reason:
"This is identical to the value returned by a guest read from
ISPENDR for an edge triggered interrupt, but may differ for level
[...]
cannot be deduced from purely the line level and the value of the
ISPENDR registers)."
Does it help?
Thanks,
Zenghui
next prev parent reply other threads:[~2025-08-06 15:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-29 16:16 [PATCH 0/2] hw/intc/arm_gicv3_kvm: two small fixes about register accesses Zenghui Yu
2025-07-29 16:16 ` [PATCH 1/2] hw/intc/arm_gicv3_kvm: Remove writes to ICPENDR registers Zenghui Yu
2025-07-31 16:42 ` Peter Maydell
2025-07-31 17:01 ` Peter Maydell
2025-07-29 16:16 ` [PATCH 2/2] hw/intc/arm_gicv3_kvm: Write all 1's to clear enable/active Zenghui Yu
2025-07-31 16:59 ` Peter Maydell
2025-08-06 15:01 ` Zenghui Yu [this message]
2025-07-31 17:11 ` [PATCH 0/2] hw/intc/arm_gicv3_kvm: two small fixes about register accesses Peter Maydell
2025-08-06 14:55 ` Zenghui Yu
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=8468541d-4e1e-4e97-aa2f-8ce1527f03bb@linux.dev \
--to=zenghui.yu@linux.dev \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).