arm64: head: Move early kernel mapping routines into C code
authorArd Biesheuvel <ardb@kernel.org>
Wed, 14 Feb 2024 12:29:04 +0000 (13:29 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 16 Feb 2024 12:42:33 +0000 (12:42 +0000)
commit97a6f43bb049e64b9913c50c7530e13d78e205d4
treef27badee5d092ecc09f221e6ce6dd19b83e9b44c
parent82ca151da7d54d7571c5d511d016b7780d5d559f
arm64: head: Move early kernel mapping routines into C code

The asm version of the kernel mapping code works fine for creating a
coarse grained identity map, but for mapping the kernel down to its
exact boundaries with the right attributes, it is not suitable. This is
why we create a preliminary RWX kernel mapping first, and then rebuild
it from scratch later on.

So let's reimplement this in C, in a way that will make it unnecessary
to create the kernel page tables yet another time in paging_init().

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20240214122845.2033971-63-ardb+git@google.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
15 files changed:
arch/arm64/include/asm/archrandom.h
arch/arm64/include/asm/scs.h
arch/arm64/kernel/head.S
arch/arm64/kernel/image-vars.h
arch/arm64/kernel/pi/Makefile
arch/arm64/kernel/pi/idreg-override.c
arch/arm64/kernel/pi/kaslr_early.c
arch/arm64/kernel/pi/map_kernel.c [new file with mode: 0644]
arch/arm64/kernel/pi/map_range.c [new file with mode: 0644]
arch/arm64/kernel/pi/patch-scs.c
arch/arm64/kernel/pi/pi.h
arch/arm64/kernel/pi/relocate.c
arch/arm64/kernel/setup.c
arch/arm64/kernel/vmlinux.lds.S
arch/arm64/mm/proc.S