Skip to content

Commit b0c756f

Browse files
kristina-martsenkoctmarinas
authored andcommitted
arm64: cpufeature: detect FEAT_HCX
Detect if the system has the new HCRX_EL2 register added in ARMv8.7/9.2, so that subsequent patches can check for its presence. KVM currently relies on the register being present on all CPUs (or none), so the kernel will panic if that is not the case. Fortunately no such systems currently exist, but this can be revisited if they appear. Note that the kernel will not panic if CONFIG_KVM is disabled. Reviewed-by: Catalin Marinas <[email protected]> Signed-off-by: Kristina Martsenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent af94aad commit b0c756f

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

arch/arm64/kernel/cpufeature.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ static const struct arm64_ftr_bits ftr_id_aa64mmfr0[] = {
364364
static const struct arm64_ftr_bits ftr_id_aa64mmfr1[] = {
365365
ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64MMFR1_EL1_TIDCP1_SHIFT, 4, 0),
366366
ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR1_EL1_AFP_SHIFT, 4, 0),
367+
ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR1_EL1_HCX_SHIFT, 4, 0),
367368
ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR1_EL1_ETS_SHIFT, 4, 0),
368369
ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR1_EL1_TWED_SHIFT, 4, 0),
369370
ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR1_EL1_XNX_SHIFT, 4, 0),
@@ -2309,6 +2310,13 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
23092310
.type = ARM64_CPUCAP_SYSTEM_FEATURE,
23102311
.matches = is_kvm_protected_mode,
23112312
},
2313+
{
2314+
.desc = "HCRX_EL2 register",
2315+
.capability = ARM64_HAS_HCX,
2316+
.type = ARM64_CPUCAP_STRICT_BOOT_CPU_FEATURE,
2317+
.matches = has_cpuid_feature,
2318+
ARM64_CPUID_FIELDS(ID_AA64MMFR1_EL1, HCX, IMP)
2319+
},
23122320
#endif
23132321
{
23142322
.desc = "Kernel page table isolation (KPTI)",

arch/arm64/tools/cpucaps

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ HAS_GENERIC_AUTH_IMP_DEF
3232
HAS_GIC_CPUIF_SYSREGS
3333
HAS_GIC_PRIO_MASKING
3434
HAS_GIC_PRIO_RELAXED_SYNC
35+
HAS_HCX
3536
HAS_LDAPR
3637
HAS_LSE_ATOMICS
3738
HAS_NESTED_VIRT

0 commit comments

Comments
 (0)