Skip to content

Commit

Permalink
s390/boot: enable .bss section for compressed kernel
Browse files Browse the repository at this point in the history
- 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>
  • Loading branch information
Alexander Egorenkov authored and Vasily Gorbik committed Sep 16, 2020
1 parent 1a80b54 commit 980d5f9
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 41 deletions.
4 changes: 0 additions & 4 deletions arch/s390/boot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 0 additions & 4 deletions arch/s390/boot/compressed/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion arch/s390/boot/compressed/decompressor.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* gzip declarations
*/
#define STATIC static
#define STATIC_RW_DATA static __section(.data)

#undef memset
#undef memcpy
Expand Down
22 changes: 13 additions & 9 deletions arch/s390/boot/compressed/vmlinux.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 */
Expand Down
6 changes: 6 additions & 0 deletions arch/s390/boot/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions arch/s390/boot/ipl_parm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions arch/s390/boot/startup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion arch/s390/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
20 changes: 0 additions & 20 deletions arch/s390/scripts/Makefile.chkbss

This file was deleted.

0 comments on commit 980d5f9

Please sign in to comment.