linux/arch/arm64/mm
Ard Biesheuvel 88c79851b8 arm64: mm: use a 48-bit ID map when possible on 52-bit VA builds
[ Upstream commit 7ba8f2b2d652cd8d8a2ab61f4be66973e70f9f88 ]

52-bit VA kernels can run on hardware that is only 48-bit capable, but
configure the ID map as 52-bit by default. This was not a problem until
recently, because the special T0SZ value for a 52-bit VA space was never
programmed into the TCR register anwyay, and because a 52-bit ID map
happens to use the same number of translation levels as a 48-bit one.

This behavior was changed by commit 1401bef703a4 ("arm64: mm: Always update
TCR_EL1 from __cpu_set_tcr_t0sz()"), which causes the unsupported T0SZ
value for a 52-bit VA to be programmed into TCR_EL1. While some hardware
simply ignores this, Mark reports that Amberwing systems choke on this,
resulting in a broken boot. But even before that commit, the unsupported
idmap_t0sz value was exposed to KVM and used to program TCR_EL2 incorrectly
as well.

Given that we already have to deal with address spaces being either 48-bit
or 52-bit in size, the cleanest approach seems to be to simply default to
a 48-bit VA ID map, and only switch to a 52-bit one if the placement of the
kernel in DRAM requires it. This is guaranteed not to happen unless the
system is actually 52-bit VA capable.

Fixes: 90ec95cda9 ("arm64: mm: Introduce VA_BITS_MIN")
Reported-by: Mark Salter <msalter@redhat.com>
Link: http://lore.kernel.org/r/20210310003216.410037-1-msalter@redhat.com
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20210310171515.416643-2-ardb@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-03-17 17:03:56 +01:00
..
Makefile
cache.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
context.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
copypage.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
dma-mapping.c arm64: use asm-generic/dma-mapping.h 2019-09-11 12:43:27 +02:00
dump.c arm64: memory: rename VA_START to PAGE_END 2019-08-14 17:06:58 +01:00
extable.c
fault.c arm64: acpi: Make apei_claim_sea() synchronise with APEI's irq work 2020-10-01 13:18:02 +02:00
flush.c mm: introduce page_size() 2019-09-24 15:54:08 -07:00
hugetlbpage.c arm64: hugetlb: avoid potential NULL dereference 2020-05-14 07:58:26 +02:00
init.c arm64/mm: Fix pfn_valid() for ZONE_DEVICE based memory 2021-03-17 17:03:56 +01:00
ioremap.c arm64: remove __iounmap 2019-09-04 13:12:26 +01:00
kasan_init.c arm64: memory: rename VA_START to PAGE_END 2019-08-14 17:06:58 +01:00
mmap.c arm64, mm: move generic mmap layout functions to mm 2019-09-24 15:54:11 -07:00
mmu.c arm64: mm: use a 48-bit ID map when possible on 52-bit VA builds 2021-03-17 17:03:56 +01:00
numa.c arm64/mm: return cpu_all_mask when node is NUMA_NO_NODE 2020-11-05 11:43:18 +01:00
pageattr.c arm64: unexport set_memory_x and set_memory_nx 2019-08-15 12:58:26 +01:00
pgd.c mm: consolidate pgtable_cache_init() and pgd_cache_init() 2019-09-24 15:54:09 -07:00
physaddr.c arm64: Do not pass tagged addresses to __is_lm_address() 2021-02-07 15:35:47 +01:00
proc.S Merge branches 'for-next/52-bit-kva', 'for-next/cpu-topology', 'for-next/error-injection', 'for-next/perf', 'for-next/psci-cpuidle', 'for-next/rng', 'for-next/smpboot', 'for-next/tbi' and 'for-next/tlbi' into for-next/core 2019-08-30 12:46:12 +01:00
ptdump_debugfs.c arm64: dump: no need to check return value of debugfs_create functions 2019-01-31 17:38:19 +00:00