]> www.infradead.org Git - users/hch/misc.git/commitdiff
KVM: arm64: Use ARM64_HAS_GICV5_LEGACY for GICv5 probing
authorSascha Bischoff <Sascha.Bischoff@arm.com>
Thu, 28 Aug 2025 10:59:42 +0000 (10:59 +0000)
committerMarc Zyngier <maz@kernel.org>
Wed, 17 Sep 2025 16:41:02 +0000 (17:41 +0100)
The previous implementation of the probing function had the flaw that
it wouldn't catch mismatched CPU features. Specifically, GICv5 legacy
support (support for GICv3 VMs on a GICv5 host) was being enabled as
long as the initial boot CPU had support for the feature. This allowed
the support to become enabled on mismatched configurations.

Move to using cpus_have_final_cap(ARM64_HAS_GICV5_LEGACY) instead,
which only returns true when all booted CPUs support
FEAT_GCIE_LEGACY. A byproduct of this is that it ensures that late
onlining of CPUs is blocked on feature mismatch.

Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com>
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/vgic/vgic-v5.c

index 6bdbb221bcde71468cba7d015e4a04b79f07714a..2d3811f4e1174907a01cf72f0ca58076baf166d0 100644 (file)
@@ -15,7 +15,7 @@ int vgic_v5_probe(const struct gic_kvm_info *info)
        u64 ich_vtr_el2;
        int ret;
 
-       if (!info->has_gcie_v3_compat)
+       if (!cpus_have_final_cap(ARM64_HAS_GICV5_LEGACY))
                return -ENODEV;
 
        kvm_vgic_global_state.type = VGIC_V5;