[PATCH 6/6] arm64: head: clarify commentary for __create_page_tables

Anshuman Khandual anshuman.khandual at arm.com
Tue May 17 20:17:25 PDT 2022


From: Mark Rutland <mark.rutland at arm.com>

The comments in __create_page_tables have become stale and potentially
misleading over time. The kernel tables cover all of the kernel image
but none of the linear map (which is created separately later), and the
kernel mapping does not start at PHYS_OFFSET (which is the physical
start of the linear map).

Update the comments to be more precise.

There should be no functional change as a result of this patch.

Cc: Ard Biesheuvel <ardb at kernel.org>
Cc: Catalin Marinas <catalin.marinas at arm.com>
Cc: Will Deacon <will at kernel.org>
Signed-off-by: Mark Rutland <mark.rutland at arm.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual at arm.com>
---
 arch/arm64/kernel/head.S | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index 107275e06212..349ef0ed9aa9 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -256,11 +256,14 @@ SYM_CODE_END(preserve_boot_args)
 	.endm
 
 /*
- * Setup the initial page tables. We only setup the barest amount which is
- * required to get the kernel running. The following sections are required:
- *   - identity mapping to enable the MMU (low address, TTBR0)
- *   - first few MB of the kernel linear mapping to jump to once the MMU has
- *     been enabled
+ * Setup the initial page tables.
+ *
+ * The idmap page tables map the idmap page in TTBR0, with VA == PA. This
+ * covers the interval [__idmap_text_start, __idmap_text_end - 1]
+ *
+ * The initial kernel page tables map the kernel image in TTBR1, with _text
+ * mapped to VA (KIMAGE_VADDR +  KASLR offset). This covers the interval
+ * [_text, _end - 1]
  */
 SYM_FUNC_START_LOCAL(__create_page_tables)
 	mov	x28, lr
@@ -363,7 +366,7 @@ SYM_FUNC_START_LOCAL(__create_page_tables)
 	map_memory x0, x1, x3, x6, x7, x3, x4, x10, x11, x12, x13, x14
 
 	/*
-	 * Map the kernel image (starting with PHYS_OFFSET).
+	 * Map the kernel image
 	 */
 	adrp	x0, init_pg_dir
 	mov_q	x5, KIMAGE_VADDR		// compile time __va(_text)
-- 
2.20.1




More information about the linux-arm-kernel mailing list