summaryrefslogtreecommitdiffstats
path: root/arch/arm64/include/asm/kernel-pgtable.h
diff options
context:
space:
mode:
authorArd Biesheuvel <ardb@kernel.org>2022-06-24 17:06:44 +0200
committerWill Deacon <will@kernel.org>2022-06-24 18:18:10 +0200
commitf70b3a23324a2d31efb83cc01302acb343e4ec1b (patch)
treeebaf6a32b781aa2e9254c7ccf11ab806bfc84886 /arch/arm64/include/asm/kernel-pgtable.h
parentarm64: head: use relative references to the RELA and RELR tables (diff)
downloadlinux-f70b3a23324a2d31efb83cc01302acb343e4ec1b.tar.xz
linux-f70b3a23324a2d31efb83cc01302acb343e4ec1b.zip
arm64: head: create a temporary FDT mapping in the initial ID map
We need to access the DT very early to get at the command line and the KASLR seed, which currently means we rely on some hacks to call into the kernel before really calling into the kernel, which is undesirable. So instead, let's create a mapping for the FDT in the initial ID map, which is feasible now that it has been extended to cover more than a single page or block, and can be updated in place to remap other output addresses. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Link: https://lore.kernel.org/r/20220624150651.1358849-15-ardb@kernel.org Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'arch/arm64/include/asm/kernel-pgtable.h')
-rw-r--r--arch/arm64/include/asm/kernel-pgtable.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/arm64/include/asm/kernel-pgtable.h b/arch/arm64/include/asm/kernel-pgtable.h
index 5395e5a04f35..02e59fa8f293 100644
--- a/arch/arm64/include/asm/kernel-pgtable.h
+++ b/arch/arm64/include/asm/kernel-pgtable.h
@@ -8,6 +8,7 @@
#ifndef __ASM_KERNEL_PGTABLE_H
#define __ASM_KERNEL_PGTABLE_H
+#include <asm/boot.h>
#include <asm/pgtable-hwdef.h>
#include <asm/sparsemem.h>
@@ -88,10 +89,11 @@
/* the initial ID map may need two extra pages if it needs to be extended */
#if VA_BITS < 48
-#define INIT_IDMAP_DIR_SIZE (INIT_DIR_SIZE + (2 * PAGE_SIZE))
+#define INIT_IDMAP_DIR_SIZE ((INIT_IDMAP_DIR_PAGES + 2) * PAGE_SIZE)
#else
-#define INIT_IDMAP_DIR_SIZE INIT_DIR_SIZE
+#define INIT_IDMAP_DIR_SIZE (INIT_IDMAP_DIR_PAGES * PAGE_SIZE)
#endif
+#define INIT_IDMAP_DIR_PAGES EARLY_PAGES(KIMAGE_VADDR, _end + MAX_FDT_SIZE + SWAPPER_BLOCK_SIZE)
/* Initial memory map size */
#if ARM64_KERNEL_USES_PMD_MAPS