]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
s390/mm: align swapper_pg_dir to 16k
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Sat, 28 May 2016 08:03:55 +0000 (10:03 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Mon, 13 Jun 2016 13:58:18 +0000 (15:58 +0200)
The segment/region table that is part of the kernel image must be
properly aligned to 16k in order to make the crdte inline assembly
work.
Otherwise it will calculate a wrong segment/region table start address
and access incorrect memory locations if the swapper_pg_dir is not
aligned to 16k.

Therefore define BSS_FIRST_SECTIONS in order to put the swapper_pg_dir
at the beginning of the bss section and also align the bss section to
16k just like other architectures did.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/include/asm/pgtable.h
arch/s390/kernel/vmlinux.lds.S
arch/s390/mm/init.c

index 3038edb12cad426e51efb23576719220aed9ea7d..37e1aa9bf84cebb87775d3168ac6001540010043 100644 (file)
@@ -32,7 +32,7 @@
 #include <asm/bug.h>
 #include <asm/page.h>
 
-extern pgd_t swapper_pg_dir[] __attribute__ ((aligned (4096)));
+extern pgd_t swapper_pg_dir[];
 extern void paging_init(void);
 extern void vmem_map_init(void);
 pmd_t *vmem_pmd_alloc(void);
index 0f41a8286378503a3708d78d79255ef41bde65fe..0656f7cc7fb476f02cf637b4daaf58bcf5c35364 100644 (file)
@@ -4,6 +4,13 @@
 
 #include <asm/thread_info.h>
 #include <asm/page.h>
+
+/*
+ * Put .bss..swapper_pg_dir as the first thing in .bss. This will
+ * make sure it has 16k alignment.
+ */
+#define BSS_FIRST_SECTIONS *(.bss..swapper_pg_dir)
+
 #include <asm-generic/vmlinux.lds.h>
 
 OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390")
@@ -81,7 +88,7 @@ SECTIONS
        . = ALIGN(PAGE_SIZE);
        __init_end = .;         /* freed after init ends here */
 
-       BSS_SECTION(0, 2, 0)
+       BSS_SECTION(PAGE_SIZE, 4 * PAGE_SIZE, PAGE_SIZE)
 
        _end = . ;
 
index 2489b2e917c81a84789558b363707442989275c1..44db60d9e519ba558351a9efac6a1457fcdae319 100644 (file)
@@ -40,7 +40,7 @@
 #include <asm/ctl_reg.h>
 #include <asm/sclp.h>
 
-pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__((__aligned__(PAGE_SIZE)));
+pgd_t swapper_pg_dir[PTRS_PER_PGD] __section(.bss..swapper_pg_dir);
 
 unsigned long empty_zero_page, zero_page_mask;
 EXPORT_SYMBOL(empty_zero_page);