Skip to content

Commit d7bebcb

Browse files
Vasily GorbikAlexander Gordeev
authored andcommitted
s390: Optimize __pa/__va when RANDOMIZE_IDENTITY_BASE is off
Use a zero identity base when CONFIG_RANDOMIZE_IDENTITY_BASE is off, slightly optimizing __pa/__va calculations. Signed-off-by: Vasily Gorbik <[email protected]> Acked-by: Alexander Gordeev <[email protected]> Signed-off-by: Alexander Gordeev <[email protected]>
1 parent 9af310e commit d7bebcb

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

arch/s390/boot/startup.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,9 @@ static unsigned long setup_kernel_memory_layout(unsigned long kernel_size)
372372
BUILD_BUG_ON(MAX_DCSS_ADDR > (1UL << MAX_PHYSMEM_BITS));
373373
max_mappable = max(ident_map_size, MAX_DCSS_ADDR);
374374
max_mappable = min(max_mappable, vmemmap_start);
375-
if (IS_ENABLED(CONFIG_RANDOMIZE_IDENTITY_BASE))
376-
__identity_base = round_down(vmemmap_start - max_mappable, rte_size);
375+
#ifdef CONFIG_RANDOMIZE_IDENTITY_BASE
376+
__identity_base = round_down(vmemmap_start - max_mappable, rte_size);
377+
#endif
377378
boot_debug("identity map: 0x%016lx-0x%016lx\n", __identity_base,
378379
__identity_base + ident_map_size);
379380

arch/s390/include/asm/page.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,11 @@ extern struct vm_layout vm_layout;
184184

185185
#define __kaslr_offset vm_layout.kaslr_offset
186186
#define __kaslr_offset_phys vm_layout.kaslr_offset_phys
187+
#ifdef CONFIG_RANDOMIZE_IDENTITY_BASE
187188
#define __identity_base vm_layout.identity_base
189+
#else
190+
#define __identity_base 0UL
191+
#endif
188192
#define ident_map_size vm_layout.identity_size
189193

190194
static inline unsigned long kaslr_offset(void)

arch/s390/kernel/setup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ static void __init reserve_lowcore(void)
740740
void *lowcore_end = lowcore_start + sizeof(struct lowcore);
741741
void *start, *end;
742742

743-
if ((void *)__identity_base < lowcore_end) {
743+
if (absolute_pointer(__identity_base) < lowcore_end) {
744744
start = max(lowcore_start, (void *)__identity_base);
745745
end = min(lowcore_end, (void *)(__identity_base + ident_map_size));
746746
memblock_reserve(__pa(start), __pa(end));

0 commit comments

Comments
 (0)