]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
powerpc/8xx: Enable CONFIG_VMAP_STACK
authorChristophe Leroy <christophe.leroy@c-s.fr>
Sat, 21 Dec 2019 08:32:35 +0000 (08:32 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 27 Jan 2020 11:36:59 +0000 (22:36 +1100)
This patch enables CONFIG_VMAP_STACK. For that, a few changes are
done in head_8xx.S.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/d7ba1e34e80898310d6a314cbebe48baa32894ef.1576916812.git.christophe.leroy@c-s.fr
arch/powerpc/kernel/head_8xx.S
arch/powerpc/platforms/Kconfig.cputype

index a6b1b7af2217a0a75525f3b298153e03f01dfc9a..9922306ae51244f9dcd0ed1f2f3ffac4603aabee 100644 (file)
@@ -127,7 +127,7 @@ instruction_counter:
 /* Machine check */
        . = 0x200
 MachineCheck:
-       EXCEPTION_PROLOG
+       EXCEPTION_PROLOG handle_dar_dsisr=1
        save_dar_dsisr_on_stack r4, r5, r11
        li      r6, RPN_PATTERN
        mtspr   SPRN_DAR, r6    /* Tag DAR, to be used in DTLB Error */
@@ -140,7 +140,7 @@ MachineCheck:
 /* Alignment exception */
        . = 0x600
 Alignment:
-       EXCEPTION_PROLOG
+       EXCEPTION_PROLOG handle_dar_dsisr=1
        save_dar_dsisr_on_stack r4, r5, r11
        li      r6, RPN_PATTERN
        mtspr   SPRN_DAR, r6    /* Tag DAR, to be used in DTLB Error */
@@ -462,20 +462,26 @@ InstructionTLBError:
  */
        . = 0x1400
 DataTLBError:
-       EXCEPTION_PROLOG_0
+       EXCEPTION_PROLOG_0 handle_dar_dsisr=1
        mfspr   r11, SPRN_DAR
        cmpwi   cr1, r11, RPN_PATTERN
        beq-    cr1, FixupDAR   /* must be a buggy dcbX, icbi insn. */
 DARFixed:/* Return from dcbx instruction bug workaround */
+#ifdef CONFIG_VMAP_STACK
+       li      r11, RPN_PATTERN
+       mtspr   SPRN_DAR, r11   /* Tag DAR, to be used in DTLB Error */
+#endif
        EXCEPTION_PROLOG_1
-       EXCEPTION_PROLOG_2
+       EXCEPTION_PROLOG_2 handle_dar_dsisr=1
        get_and_save_dar_dsisr_on_stack r4, r5, r11
        andis.  r10,r5,DSISR_NOHPTE@h
        beq+    .Ldtlbie
        tlbie   r4
 .Ldtlbie:
+#ifndef CONFIG_VMAP_STACK
        li      r10,RPN_PATTERN
        mtspr   SPRN_DAR,r10    /* Tag DAR, to be used in DTLB Error */
+#endif
        /* 0x300 is DataAccess exception, needed by bad_page_fault() */
        EXC_XFER_LITE(0x300, handle_page_fault)
 
@@ -491,22 +497,29 @@ DARFixed:/* Return from dcbx instruction bug workaround */
        rfi
 #endif
 
+stack_overflow:
+       vmap_stack_overflow_exception
+
 /* On the MPC8xx, these next four traps are used for development
  * support of breakpoints and such.  Someday I will get around to
  * using them.
  */
 do_databreakpoint:
        EXCEPTION_PROLOG_1
-       EXCEPTION_PROLOG_2
+       EXCEPTION_PROLOG_2 handle_dar_dsisr=1
        addi    r3,r1,STACK_FRAME_OVERHEAD
        mfspr   r4,SPRN_BAR
        stw     r4,_DAR(r11)
+#ifdef CONFIG_VMAP_STACK
+       lwz     r5,_DSISR(r11)
+#else
        mfspr   r5,SPRN_DSISR
+#endif
        EXC_XFER_STD(0x1c00, do_break)
 
        . = 0x1c00
 DataBreakpoint:
-       EXCEPTION_PROLOG_0
+       EXCEPTION_PROLOG_0 handle_dar_dsisr=1
        mfspr   r11, SPRN_SRR0
        cmplwi  cr1, r11, (.Ldtlbie - PAGE_OFFSET)@l
        cmplwi  cr7, r11, (.Litlbie - PAGE_OFFSET)@l
@@ -655,7 +668,14 @@ FixupDAR:/* Entry point for dcbx workaround. */
 152:
        mfdar   r11
        mtctr   r11                     /* restore ctr reg from DAR */
+#ifdef CONFIG_VMAP_STACK
+       mfspr   r11, SPRN_SPRG_THREAD
+       stw     r10, DAR(r11)
+       mfspr   r10, SPRN_DSISR
+       stw     r10, DSISR(r11)
+#else
        mtdar   r10                     /* save fault EA to DAR */
+#endif
        mfspr   r10,SPRN_M_TW
        b       DARFixed                /* Go back to normal TLB handling */
 
index 8d7f9c3dc7711fccd7742532582d229772391cdd..000dd297337ce151cade2ab8875223b8d72d043a 100644 (file)
@@ -49,6 +49,7 @@ config PPC_8xx
        select PPC_HAVE_KUEP
        select PPC_HAVE_KUAP
        select PPC_MM_SLICES if HUGETLB_PAGE
+       select HAVE_ARCH_VMAP_STACK
 
 config 40x
        bool "AMCC 40x"