Skip to content

Commit da9af50

Browse files
Marc Zyngieroupton
authored andcommitted
arm64: cpufeature: Detect HCR_EL2.NV1 being RES0
A variant of FEAT_E2H0 not being implemented exists in the form of HCR_EL2.E2H being RES1 *and* HCR_EL2.NV1 being RES0 (indicating that only VHE is supported on the host and nested guests). Add the necessary infrastructure for this new CPU capability. Reviewed-by: Suzuki K Poulose <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Reviewed-by: Catalin Marinas <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Oliver Upton <[email protected]>
1 parent 805bb61 commit da9af50

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

arch/arm64/kernel/cpufeature.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1794,6 +1794,11 @@ static bool unmap_kernel_at_el0(const struct arm64_cpu_capabilities *entry,
17941794
return !meltdown_safe;
17951795
}
17961796

1797+
static bool has_nv1(const struct arm64_cpu_capabilities *entry, int scope)
1798+
{
1799+
return !has_cpuid_feature(entry, scope);
1800+
}
1801+
17971802
#if defined(ID_AA64MMFR0_EL1_TGRAN_LPA2) && defined(ID_AA64MMFR0_EL1_TGRAN_2_SUPPORTED_LPA2)
17981803
static bool has_lpa2_at_stage1(u64 mmfr0)
17991804
{
@@ -2794,6 +2799,13 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
27942799
.type = ARM64_CPUCAP_SYSTEM_FEATURE,
27952800
.matches = has_lpa2,
27962801
},
2802+
{
2803+
.desc = "NV1",
2804+
.capability = ARM64_HAS_HCR_NV1,
2805+
.type = ARM64_CPUCAP_SYSTEM_FEATURE,
2806+
.matches = has_nv1,
2807+
ARM64_CPUID_FIELDS_NEG(ID_AA64MMFR4_EL1, E2H0, NI_NV1)
2808+
},
27972809
{},
27982810
};
27992811

arch/arm64/tools/cpucaps

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ HAS_GENERIC_AUTH_IMP_DEF
3535
HAS_GIC_CPUIF_SYSREGS
3636
HAS_GIC_PRIO_MASKING
3737
HAS_GIC_PRIO_RELAXED_SYNC
38+
HAS_HCR_NV1
3839
HAS_HCX
3940
HAS_LDAPR
4041
HAS_LPA2

0 commit comments

Comments
 (0)