[PATCH v2 13/36] KVM: arm64: gic: Set vgic_model before initing private IRQs
Jonathan Cameron
jonathan.cameron at huawei.com
Wed Jan 7 03:24:53 PST 2026
On Fri, 19 Dec 2025 15:52:40 +0000
Sascha Bischoff <Sascha.Bischoff at arm.com> wrote:
> Different GIC types require the private IRQs to be initialised
> differently. GICv5 is the culprit as it supports both a different
> number of private IRQs, and all of these are PPIs (there are no
> SGIs). Moreover, as GICv5 uses the top bits of the interrupt ID to
> encode the type, the intid also needs to computed differently.
>
> Up until now, the GIC model has been set after initialising the
> private IRQs for a VCPU. Move this earlier to ensure that the GIC
> model is available when configuring the private IRQs.
Hi Sascha,
Good to mention you are moving a bit more than just the type
initialization. One question on whether it makes sense to move
vgic_dist_base inline.
>
> Signed-off-by: Sascha Bischoff <sascha.bischoff at arm.com>
> ---
> arch/arm64/kvm/vgic/vgic-init.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm64/kvm/vgic/vgic-init.c b/arch/arm64/kvm/vgic/vgic-init.c
> index c602f24bab1bb..bcc2c79f7833c 100644
> --- a/arch/arm64/kvm/vgic/vgic-init.c
> +++ b/arch/arm64/kvm/vgic/vgic-init.c
> @@ -140,6 +140,12 @@ int kvm_vgic_create(struct kvm *kvm, u32 type)
> goto out_unlock;
> }
>
> + kvm->arch.vgic.in_kernel = true;
> + kvm->arch.vgic.vgic_model = type;
> + kvm->arch.vgic.implementation_rev = KVM_VGIC_IMP_REV_LATEST;
Moving these looks fine.
> +
> + kvm->arch.vgic.vgic_dist_base = VGIC_ADDR_UNDEF;
Does this need to move? The rest of the *base =
stuff is still where this code originally came from.
Might well be necessary but I'd expect a little in the patch description on why.
> +
> kvm_for_each_vcpu(i, vcpu, kvm) {
> ret = vgic_allocate_private_irqs_locked(vcpu, type);
> if (ret)
> @@ -156,12 +162,6 @@ int kvm_vgic_create(struct kvm *kvm, u32 type)
> goto out_unlock;
> }
>
> - 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;
> -
> aa64pfr0 = kvm_read_vm_id_reg(kvm, SYS_ID_AA64PFR0_EL1) & ~ID_AA64PFR0_EL1_GIC;
> pfr1 = kvm_read_vm_id_reg(kvm, SYS_ID_PFR1_EL1) & ~ID_PFR1_EL1_GIC;
>
More information about the linux-arm-kernel
mailing list