Skip to content

Commit aade38f

Browse files
Marc Zyngieroupton
authored andcommitted
KVM: arm64: Handle Apple M2 as not having HCR_EL2.NV1 implemented
Although the Apple M2 family of CPUs can have HCR_EL2.NV1 being set and clear, with the change in trap behaviour being OK, they explode spectacularily on an EL2 S1 page table using the nVHE format. This is no good. Let's pretend this HW doesn't have NV1, and move along. Signed-off-by: Marc Zyngier <[email protected]> Acked-by: Catalin Marinas <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Oliver Upton <[email protected]>
1 parent 94f29ab commit aade38f

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

arch/arm64/kernel/cpufeature.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1796,7 +1796,23 @@ static bool unmap_kernel_at_el0(const struct arm64_cpu_capabilities *entry,
17961796

17971797
static bool has_nv1(const struct arm64_cpu_capabilities *entry, int scope)
17981798
{
1799-
return !has_cpuid_feature(entry, scope);
1799+
/*
1800+
* Although the Apple M2 family appears to support NV1, the
1801+
* PTW barfs on the nVHE EL2 S1 page table format. Pretend
1802+
* that it doesn't support NV1 at all.
1803+
*/
1804+
static const struct midr_range nv1_ni_list[] = {
1805+
MIDR_ALL_VERSIONS(MIDR_APPLE_M2_BLIZZARD),
1806+
MIDR_ALL_VERSIONS(MIDR_APPLE_M2_AVALANCHE),
1807+
MIDR_ALL_VERSIONS(MIDR_APPLE_M2_BLIZZARD_PRO),
1808+
MIDR_ALL_VERSIONS(MIDR_APPLE_M2_AVALANCHE_PRO),
1809+
MIDR_ALL_VERSIONS(MIDR_APPLE_M2_BLIZZARD_MAX),
1810+
MIDR_ALL_VERSIONS(MIDR_APPLE_M2_AVALANCHE_MAX),
1811+
{}
1812+
};
1813+
1814+
return !(has_cpuid_feature(entry, scope) ||
1815+
is_midr_in_range_list(read_cpuid_id(), nv1_ni_list));
18001816
}
18011817

18021818
#if defined(ID_AA64MMFR0_EL1_TGRAN_LPA2) && defined(ID_AA64MMFR0_EL1_TGRAN_2_SUPPORTED_LPA2)

0 commit comments

Comments
 (0)