Re: [PATCH 1/2] KVM: arm64: vgic-v4: Don't allocate vPEs for a GICv2 VM
From: Oliver Upton
Date: Mon Oct 26 2026 - 15:13:51 EST
On Mon, Oct 26, 2026 at 03:26:38PM +0000, Fuad Tabba wrote:
> KVM can run a GICv2 VM on a GICv4.0 host whose CPU interface supports
> legacy operation.
I'm pretty sure there's no IP out there that has GICv4.0 and legacy
mode...
> Such a VM has no LPIs and never uses vPEs, so
> vgic_supports_direct_irqs() is false for it and kvm_vgic_dist_destroy()
> never tears them down. However, userspace can still create an ITS for
> it. Once the vgic is initialised, vgic_its_create() calls
> vgic_v4_init(), which allocates the vPEs and requests a doorbell IRQ for
> each vCPU. They're then never freed, and each doorbell handler stays
> registered with a vCPU that's freed with the VM.
>
> Only allocate vPEs for a GICv3 VM.
>
> Fixes: 74fe55dc9ab77 ("KVM: arm/arm64: GICv4: Add init/teardown of the per-VM vPE irq domain")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Fuad Tabba <fuad.tabba@xxxxxxxxx>
> ---
> arch/arm64/kvm/vgic/vgic-v4.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm64/kvm/vgic/vgic-v4.c b/arch/arm64/kvm/vgic/vgic-v4.c
> index ed236f083f0d7..a01de4de608a6 100644
> --- a/arch/arm64/kvm/vgic/vgic-v4.c
> +++ b/arch/arm64/kvm/vgic/vgic-v4.c
> @@ -248,7 +248,7 @@ int vgic_v4_init(struct kvm *kvm)
>
> lockdep_assert_held(&kvm->arch.config_lock);
>
> - if (!kvm_vgic_global_state.has_gicv4)
> + if (!kvm_vgic_global_state.has_gicv4 || dist->vgic_model != KVM_DEV_TYPE_ARM_VGIC_V3)
use vgic_is_v3() instead
Thanks,
Oliver
> return 0; /* Nothing to see here... move along. */
>
> if (dist->its_vm.vpes)
> --
> 2.47.3
>
>