TencentOS-kernel/arch
Ard Biesheuvel 7a7d5607fa 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: 90ec95cda91a ("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-04-12 12:53:11 +08:00
..
alpha alpha: fix annotation of io{read,write}{16,32}be() 2021-03-16 16:34:34 +08:00
arc arch/arc: add copy_user_page() to <asm/page.h> to fix build error on ARC 2021-04-12 12:51:24 +08:00
arm Xen/gnttab: handle p2m update errors on a per-slot basis 2021-04-12 12:52:49 +08:00
arm64 arm64: mm: use a 48-bit ID map when possible on 52-bit VA builds 2021-04-12 12:53:11 +08:00
c6x Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
csky csky: Fixup abiv2 syscall_trace break a4 & a5 2021-03-16 16:28:56 +08:00
h8300 h8300: fix PREEMPTION build, TI_PRE_COUNT undefined 2021-04-12 12:52:05 +08:00
hexagon hexagon: define ioremap_uc 2021-03-16 16:27:29 +08:00
ia64 ia64: fix build error with !COREDUMP 2021-03-16 16:40:09 +08:00
m68k m68k: q40: Fix info-leak in rtc_ioctl 2021-03-16 16:36:33 +08:00
microblaze Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
mips MIPS: Drop 32-bit asm string functions 2021-04-12 12:52:45 +08:00
nds32 Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
nios2 Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
openrisc openrisc: Fix issue with get_user for 64-bit values 2021-03-16 16:39:36 +08:00
parisc parisc: Bump 64-bit IRQ stack size to 64 KB 2021-04-12 12:52:48 +08:00
powerpc powerpc/64: Fix stack trace not displaying final frame 2021-04-12 12:53:03 +08:00
riscv riscv: virt_addr_valid must check the address belongs to linear mapping 2021-04-12 12:52:02 +08:00
s390 s390/smp: __smp_rescan_cpus() - move cpumask away from stack 2021-04-12 12:53:04 +08:00
sh sh: dma: fix kconfig dependency for G2_DMA 2021-04-12 12:51:39 +08:00
sparc sparc64: Use arch_validate_flags() to validate ADI flag 2021-04-12 12:53:03 +08:00
um um: mm: check more comprehensively for stub changes 2021-04-12 12:52:40 +08:00
unicore32 Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
x86 Xen/gnttab: handle p2m update errors on a per-slot basis 2021-04-12 12:52:49 +08:00
xtensa xtensa: uaccess: Add missing __user to strncpy_from_user() prototype 2021-03-16 16:41:40 +08:00
.gitignore Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
Kconfig Revert: "ring-buffer: Remove HAVE_64BIT_ALIGNED_ACCESS" 2021-03-16 16:43:47 +08:00