powerpc/6xx: Handle DABR match before calling do_page_fault
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 19 Jul 2017 04:49:25 +0000 (14:49 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 3 Aug 2017 06:06:26 +0000 (16:06 +1000)
On legacy 6xx 32-bit procesors, we checked for the DABR match bit
in DSISR from do_page_fault(), in the middle of a pile of ifdef's
because all other CPU types do it in assembly prior to calling
do_page_fault. Fix that.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
[mpe: Add #ifdef CONFIG_6xx]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kernel/entry_32.S
arch/powerpc/mm/fault.c

index 8587059ad84830a4e4b2cb45749782228e7b1571..dff51ea52e4906f7c246f7ccec626d47ee3bfbaa 100644 (file)
@@ -586,7 +586,11 @@ ppc_swapcontext:
 handle_page_fault:
        stw     r4,_DAR(r1)
        addi    r3,r1,STACK_FRAME_OVERHEAD
+       andis.  r0,r5,DSISR_DABRMATCH@h
+#ifdef CONFIG_6xx
+       bne-    handle_dabr_fault
        bl      do_page_fault
+#endif
        cmpwi   r3,0
        beq+    ret_from_except
        SAVE_NVGPRS(r1)
@@ -599,6 +603,17 @@ handle_page_fault:
        bl      bad_page_fault
        b       ret_from_except_full
 
+#ifdef CONFIG_6xx
+       /* We have a data breakpoint exception - handle it */
+handle_dabr_fault:
+       SAVE_NVGPRS(r1)
+       lwz     r0,_TRAP(r1)
+       clrrwi  r0,r0,1
+       stw     r0,_TRAP(r1)
+       bl      do_break
+       b       ret_from_except_full
+#endif
+
 /*
  * This routine switches between two different tasks.  The process
  * state of one is saved on its kernel stack.  Then the state
index f04bc9f6b134cc1302178ce7bf927bdbef51aa1b..f257965b54b52179a938645b244c536d7f28e448 100644 (file)
@@ -242,15 +242,6 @@ static int __do_page_fault(struct pt_regs *regs, unsigned long address,
                goto bail;
        }
 
-#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE) || \
-      defined(CONFIG_PPC_BOOK3S_64) || defined(CONFIG_PPC_8xx))
-       if (error_code & DSISR_DABRMATCH) {
-               /* breakpoint match */
-               do_break(regs, address, error_code);
-               goto bail;
-       }
-#endif
-
        /* We restore the interrupt state now */
        if (!arch_irq_disabled_regs(regs))
                local_irq_enable();