]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
s390: Optimize __pa/__va when RANDOMIZE_IDENTITY_BASE is off
authorVasily Gorbik <gor@linux.ibm.com>
Wed, 11 Dec 2024 11:29:40 +0000 (12:29 +0100)
committerAlexander Gordeev <agordeev@linux.ibm.com>
Sun, 26 Jan 2025 16:24:03 +0000 (17:24 +0100)
Use a zero identity base when CONFIG_RANDOMIZE_IDENTITY_BASE is off,
slightly optimizing __pa/__va calculations.

Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
arch/s390/boot/startup.c
arch/s390/include/asm/page.h
arch/s390/kernel/setup.c

index 807594cf246c1936bd446246f4f9ac60a470f9ec..58e56aed5f7decbbd4fe0be37ec720bc89f7e587 100644 (file)
@@ -372,8 +372,9 @@ static unsigned long setup_kernel_memory_layout(unsigned long kernel_size)
        BUILD_BUG_ON(MAX_DCSS_ADDR > (1UL << MAX_PHYSMEM_BITS));
        max_mappable = max(ident_map_size, MAX_DCSS_ADDR);
        max_mappable = min(max_mappable, vmemmap_start);
-       if (IS_ENABLED(CONFIG_RANDOMIZE_IDENTITY_BASE))
-               __identity_base = round_down(vmemmap_start - max_mappable, rte_size);
+#ifdef CONFIG_RANDOMIZE_IDENTITY_BASE
+       __identity_base = round_down(vmemmap_start - max_mappable, rte_size);
+#endif
        boot_debug("identity map:        0x%016lx-0x%016lx\n", __identity_base,
                   __identity_base + ident_map_size);
 
index 4f43cdd9835b6983d2f83650d177837700bc764d..1ff145f7b52b19a23594f362a75b8b5b4276454a 100644 (file)
@@ -184,7 +184,11 @@ extern struct vm_layout vm_layout;
 
 #define __kaslr_offset         vm_layout.kaslr_offset
 #define __kaslr_offset_phys    vm_layout.kaslr_offset_phys
+#ifdef CONFIG_RANDOMIZE_IDENTITY_BASE
 #define __identity_base                vm_layout.identity_base
+#else
+#define __identity_base                0UL
+#endif
 #define ident_map_size         vm_layout.identity_size
 
 static inline unsigned long kaslr_offset(void)
index 0fcb2a4e3f5ee095a1f8aaf85c78bf2512fca760..f6765ea4f8281656566d772373d36fb03e5cf08b 100644 (file)
@@ -740,7 +740,7 @@ static void __init reserve_lowcore(void)
        void *lowcore_end = lowcore_start + sizeof(struct lowcore);
        void *start, *end;
 
-       if ((void *)__identity_base < lowcore_end) {
+       if (absolute_pointer(__identity_base) < lowcore_end) {
                start = max(lowcore_start, (void *)__identity_base);
                end = min(lowcore_end, (void *)(__identity_base + ident_map_size));
                memblock_reserve(__pa(start), __pa(end));