From: Oliver Upton <oliver.upton@linux.dev>
To: Eric Auger <eauger@redhat.com>
Cc: kvmarm@lists.linux.dev, Marc Zyngier <maz@kernel.org>,
Joey Gouly <joey.gouly@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Zenghui Yu <yuzenghui@huawei.com>,
Raghavendra Rao Ananta <rananta@google.com>,
Zhou Wang <wangzhou1@hisilicon.com>
Subject: Re: [PATCH v4 1/6] KVM: arm64: Disambiguate support for vSGIs v. vLPIs
Date: Tue, 22 Jul 2025 14:36:32 -0700 [thread overview]
Message-ID: <aIAEUU_1eCbuM9YT@linux.dev> (raw)
In-Reply-To: <50eee3a2-55d5-4128-8b42-47a37306b8a1@redhat.com>
On Mon, Jul 14, 2025 at 12:20:14PM +0200, Eric Auger wrote:
> Ho Oliver,
Yo -- Eric! Sorry for the latency, ${WORK}.
> On 7/9/25 11:14 PM, Oliver Upton wrote:
> > vgic_supports_direct_msis() is a bit of a misnomer, as it returns true
> > if either vSGIs or vLPIs are supported. Pick it apart into a few
> > predicates and replace some open-coded checks for vSGIs.
> >
> > Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
> > ---
> > arch/arm64/kvm/vgic/vgic-init.c | 4 ++--
> > arch/arm64/kvm/vgic/vgic-mmio-v3.c | 16 ++++++++++------
> > arch/arm64/kvm/vgic/vgic-v4.c | 4 ++--
> > arch/arm64/kvm/vgic/vgic.c | 4 ++--
> > arch/arm64/kvm/vgic/vgic.h | 7 +++++++
> > 5 files changed, 23 insertions(+), 12 deletions(-)
> >
> > diff --git a/arch/arm64/kvm/vgic/vgic-init.c b/arch/arm64/kvm/vgic/vgic-init.c
> > index eb1205654ac8..5e0e4559004b 100644
> > --- a/arch/arm64/kvm/vgic/vgic-init.c
> > +++ b/arch/arm64/kvm/vgic/vgic-init.c
> > @@ -395,7 +395,7 @@ int vgic_init(struct kvm *kvm)
> > * v4 support so that we get HW-accelerated vSGIs. Otherwise, only
> > * enable it if we present a virtual ITS to the guest.
> the above comment refers to vSGISs. While the below change looks OK, I
> feel difficult to associate it to the code below.
I'm not sure the comment serves much purpose at this point. If anything,
it should go with the implementation of vgic_supports_direct_irqs()
> > */
> > - if (vgic_supports_direct_msis(kvm)) {
> > + if (vgic_supports_direct_irqs(kvm)) {
> > ret = vgic_v4_init(kvm);
> > if (ret)
> > goto out;
> > @@ -443,7 +443,7 @@ static void kvm_vgic_dist_destroy(struct kvm *kvm)
> > dist->vgic_cpu_base = VGIC_ADDR_UNDEF;
> > }
> >
> > - if (vgic_supports_direct_msis(kvm))
> > + if (vgic_supports_direct_irqs(kvm))
> > vgic_v4_teardown(kvm);
> >
> > xa_destroy(&dist->lpi_xa);
> > diff --git a/arch/arm64/kvm/vgic/vgic-mmio-v3.c b/arch/arm64/kvm/vgic/vgic-mmio-v3.c
> > index ae4c0593d114..1a9c5b4418b2 100644
> > --- a/arch/arm64/kvm/vgic/vgic-mmio-v3.c
> > +++ b/arch/arm64/kvm/vgic/vgic-mmio-v3.c
> > @@ -50,8 +50,12 @@ bool vgic_has_its(struct kvm *kvm)
> >
> > bool vgic_supports_direct_msis(struct kvm *kvm)
> > {
> > - return (kvm_vgic_global_state.has_gicv4_1 ||
> > - (kvm_vgic_global_state.has_gicv4 && vgic_has_its(kvm)));
> > + return kvm_vgic_global_state.has_gicv4 && vgic_has_its(kvm);
> > +}
> > +
> > +bool vgic_supports_direct_sgis(struct kvm *kvm)
> > +{
> > + return kvm_vgic_global_state.has_gicv4_1 && gic_cpuif_has_vsgi();
> In some checks we now have "&& gic_cpuif_has_vsgi()" added whereas we
> previously only checked kvm_vgic_global_state.has_gicv4_1. This may be
> described in the commit message too and explain whether this is a fix
> for some configs.
Happy to add a mention to the changelog since this is definitely a
subtle bugfix. Although I hope there aren't any actual implementations
like this (i.e. GICv4.1 ITS w/o ability to deliver vSGIs)
Thanks for having a look,
Oliver
next prev parent reply other threads:[~2025-07-22 21:36 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-09 21:14 [PATCH v4 0/6] KVM: arm64: Allow userspace to write GICD_TYPER2.nASSGIcap Oliver Upton
2025-07-09 21:14 ` [PATCH v4 1/6] KVM: arm64: Disambiguate support for vSGIs v. vLPIs Oliver Upton
2025-07-10 8:59 ` Ben Horgan
2025-07-10 16:22 ` Oliver Upton
2025-07-14 10:20 ` Eric Auger
2025-07-22 21:36 ` Oliver Upton [this message]
2025-07-09 21:14 ` [PATCH v4 2/6] KVM: arm64: vgic-v3: Consolidate MAINT_IRQ handling Oliver Upton
2025-07-14 12:52 ` Eric Auger
2025-07-14 12:59 ` Eric Auger
2025-07-22 21:42 ` Oliver Upton
2025-07-09 21:14 ` [PATCH v4 3/6] KVM: arm64: vgic-v3: Allow access to GICD_IIDR prior to initialization Oliver Upton
2025-07-14 14:41 ` Eric Auger
2025-07-22 21:47 ` Oliver Upton
2025-08-21 10:55 ` Zhou Wang
2025-08-21 18:43 ` Oliver Upton
2025-08-22 1:54 ` Zhou Wang
2025-07-09 21:14 ` [PATCH v4 4/6] KVM: arm64: vgic-v3: Allow userspace to write GICD_TYPER2.nASSGIcap Oliver Upton
2025-07-14 14:58 ` Eric Auger
2025-07-09 21:14 ` [PATCH v4 5/6] KVM: arm64: selftests: Add test for nASSGIcap attribute Oliver Upton
2025-07-14 15:03 ` Eric Auger
2025-07-09 21:14 ` [PATCH v4 6/6] Documentation: KVM: arm64: Describe VGICv3 registers writable pre-init Oliver Upton
2025-07-14 15:06 ` Eric Auger
2025-07-22 21:50 ` Oliver Upton
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=aIAEUU_1eCbuM9YT@linux.dev \
--to=oliver.upton@linux.dev \
--cc=eauger@redhat.com \
--cc=joey.gouly@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=maz@kernel.org \
--cc=rananta@google.com \
--cc=suzuki.poulose@arm.com \
--cc=wangzhou1@hisilicon.com \
--cc=yuzenghui@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox