arm64: mm: get rid of kimage_vaddr global variable
authorArd Biesheuvel <ardb@kernel.org>
Wed, 29 Nov 2023 11:15:59 +0000 (12:15 +0100)
committerWill Deacon <will@kernel.org>
Tue, 12 Dec 2023 11:06:28 +0000 (11:06 +0000)
We store the address of _text in kimage_vaddr, but since commit
09e3c22a86f6889d ("arm64: Use a variable to store non-global mappings
decision"), we no longer reference this variable from modules so we no
longer need to export it.

In fact, we don't need it at all so let's just get rid of it.

Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Link: https://lore.kernel.org/r/20231129111555.3594833-46-ardb@google.com
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/include/asm/memory.h
arch/arm64/kernel/head.S
arch/arm64/mm/mmu.c

index fde4186cc3870894aa21f736f1bbeefdd63499c3..b8d726f951ae51e844babcdcf128c3d773e71a1c 100644 (file)
 #include <linux/types.h>
 #include <asm/boot.h>
 #include <asm/bug.h>
+#include <asm/sections.h>
 
 #if VA_BITS > 48
 extern u64                     vabits_actual;
@@ -193,15 +194,12 @@ extern s64                        memstart_addr;
 /* PHYS_OFFSET - the physical address of the start of memory. */
 #define PHYS_OFFSET            ({ VM_BUG_ON(memstart_addr & 1); memstart_addr; })
 
-/* the virtual base of the kernel image */
-extern u64                     kimage_vaddr;
-
 /* the offset between the kernel virtual and physical mappings */
 extern u64                     kimage_voffset;
 
 static inline unsigned long kaslr_offset(void)
 {
-       return kimage_vaddr - KIMAGE_VADDR;
+       return (u64)&_text - KIMAGE_VADDR;
 }
 
 #ifdef CONFIG_RANDOMIZE_BASE
index 7b236994f0e1500b5e085425db9599357ec9196a..cab7f91949d8f58e9565dae545e1f0a1056ea14b 100644 (file)
@@ -482,7 +482,7 @@ SYM_FUNC_START_LOCAL(__primary_switched)
 
        str_l   x21, __fdt_pointer, x5          // Save FDT pointer
 
-       ldr_l   x4, kimage_vaddr                // Save the offset between
+       adrp    x4, _text                       // Save the offset between
        sub     x4, x4, x0                      // the kernel virtual and
        str_l   x4, kimage_voffset, x5          // physical mappings
 
index 15f6347d23b69063b7628e45821a52ebaf9f72f7..03c73e9197acd4a71c91a8fca90a615f346aef14 100644 (file)
@@ -52,9 +52,6 @@ u64 vabits_actual __ro_after_init = VA_BITS_MIN;
 EXPORT_SYMBOL(vabits_actual);
 #endif
 
-u64 kimage_vaddr __ro_after_init = (u64)&_text;
-EXPORT_SYMBOL(kimage_vaddr);
-
 u64 kimage_voffset __ro_after_init;
 EXPORT_SYMBOL(kimage_voffset);