Skip to content

Commit 7847f51

Browse files
Sticklyman1936Marc Zyngier
authored andcommitted
arm64: cpucaps: Add GICv5 Legacy vCPU interface (GCIE_LEGACY) capability
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>
1 parent d5a012a commit 7847f51

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

arch/arm64/kernel/cpufeature.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2539,6 +2539,15 @@ test_has_mpam_hcr(const struct arm64_cpu_capabilities *entry, int scope)
25392539
return idr & MPAMIDR_EL1_HAS_HCR;
25402540
}
25412541

2542+
static bool
2543+
test_has_gicv5_legacy(const struct arm64_cpu_capabilities *entry, int scope)
2544+
{
2545+
if (!this_cpu_has_cap(ARM64_HAS_GICV5_CPUIF))
2546+
return false;
2547+
2548+
return !!(read_sysreg_s(SYS_ICC_IDR0_EL1) & ICC_IDR0_EL1_GCIE_LEGACY);
2549+
}
2550+
25422551
static const struct arm64_cpu_capabilities arm64_features[] = {
25432552
{
25442553
.capability = ARM64_ALWAYS_BOOT,
@@ -3156,6 +3165,12 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
31563165
.matches = has_cpuid_feature,
31573166
ARM64_CPUID_FIELDS(ID_AA64PFR2_EL1, GCIE, IMP)
31583167
},
3168+
{
3169+
.desc = "GICv5 Legacy vCPU interface",
3170+
.type = ARM64_CPUCAP_EARLY_LOCAL_CPU_FEATURE,
3171+
.capability = ARM64_HAS_GICV5_LEGACY,
3172+
.matches = test_has_gicv5_legacy,
3173+
},
31593174
{},
31603175
};
31613176

arch/arm64/tools/cpucaps

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ HAS_GENERIC_AUTH_ARCH_QARMA5
3737
HAS_GENERIC_AUTH_IMP_DEF
3838
HAS_GICV3_CPUIF
3939
HAS_GICV5_CPUIF
40+
HAS_GICV5_LEGACY
4041
HAS_GIC_PRIO_MASKING
4142
HAS_GIC_PRIO_RELAXED_SYNC
4243
HAS_HCR_NV1

0 commit comments

Comments
 (0)