Commit 85806016 authored by Heiko Carstens's avatar Heiko Carstens
Browse files

s390: simplify early program check handler



Due to historic reasons the base program check handler calls a
configurable function. Given that there is only the early program
check handler left, simplify the code by directly calling that
function.

The only other user was removed with commit d485235b ("s390:
assume diag308 set always works").

Also rename all functions and the asm file to reflect this.

Reviewed-by: default avatarSven Schnelle <svens@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
parent bd52cd5e
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -304,12 +304,6 @@ static __always_inline void __noreturn disabled_wait(void)
	while (1);
}

/*
 * Basic Program Check Handler.
 */
extern void s390_base_pgm_handler(void);
extern void (*s390_base_pgm_handler_fn)(struct pt_regs *regs);

#define ARCH_LOW_ADDRESS_LIMIT	0x7fffffffUL

extern int memcpy_real(void *, unsigned long, size_t);
+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ CFLAGS_stacktrace.o += -fno-optimize-sibling-calls
CFLAGS_dumpstack.o	+= -fno-optimize-sibling-calls
CFLAGS_unwind_bc.o	+= -fno-optimize-sibling-calls

obj-y	:= traps.o time.o process.o base.o early.o setup.o idle.o vtime.o
obj-y	:= traps.o time.o process.o earlypgm.o early.o setup.o idle.o vtime.o
obj-y	+= processor.o syscall.o ptrace.o signal.o cpcmd.o ebcdic.o nmi.o
obj-y	+= debug.o irq.o ipl.o dis.o diag.o vdso.o
obj-y	+= sysinfo.o lgr.o os_info.o machine_kexec.o
+2 −3
Original line number Diff line number Diff line
@@ -149,7 +149,7 @@ static __init void setup_topology(void)
	topology_max_mnest = max_mnest;
}

static void early_pgm_check_handler(struct pt_regs *regs)
void __do_early_pgm_check(struct pt_regs *regs)
{
	if (!fixup_exception(regs))
		disabled_wait();
@@ -159,12 +159,11 @@ static noinline __init void setup_lowcore_early(void)
{
	psw_t psw;

	psw.addr = (unsigned long)s390_base_pgm_handler;
	psw.addr = (unsigned long)early_pgm_check_handler;
	psw.mask = PSW_MASK_BASE | PSW_DEFAULT_KEY | PSW_MASK_EA | PSW_MASK_BA;
	if (IS_ENABLED(CONFIG_KASAN))
		psw.mask |= PSW_MASK_DAT;
	S390_lowcore.program_new_psw = psw;
	s390_base_pgm_handler_fn = early_pgm_check_handler;
	S390_lowcore.preempt_count = INIT_PREEMPT_COUNT;
}

+3 −27
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
/*
 *  arch/s390/kernel/base.S
 *
 *    Copyright IBM Corp. 2006, 2007
 *    Author(s): Michael Holzheu <holzheu@de.ibm.com>
 */

#include <linux/linkage.h>
#include <asm/asm-offsets.h>
#include <asm/nospec-insn.h>
#include <asm/ptrace.h>

	GEN_BR_THUNK %r9
	GEN_BR_THUNK %r14

__PT_R0 = __PT_GPRS
__PT_R8 = __PT_GPRS + 64

ENTRY(s390_base_pgm_handler)
ENTRY(early_pgm_check_handler)
	stmg	%r8,%r15,__LC_SAVE_AREA_SYNC
	aghi	%r15,-(STACK_FRAME_OVERHEAD+__PT_SIZE)
	la	%r11,STACK_FRAME_OVERHEAD(%r15)
@@ -26,25 +19,8 @@ ENTRY(s390_base_pgm_handler)
	mvc	__PT_PSW(16,%r11),__LC_PGM_OLD_PSW
	mvc	__PT_R8(64,%r11),__LC_SAVE_AREA_SYNC
	lgr	%r2,%r11
	larl	%r1,s390_base_pgm_handler_fn
	lg	%r9,0(%r1)
	ltgr	%r9,%r9
	jz	1f
	BASR_EX	%r14,%r9
	brasl	%r14,__do_early_pgm_check
	mvc	__LC_RETURN_PSW(16),STACK_FRAME_OVERHEAD+__PT_PSW(%r15)
	lmg	%r0,%r15,STACK_FRAME_OVERHEAD+__PT_R0(%r15)
	lpswe	__LC_RETURN_PSW
1:	larl	%r13,disabled_wait_psw
	lpswe	0(%r13)
ENDPROC(s390_base_pgm_handler)

	.align	8
disabled_wait_psw:
	.quad	0x0002000180000000,0x0000000000000000 + s390_base_pgm_handler

	.section .bss
	.align 8
	.globl s390_base_pgm_handler_fn
s390_base_pgm_handler_fn:
	.quad	0
	.previous
ENDPROC(early_pgm_check_handler)
+2 −0
Original line number Diff line number Diff line
@@ -17,10 +17,12 @@ void ext_int_handler(void);
void io_int_handler(void);
void mcck_int_handler(void);
void restart_int_handler(void);
void early_pgm_check_handler(void);

void __ret_from_fork(struct task_struct *prev, struct pt_regs *regs);
void __do_pgm_check(struct pt_regs *regs);
void __do_syscall(struct pt_regs *regs, int per_trap);
void __do_early_pgm_check(struct pt_regs *regs);

void do_protection_exception(struct pt_regs *regs);
void do_dat_exception(struct pt_regs *regs);