]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
s390/mm: Simplify get_fault_type()
authorHeiko Carstens <hca@linux.ibm.com>
Tue, 22 Oct 2024 12:05:59 +0000 (14:05 +0200)
committerHeiko Carstens <hca@linux.ibm.com>
Tue, 29 Oct 2024 10:49:19 +0000 (11:49 +0100)
With the gmap code gone get_fault_type() can be simplified:

- every fault with user_mode(regs) == true must be a fault in user address
  space

- every fault with user_mode(regs) == false is only a fault in user
  address space if the used address space is the secondary address space

- every other fault is within the kernel address space

Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
Link: https://lore.kernel.org/r/20241022120601.167009-10-imbrenda@linux.ibm.com
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/mm/fault.c

index e48910b0b8169d65359c11648f1eda19cd704b30..6e96fc7905fccbff684ead5e7956a2da94bf3be8 100644 (file)
@@ -68,17 +68,10 @@ static enum fault_type get_fault_type(struct pt_regs *regs)
 {
        union teid teid = { .val = regs->int_parm_long };
 
-       if (likely(teid.as == PSW_BITS_AS_PRIMARY)) {
-               if (user_mode(regs))
-                       return USER_FAULT;
-               return KERNEL_FAULT;
-       }
-       if (teid.as == PSW_BITS_AS_SECONDARY)
+       if (user_mode(regs))
                return USER_FAULT;
-       /* Access register mode, not used in the kernel */
-       if (teid.as == PSW_BITS_AS_ACCREG)
+       if (teid.as == PSW_BITS_AS_SECONDARY)
                return USER_FAULT;
-       /* Home space -> access via kernel ASCE */
        return KERNEL_FAULT;
 }