From: Oliver Upton <oliver.upton@linux.dev>
To: Raghavendra Rao Ananta <rananta@google.com>
Cc: Marc Zyngier <maz@kernel.org>,
linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: arm64: Set/unset vGIC v4 forwarding if direct IRQs are supported
Date: Tue, 29 Jul 2025 11:02:51 -0700 [thread overview]
Message-ID: <aIkMy7YPbcf0jvHq@linux.dev> (raw)
In-Reply-To: <CAJHc60xPKgVn96azWhP1NbfKioEZj68APQPf=zKRMuHB7-goqA@mail.gmail.com>
On Tue, Jul 29, 2025 at 09:56:12AM -0700, Raghavendra Rao Ananta wrote:
> On Tue, Jul 29, 2025 at 7:37 AM Oliver Upton <oliver.upton@linux.dev> wrote:
> >
> > Hi Raghu,
> >
> > Thanks for reporting this so quickly :)
> >
> > On Mon, Jul 28, 2025 at 10:37:10PM +0000, Raghavendra Rao Ananta wrote:
> > > diff --git a/arch/arm64/kvm/vgic/vgic-v4.c b/arch/arm64/kvm/vgic/vgic-v4.c
> > > index e7e284d47a77..873a190bcff7 100644
> > > --- a/arch/arm64/kvm/vgic/vgic-v4.c
> > > +++ b/arch/arm64/kvm/vgic/vgic-v4.c
> > > @@ -433,7 +433,7 @@ int kvm_vgic_v4_set_forwarding(struct kvm *kvm, int virq,
> > > unsigned long flags;
> > > int ret = 0;
> > >
> > > - if (!vgic_supports_direct_msis(kvm))
> > > + if (!vgic_supports_direct_irqs(kvm))
> > > return 0;
> > >
> > > /*
> > > @@ -533,7 +533,7 @@ int kvm_vgic_v4_unset_forwarding(struct kvm *kvm, int host_irq)
> > > unsigned long flags;
> > > int ret = 0;
> > >
> > > - if (!vgic_supports_direct_msis(kvm))
> > > + if (!vgic_supports_direct_irqs(kvm))
> > > return 0;
> >
> > I'm not sure this is what we want, since a precondition of actually
> > doing vLPI injection is the guest having an ITS. Could you try the
> > following?
> >
> > Thanks,
> > Oliver
> >
> > diff --git a/arch/arm64/kvm/vgic/vgic-mmio-v3.c b/arch/arm64/kvm/vgic/vgic-mmio-v3.c
> > index a3ef185209e9..70d50c77e5dc 100644
> > --- a/arch/arm64/kvm/vgic/vgic-mmio-v3.c
> > +++ b/arch/arm64/kvm/vgic/vgic-mmio-v3.c
> > @@ -50,6 +50,14 @@ bool vgic_has_its(struct kvm *kvm)
> >
> > bool vgic_supports_direct_msis(struct kvm *kvm)
> > {
> > + /*
> > + * Deliberately conflate vLPI and vSGI support on GICv4.1 hardware,
> > + * indirectly allowing userspace to control whether or not vPEs are
> > + * allocated for the VM.
> > + */
> > + if (system_supports_direct_sgis() && !vgic_supports_direct_sgis(kvm))
> > + return false;
> > +
> > return kvm_vgic_global_state.has_gicv4 && vgic_has_its(kvm);
> > }
> >
> > diff --git a/arch/arm64/kvm/vgic/vgic.h b/arch/arm64/kvm/vgic/vgic.h
> > index 1384a04c0784..de1c1d3261c3 100644
> > --- a/arch/arm64/kvm/vgic/vgic.h
> > +++ b/arch/arm64/kvm/vgic/vgic.h
> > @@ -396,15 +396,7 @@ bool vgic_supports_direct_sgis(struct kvm *kvm);
> >
> > static inline bool vgic_supports_direct_irqs(struct kvm *kvm)
> > {
> > - /*
> > - * Deliberately conflate vLPI and vSGI support on GICv4.1 hardware,
> > - * indirectly allowing userspace to control whether or not vPEs are
> > - * allocated for the VM.
> > - */
> > - if (system_supports_direct_sgis())
> > - return vgic_supports_direct_sgis(kvm);
> > -
> > - return vgic_supports_direct_msis(kvm);
> > + return vgic_supports_direct_msis(kvm) || vgic_supports_direct_sgis(kvm);
> > }
> >
> > int vgic_v4_init(struct kvm *kvm);
>
> Yes, the diff seems fine (tested as well). Would you be pushing a v2
> or do you want me to (on your behalf)?
Go ahead and respin this diff, thanks!
Oliver
prev parent reply other threads:[~2025-07-29 18:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-28 22:37 [PATCH] KVM: arm64: Set/unset vGIC v4 forwarding if direct IRQs are supported Raghavendra Rao Ananta
2025-07-29 14:37 ` Oliver Upton
2025-07-29 16:56 ` Raghavendra Rao Ananta
2025-07-29 18:02 ` Oliver Upton [this message]
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=aIkMy7YPbcf0jvHq@linux.dev \
--to=oliver.upton@linux.dev \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=rananta@google.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;
as well as URLs for NNTP newsgroup(s).