]> git.dujemihanovic.xyz Git - linux.git/commitdiff
s390: introduce .boot.preserved.data section
authorGerald Schaefer <gerald.schaefer@de.ibm.com>
Mon, 1 Apr 2019 17:10:45 +0000 (19:10 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Wed, 10 Apr 2019 15:47:09 +0000 (17:47 +0200)
Introduce .boot.preserve.data section which is similar to .boot.data and
"shared" between the decompressor code and the decompressed kernel. The
decompressor will store values in it, and copy over to the decompressed
image before starting it. This method allows to avoid using pre-defined
addresses and other hacks to pass values between those boot phases.

Unlike .boot.data section .boot.preserved.data is NOT a part of init data,
and hence will be preserved for the kernel life time.

Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/boot/compressed/decompressor.h
arch/s390/boot/compressed/vmlinux.lds.S
arch/s390/boot/startup.c
arch/s390/include/asm/sections.h
arch/s390/include/asm/vmlinux.lds.h
arch/s390/kernel/vmlinux.lds.S

index e1c1f2ec60f4a88d14d0c4b28732df790e2ff6bd..424cf524aac166702680b919f862301ce9e9a5d0 100644 (file)
@@ -17,6 +17,8 @@ struct vmlinux_info {
        unsigned long bss_size;         /* uncompressed image .bss size */
        unsigned long bootdata_off;
        unsigned long bootdata_size;
+       unsigned long bootdata_preserved_off;
+       unsigned long bootdata_preserved_size;
 };
 
 extern char _vmlinux_info[];
index 7efc3938f5955dae79720d5323636def4138d9df..1c8ef393c6569a48bd190d6fe77ebd9fa7ad2f2b 100644 (file)
@@ -34,6 +34,7 @@ SECTIONS
                _edata = . ;
        }
        BOOT_DATA
+       BOOT_DATA_PRESERVED
 
        /*
         * uncompressed image info used by the decompressor it should match
index bdfc5549a2998e649392896dd1fe53a03db9c3f6..57d7f9446e29e19baa55745359b579b2960a42ea 100644 (file)
@@ -6,6 +6,7 @@
 #include "boot.h"
 
 extern char __boot_data_start[], __boot_data_end[];
+extern char __boot_data_preserved_start[], __boot_data_preserved_end[];
 
 void error(char *x)
 {
@@ -43,6 +44,9 @@ static void copy_bootdata(void)
        if (__boot_data_end - __boot_data_start != vmlinux.bootdata_size)
                error(".boot.data section size mismatch");
        memcpy((void *)vmlinux.bootdata_off, __boot_data_start, vmlinux.bootdata_size);
+       if (__boot_data_preserved_end - __boot_data_preserved_start != vmlinux.bootdata_preserved_size)
+               error(".boot.preserved.data section size mismatch");
+       memcpy((void *)vmlinux.bootdata_preserved_off, __boot_data_preserved_start, vmlinux.bootdata_preserved_size);
 }
 
 void startup_kernel(void)
index 7afe4620685c93aac9b4bb9efaf196aacd4b055c..29e55739b516a75e4a8f332a8a2ec159dad4a890 100644 (file)
  */
 #define __bootdata(var) __section(.boot.data.var) var
 
+/*
+ * .boot.preserved.data is similar to .boot.data, but it is not part of the
+ * .init section and thus will be preserved for later use in the decompressed
+ * kernel.
+ */
+#define __bootdata_preserved(var) __section(.boot.preserved.data.var) var
+
 #endif
index 2d127f900352ddc13b468b11aa9fd457572b47d6..cbe670a6861b004f7696d4b1fe84de6d451efc52 100644 (file)
                *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.boot.data*)))         \
                __boot_data_end = .;                                    \
        }
+
+/*
+ * .boot.preserved.data is similar to .boot.data, but it is not part of the
+ * .init section and thus will be preserved for later use in the decompressed
+ * kernel.
+ */
+#define BOOT_DATA_PRESERVED                                            \
+       . = ALIGN(PAGE_SIZE);                                           \
+       .boot.preserved.data : {                                        \
+               __boot_data_preserved_start = .;                        \
+               *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.boot.preserved.data*))) \
+               __boot_data_preserved_end = .;                          \
+       }
index 8429ab07971575394622444ea6be40eb85b37f62..6ef9c62bb01b69897bbe9cfe139a916b4b6dddcb 100644 (file)
@@ -72,6 +72,7 @@ SECTIONS
        __end_ro_after_init = .;
 
        RW_DATA_SECTION(0x100, PAGE_SIZE, THREAD_SIZE)
+       BOOT_DATA_PRESERVED
 
        _edata = .;             /* End of data section */
 
@@ -161,6 +162,9 @@ SECTIONS
                QUAD(__bss_stop - __bss_start)                  /* bss_size */
                QUAD(__boot_data_start)                         /* bootdata_off */
                QUAD(__boot_data_end - __boot_data_start)       /* bootdata_size */
+               QUAD(__boot_data_preserved_start)               /* bootdata_preserved_off */
+               QUAD(__boot_data_preserved_end -
+                    __boot_data_preserved_start)               /* bootdata_preserved_size */
        } :NONE
 
        /* Debugging sections.  */