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 3/6] KVM: arm64: vgic-v3: Allow access to GICD_IIDR prior to initialization
Date: Tue, 22 Jul 2025 14:47:23 -0700 [thread overview]
Message-ID: <aIAG60LuRlJjYA5o@linux.dev> (raw)
In-Reply-To: <aeb76627-41b2-4550-9010-de90b679bfd4@redhat.com>
On Mon, Jul 14, 2025 at 04:41:45PM +0200, Eric Auger wrote:
> Hi Oliver,
>
> On 7/9/25 11:14 PM, Oliver Upton wrote:
> > KVM allows userspace to write GICD_IIDR for backwards-compatibility with
> > older kernels, where new implementation revisions have new features.
> > Unfortunately this is allowed to happen at runtime, and ripping features
> > out from underneath a running guest is a terrible idea.
> >
> > While we can't do anything about the ABI, prepare for more ID-like
> > registers by allowing access to GICD_IIDR prior to VGIC initialization.
> > Subsequent changes will allow the VMM to further provision the GIC
> > feature set, e.g. the presence of nASSGIcap.
> >
> > Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
> > ---
> > arch/arm64/kvm/vgic/vgic-init.c | 9 +--------
> > arch/arm64/kvm/vgic/vgic-kvm-device.c | 20 +++++++++++++++++++-
> > 2 files changed, 20 insertions(+), 9 deletions(-)
> >
> > diff --git a/arch/arm64/kvm/vgic/vgic-init.c b/arch/arm64/kvm/vgic/vgic-init.c
> > index 5e0e4559004b..487e902b040c 100644
> > --- a/arch/arm64/kvm/vgic/vgic-init.c
> > +++ b/arch/arm64/kvm/vgic/vgic-init.c
> > @@ -157,6 +157,7 @@ int kvm_vgic_create(struct kvm *kvm, u32 type)
> >
> > kvm->arch.vgic.in_kernel = true;
> > kvm->arch.vgic.vgic_model = type;
> > + kvm->arch.vgic.implementation_rev = KVM_VGIC_IMP_REV_LATEST;
> >
> > kvm->arch.vgic.vgic_dist_base = VGIC_ADDR_UNDEF;
> >
> > @@ -409,15 +410,7 @@ int vgic_init(struct kvm *kvm)
> > goto out;
> >
> > vgic_debug_init(kvm);
> > -
> > - /*
> > - * If userspace didn't set the GIC implementation revision,
> > - * default to the latest and greatest. You know want it.
> > - */
> > - if (!dist->implementation_rev)
> > - dist->implementation_rev = KVM_VGIC_IMP_REV_LATEST;
> The change related to KVM_VGIC_IMP_REV_LATEST looks unrelated to the
> commit title/msg, isn't it?
It is deliberate here to make IIDR have a similar discovery model to the
CPU feature ID registers where the value after creation represents the
maximum feature set.
> > @@ -552,7 +570,7 @@ static int vgic_v3_attr_regs_access(struct kvm_device *dev,
> >
> > mutex_lock(&dev->kvm->arch.config_lock);
> >
> > - if (!vgic_initialized(dev->kvm)) {
> > + if (!(vgic_initialized(dev->kvm) || reg_allowed_pre_init(attr))) {
> nit: !vgic_initialized(dev->kvm) && !reg_allowed_pre_init() is easier to
> compute for me
>
>
> Besides
>
> Reviewed-by: Eric Auger <eric.auger@redhat.com>
Thanks!
Oliver
next prev parent reply other threads:[~2025-07-22 21:47 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
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 [this message]
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=aIAG60LuRlJjYA5o@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