Skip to content

Commit 996f7f2

Browse files
iii-iAlexander Gordeev
authored andcommitted
s390/boot: Introduce jump_to_kernel() function
Introduce a global function that jumps from the decompressor to the decompressed kernel. Put its address into svc_old_psw, from where GDB can take it without loading decompressor symbols. It should be available throughout the entire decompressor execution, because it's placed there statically, and nothing in the decompressor uses the SVC instruction. Acked-by: Heiko Carstens <[email protected]> Signed-off-by: Ilya Leoshkevich <[email protected]> Tested-by: Alexander Gordeev <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexander Gordeev <[email protected]>
1 parent b367017 commit 996f7f2

File tree

5 files changed

+20
-3
lines changed

5 files changed

+20
-3
lines changed

arch/s390/boot/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ CFLAGS_sclp_early_core.o += -I$(srctree)/drivers/s390/char
2727
obj-y := head.o als.o startup.o physmem_info.o ipl_parm.o ipl_report.o vmem.o
2828
obj-y += string.o ebcdic.o sclp_early_core.o mem.o ipl_vmparm.o cmdline.o
2929
obj-y += version.o pgm_check.o ctype.o ipl_data.o relocs.o alternative.o
30-
obj-y += uv.o printk.o
30+
obj-y += uv.o printk.o trampoline.o
3131
obj-$(CONFIG_RANDOMIZE_BASE) += kaslr.o
3232
obj-y += $(if $(CONFIG_KERNEL_UNCOMPRESSED),,decompressor.o) info.o
3333
obj-$(CONFIG_KERNEL_ZSTD) += clz_ctz.o

arch/s390/boot/boot.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ void print_stacktrace(unsigned long sp);
7474
void error(char *m);
7575
int get_random(unsigned long limit, unsigned long *value);
7676
void boot_rb_dump(void);
77+
void __noreturn jump_to_kernel(psw_t *psw);
7778

7879
#ifndef boot_fmt
7980
#define boot_fmt(fmt) fmt

arch/s390/boot/ipl_data.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ struct ipl_lowcore {
1616
struct ccw0 ccwpgm[2]; /* 0x0008 */
1717
u8 fill[56]; /* 0x0018 */
1818
struct ccw0 ccwpgmcc[20]; /* 0x0050 */
19-
u8 pad_0xf0[0x01a0-0x00f0]; /* 0x00f0 */
19+
u8 pad_0xf0[0x0140-0x00f0]; /* 0x00f0 */
20+
psw_t svc_old_psw; /* 0x0140 */
21+
u8 pad_0x150[0x01a0-0x0150]; /* 0x0150 */
2022
psw_t restart_psw; /* 0x01a0 */
2123
psw_t external_new_psw; /* 0x01b0 */
2224
psw_t svc_new_psw; /* 0x01c0 */
@@ -75,6 +77,11 @@ static struct ipl_lowcore ipl_lowcore __used __section(".ipldata") = {
7577
[18] = CCW0(CCW_CMD_READ_IPL, 0x690, 0x50, CCW_FLAG_SLI | CCW_FLAG_CC),
7678
[19] = CCW0(CCW_CMD_READ_IPL, 0x6e0, 0x50, CCW_FLAG_SLI),
7779
},
80+
/*
81+
* Let the GDB's lx-symbols command find the jump_to_kernel symbol
82+
* without having to load decompressor symbols.
83+
*/
84+
.svc_old_psw = { .mask = 0, .addr = (unsigned long)jump_to_kernel },
7885
.restart_psw = { .mask = 0, .addr = IPL_START, },
7986
.external_new_psw = { .mask = PSW_MASK_DISABLED, .addr = __LC_EXT_NEW_PSW, },
8087
.svc_new_psw = { .mask = PSW_MASK_DISABLED, .addr = __LC_SVC_NEW_PSW, },

arch/s390/boot/startup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,5 +642,5 @@ void startup_kernel(void)
642642
psw.addr = __kaslr_offset + vmlinux.entry;
643643
psw.mask = PSW_KERNEL_BITS;
644644
boot_debug("Starting kernel at: 0x%016lx\n", psw.addr);
645-
__load_psw(psw);
645+
jump_to_kernel(&psw);
646646
}

arch/s390/boot/trampoline.S

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
3+
#include <linux/linkage.h>
4+
5+
# This function is identical to __load_psw(), but the lx-symbols GDB command
6+
# puts a breakpoint on it, so it needs to be kept separate.
7+
SYM_CODE_START(jump_to_kernel)
8+
lpswe 0(%r2)
9+
SYM_CODE_END(jump_to_kernel)

0 commit comments

Comments
 (0)