]> git.baikalelectronics.ru Git - kernel.git/commitdiff
s390: simplify early program check handler
authorHeiko Carstens <hca@linux.ibm.com>
Fri, 20 May 2022 17:23:48 +0000 (19:23 +0200)
committerHeiko Carstens <hca@linux.ibm.com>
Wed, 25 May 2022 09:46:02 +0000 (11:46 +0200)
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 b95c1da054e3 ("s390:
assume diag308 set always works").

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

Reviewed-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/include/asm/processor.h
arch/s390/kernel/Makefile
arch/s390/kernel/base.S [deleted file]
arch/s390/kernel/early.c
arch/s390/kernel/earlypgm.S [new file with mode: 0644]
arch/s390/kernel/entry.h

index add764a2be8cadf2ef8cae76af13ed3dc276aede..bd66f8e349492f2e0b70f51a43a40732151fd703 100644 (file)
@@ -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);
index 5851041bb214c9a62f111fa545c1f880785663e4..27d6b3c7aa06ef843d2b2718263f66bf36decca9 100644 (file)
@@ -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
diff --git a/arch/s390/kernel/base.S b/arch/s390/kernel/base.S
deleted file mode 100644 (file)
index 172c23c..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/* 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)
-       stmg    %r8,%r15,__LC_SAVE_AREA_SYNC
-       aghi    %r15,-(STACK_FRAME_OVERHEAD+__PT_SIZE)
-       la      %r11,STACK_FRAME_OVERHEAD(%r15)
-       xc      __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
-       stmg    %r0,%r7,__PT_R0(%r11)
-       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
-       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
index 08cc86a0db90f19c4c3d7643d67d14bd301c60c6..432c8c987256bbed390f5e82ffcf8da4131bd544 100644 (file)
@@ -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;
 }
 
diff --git a/arch/s390/kernel/earlypgm.S b/arch/s390/kernel/earlypgm.S
new file mode 100644 (file)
index 0000000..fbc7d2d
--- /dev/null
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ *    Copyright IBM Corp. 2006, 2007
+ *    Author(s): Michael Holzheu <holzheu@de.ibm.com>
+ */
+
+#include <linux/linkage.h>
+#include <asm/asm-offsets.h>
+
+__PT_R0 = __PT_GPRS
+__PT_R8 = __PT_GPRS + 64
+
+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)
+       xc      __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
+       stmg    %r0,%r7,__PT_R0(%r11)
+       mvc     __PT_PSW(16,%r11),__LC_PGM_OLD_PSW
+       mvc     __PT_R8(64,%r11),__LC_SAVE_AREA_SYNC
+       lgr     %r2,%r11
+       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
+ENDPROC(early_pgm_check_handler)
index 56e5e3712fbbe2203bebd86c25c9e2f6047106f9..995ec7449feba995d141466b0ebdd62085b9aee9 100644 (file)
@@ -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);