s390/boot: enable .bss section for compressed kernel
authorAlexander Egorenkov <egorenar@linux.ibm.com>
Wed, 2 Sep 2020 14:52:06 +0000 (16:52 +0200)
committerVasily Gorbik <gor@linux.ibm.com>
Wed, 16 Sep 2020 12:08:47 +0000 (14:08 +0200)
- Support static uninitialized variables in compressed kernel.
- Remove chkbss script
- Get rid of workarounds for not having .bss section

Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Reviewed-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/boot/Makefile
arch/s390/boot/compressed/Makefile
arch/s390/boot/compressed/decompressor.c
arch/s390/boot/compressed/vmlinux.lds.S
arch/s390/boot/head.S
arch/s390/boot/ipl_parm.c
arch/s390/boot/startup.c
arch/s390/kernel/setup.c
arch/s390/scripts/Makefile.chkbss [deleted file]

index 45b33b83de08c7e0458afe43768c4dd102e2e625..41a64b8dce252531c0cb5bed6c1c5fddb916885b 100644 (file)
@@ -73,7 +73,3 @@ $(obj)/startup.a: $(OBJECTS) FORCE
 install:
        sh -x  $(srctree)/$(obj)/install.sh $(KERNELRELEASE) $(obj)/bzImage \
              System.map "$(INSTALL_PATH)"
-
-chkbss := $(obj-y)
-chkbss-target := startup.a
-include $(srctree)/arch/s390/scripts/Makefile.chkbss
index fa529c5b448650d29b9af3e5da4035fad80629b0..b235ed95a3d895b5fa5cc173351ab378d2ab7aeb 100644 (file)
@@ -62,7 +62,3 @@ $(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE
 OBJCOPYFLAGS_piggy.o := -I binary -O elf64-s390 -B s390:64-bit --rename-section .data=.vmlinux.bin.compressed
 $(obj)/piggy.o: $(obj)/vmlinux.bin$(suffix-y) FORCE
        $(call if_changed,objcopy)
-
-chkbss := $(filter-out piggy.o info.o, $(obj-y))
-chkbss-target := vmlinux.bin
-include $(srctree)/arch/s390/scripts/Makefile.chkbss
index 368fd372c8757339b7b8f0f4657caab508430543..3061b11c4d27f49a61e13173b793e3e58b6a12d1 100644 (file)
@@ -16,7 +16,6 @@
  * gzip declarations
  */
 #define STATIC static
-#define STATIC_RW_DATA static __section(.data)
 
 #undef memset
 #undef memcpy
index 44561b2c3712452bf3dcc50736cd88fb3cc081ee..9427e2cd0c1542bf4adaab8edcbb789f8f84f26f 100644 (file)
@@ -58,6 +58,19 @@ SECTIONS
        BOOT_DATA
        BOOT_DATA_PRESERVED
 
+       /*
+        * This is the BSS section of the decompressor and not of the decompressed Linux kernel.
+        * It will consume place in the decompressor's image.
+        */
+       . = ALIGN(8);
+       .bss : {
+               _bss = . ;
+               *(.bss)
+               *(.bss.*)
+               *(COMMON)
+               _ebss = .;
+       }
+
        /*
         * uncompressed image info used by the decompressor it should match
         * struct vmlinux_info. It comes from .vmlinux.info section of
@@ -81,15 +94,6 @@ SECTIONS
                FILL(0xff);
                . = ALIGN(4096);
        }
-       . = ALIGN(256);
-       .bss : {
-               _bss = . ;
-               *(.bss)
-               *(.bss.*)
-               *(COMMON)
-               . = ALIGN(8);   /* For convenience during zeroing */
-               _ebss = .;
-       }
        _end = .;
 
        /* Sections to be discarded */
index dae10961d07246cc5a49dd80cefa8f79697056c7..fd78755d996dc1e1bc8c73d45ba061d30934bae7 100644 (file)
@@ -313,6 +313,12 @@ ENTRY(startup_kdump)
        spt     6f-.LPG0(%r13)
        mvc     __LC_LAST_UPDATE_TIMER(8),6f-.LPG0(%r13)
        l       %r15,.Lstack-.LPG0(%r13)
+       // Clear decompressor's BSS section
+       larl    %r2,_bss
+       slgr    %r3,%r3
+       larl    %r4,_ebss
+       slgr    %r4,%r2
+       brasl   %r14,memset
        brasl   %r14,verify_facilities
        brasl   %r14,startup_kernel
 
index 8e222a6660250dcab3e3d0a391331b2e0e1957af..ae230ebd6420b05739d5cc2a786629b5ae0c33ad 100644 (file)
@@ -21,7 +21,7 @@ unsigned long __bootdata(memory_end);
 int __bootdata(memory_end_set);
 int __bootdata(noexec_disabled);
 
-int kaslr_enabled __section(.data);
+int kaslr_enabled;
 
 static inline int __diag308(unsigned long subcode, void *addr)
 {
@@ -209,7 +209,7 @@ static void modify_fac_list(char *str)
        check_cleared_facilities();
 }
 
-static char command_line_buf[COMMAND_LINE_SIZE] __section(.data);
+static char command_line_buf[COMMAND_LINE_SIZE];
 void parse_boot_command_line(void)
 {
        char *param, *val;
index 3b3a11f95269a056b174221c7f5ed3d04c02f008..81835483169b829cdd0d1c8f71997d97b09a8904 100644 (file)
@@ -120,6 +120,9 @@ static void handle_relocs(unsigned long offset)
        }
 }
 
+/*
+ * This function clears the BSS section of the decompressed Linux kernel and NOT the decompressor's.
+ */
 static void clear_bss_section(void)
 {
        memset((void *)vmlinux.default_lma + vmlinux.image_size, 0, vmlinux.bss_size);
index f04252cb6004ce9bc53392663c627f62b39b3dea..047793902ce671e21cee77423bf374b9ded070c7 100644 (file)
@@ -307,7 +307,7 @@ void machine_power_off(void)
 void (*pm_power_off)(void) = machine_power_off;
 EXPORT_SYMBOL_GPL(pm_power_off);
 
-void *restart_stack __section(.data);
+void *restart_stack;
 
 unsigned long stack_alloc(void)
 {
diff --git a/arch/s390/scripts/Makefile.chkbss b/arch/s390/scripts/Makefile.chkbss
deleted file mode 100644 (file)
index f4f4c2c..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-
-chkbss-target ?= built-in.a
-$(obj)/$(chkbss-target): chkbss
-
-chkbss-files := $(addsuffix .chkbss, $(chkbss))
-clean-files += $(chkbss-files)
-
-PHONY += chkbss
-chkbss: $(addprefix $(obj)/, $(chkbss-files))
-
-quiet_cmd_chkbss = CHKBSS  $<
-      cmd_chkbss = \
-       if ! $(OBJSIZE) --common $< | $(AWK) 'END { if ($$3) exit 1 }'; then \
-               echo "error: $< .bss section is not empty" >&2; exit 1; \
-       fi; \
-       touch $@;
-
-$(obj)/%.o.chkbss: $(obj)/%.o
-       $(call cmd,chkbss)