]> www.infradead.org Git - users/hch/misc.git/commitdiff
arm64: cpucaps: Add GICv5 Legacy vCPU interface (GCIE_LEGACY) capability
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)
Implement the GCIE_LEGACY capability as a system feature to be able to
check for support from KVM. The type is explicitly
ARM64_CPUCAP_EARLY_LOCAL_CPU_FEATURE, which means that the capability
is enabled early if all boot CPUs support it. Additionally, if this
capability is enabled during boot, it prevents late onlining of CPUs
that lack it, thereby avoiding potential mismatched configurations
which would break KVM.

Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kernel/cpufeature.c
arch/arm64/tools/cpucaps

index ef269a5a37e12c53e8e825e947b910f6d3efd296..770a41fa7214dacc8cea99c6136aad787757e61e 100644 (file)
@@ -2539,6 +2539,15 @@ test_has_mpam_hcr(const struct arm64_cpu_capabilities *entry, int scope)
        return idr & MPAMIDR_EL1_HAS_HCR;
 }
 
+static bool
+test_has_gicv5_legacy(const struct arm64_cpu_capabilities *entry, int scope)
+{
+       if (!this_cpu_has_cap(ARM64_HAS_GICV5_CPUIF))
+               return false;
+
+       return !!(read_sysreg_s(SYS_ICC_IDR0_EL1) & ICC_IDR0_EL1_GCIE_LEGACY);
+}
+
 static const struct arm64_cpu_capabilities arm64_features[] = {
        {
                .capability = ARM64_ALWAYS_BOOT,
@@ -3156,6 +3165,12 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
                .matches = has_cpuid_feature,
                ARM64_CPUID_FIELDS(ID_AA64PFR2_EL1, GCIE, IMP)
        },
+       {
+               .desc = "GICv5 Legacy vCPU interface",
+               .type = ARM64_CPUCAP_EARLY_LOCAL_CPU_FEATURE,
+               .capability = ARM64_HAS_GICV5_LEGACY,
+               .matches = test_has_gicv5_legacy,
+       },
        {},
 };
 
index 9ff5cdbd27597b3b18b10d43246e303577ee7bae..1b32c1232d28d86e44f99e3bde3d118624d33aec 100644 (file)
@@ -37,6 +37,7 @@ HAS_GENERIC_AUTH_ARCH_QARMA5
 HAS_GENERIC_AUTH_IMP_DEF
 HAS_GICV3_CPUIF
 HAS_GICV5_CPUIF
+HAS_GICV5_LEGACY
 HAS_GIC_PRIO_MASKING
 HAS_GIC_PRIO_RELAXED_SYNC
 HAS_HCR_NV1