mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 15:22:21 -04:00
s390/traps: Remove PIF_GUEST_FAULT
PIF_GUEST_FAULT is only used to pass information whether a fault was caused when executing SIE or when executing host code. Instead of using ptregs for this, just pass the flag directly as argument to __do_pgm_check(). This also saves the time required to read the flag from ptregs, although this likely isn't much as it is already in the data cache. Signed-off-by: Sven Schnelle <svens@linux.ibm.com> Reviewed-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
This commit is contained in:
committed by
Vasily Gorbik
parent
6bef2c8b36
commit
f588c5cb0b
@@ -16,13 +16,11 @@
|
||||
#define PIF_SYSCALL 0 /* inside a system call */
|
||||
#define PIF_PSW_ADDR_ADJUSTED 1 /* psw address has been adjusted */
|
||||
#define PIF_SYSCALL_RET_SET 2 /* return value was set via ptrace */
|
||||
#define PIF_GUEST_FAULT 3 /* indicates program check in sie64a */
|
||||
#define PIF_FTRACE_FULL_REGS 4 /* all register contents valid (ftrace) */
|
||||
#define PIF_FTRACE_FULL_REGS 3 /* all register contents valid (ftrace) */
|
||||
|
||||
#define _PIF_SYSCALL BIT(PIF_SYSCALL)
|
||||
#define _PIF_ADDR_PSW_ADJUSTED BIT(PIF_PSW_ADDR_ADJUSTED)
|
||||
#define _PIF_SYSCALL_RET_SET BIT(PIF_SYSCALL_RET_SET)
|
||||
#define _PIF_GUEST_FAULT BIT(PIF_GUEST_FAULT)
|
||||
#define _PIF_FTRACE_FULL_REGS BIT(PIF_FTRACE_FULL_REGS)
|
||||
|
||||
#define PSW32_MASK_PER _AC(0x40000000, UL)
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <asm/nospec-insn.h>
|
||||
#include <asm/lowcore.h>
|
||||
#include <asm/machine.h>
|
||||
#include "entry.h"
|
||||
|
||||
_LPP_OFFSET = __LC_LPP
|
||||
|
||||
@@ -321,7 +322,7 @@ SYM_CODE_START(pgm_check_handler)
|
||||
jz 1f
|
||||
BPENTER __SF_SIE_FLAGS(%r15),_TIF_ISOLATE_BP_GUEST
|
||||
SIEEXIT __SF_SIE_CONTROL(%r15),%r13
|
||||
lghi %r10,_PIF_GUEST_FAULT
|
||||
lghi %r10,PGM_FLAG_GUEST_FAULT
|
||||
#endif
|
||||
1: tmhh %r8,0x4000 # PER bit set in old PSW ?
|
||||
jnz 2f # -> enabled, can't be a double fault
|
||||
@@ -332,7 +333,7 @@ SYM_CODE_START(pgm_check_handler)
|
||||
CHECK_VMAP_STACK __LC_SAVE_AREA,%r13,4f
|
||||
3: lg %r15,__LC_KERNEL_STACK(%r13)
|
||||
4: la %r11,STACK_FRAME_OVERHEAD(%r15)
|
||||
stg %r10,__PT_FLAGS(%r11)
|
||||
xc __PT_FLAGS(8,%r11),__PT_FLAGS(%r11)
|
||||
xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
|
||||
stmg %r0,%r7,__PT_R0(%r11)
|
||||
mvc __PT_R8(64,%r11),__LC_SAVE_AREA(%r13)
|
||||
@@ -341,13 +342,13 @@ SYM_CODE_START(pgm_check_handler)
|
||||
# clear user controlled registers to prevent speculative use
|
||||
xgr %r0,%r0
|
||||
xgr %r1,%r1
|
||||
xgr %r3,%r3
|
||||
xgr %r4,%r4
|
||||
xgr %r5,%r5
|
||||
xgr %r6,%r6
|
||||
xgr %r7,%r7
|
||||
xgr %r12,%r12
|
||||
lgr %r2,%r11
|
||||
lgr %r3,%r10
|
||||
brasl %r14,__do_pgm_check
|
||||
tmhh %r8,0x0001 # returning to user space?
|
||||
jno .Lpgm_exit_kernel
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
#ifndef _ENTRY_H
|
||||
#define _ENTRY_H
|
||||
|
||||
#define PGM_FLAG_GUEST_FAULT 1
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
#include <linux/percpu.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/signal.h>
|
||||
@@ -21,7 +25,7 @@ void early_pgm_check_handler(void);
|
||||
|
||||
struct task_struct *__switch_to_asm(struct task_struct *prev, struct task_struct *next);
|
||||
void __ret_from_fork(struct task_struct *prev, struct pt_regs *regs);
|
||||
void __do_pgm_check(struct pt_regs *regs);
|
||||
void __do_pgm_check(struct pt_regs *regs, unsigned long flags);
|
||||
void __do_syscall(struct pt_regs *regs, int per_trap);
|
||||
void __do_early_pgm_check(struct pt_regs *regs);
|
||||
|
||||
@@ -70,4 +74,5 @@ extern struct exception_table_entry _stop_amode31_ex_table[];
|
||||
#define __amode31_ref __section(".amode31.refs")
|
||||
extern long _start_amode31_refs[], _end_amode31_refs[];
|
||||
|
||||
#endif /* __ASSEMBLER__ */
|
||||
#endif /* _ENTRY_H */
|
||||
|
||||
@@ -335,7 +335,7 @@ void __init trap_init(void)
|
||||
|
||||
static void (*pgm_check_table[128])(struct pt_regs *regs);
|
||||
|
||||
void noinstr __do_pgm_check(struct pt_regs *regs)
|
||||
void noinstr __do_pgm_check(struct pt_regs *regs, unsigned long flags)
|
||||
{
|
||||
struct lowcore *lc = get_lowcore();
|
||||
bool percpu_needs_fixup;
|
||||
@@ -359,7 +359,7 @@ void noinstr __do_pgm_check(struct pt_regs *regs)
|
||||
* the fault number in current->thread.gmap_int_code. KVM will be
|
||||
* able to use this information to handle the fault.
|
||||
*/
|
||||
if (test_pt_regs_flag(regs, PIF_GUEST_FAULT)) {
|
||||
if (flags & PGM_FLAG_GUEST_FAULT) {
|
||||
current->thread.gmap_teid.val = regs->int_parm_long;
|
||||
current->thread.gmap_int_code = regs->int_code & 0xffff;
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user