Commit 99b22916 authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc/8xx: Enable CONFIG_VMAP_STACK

This patch enables CONFIG_VMAP_STACK. For that, a few changes are
done in head_8xx.S.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/d7ba1e34e80898310d6a314cbebe48baa32894ef.1576916812.git.christophe.leroy@c-s.fr
parent d52668f6
...@@ -127,7 +127,7 @@ instruction_counter: ...@@ -127,7 +127,7 @@ instruction_counter:
/* Machine check */ /* Machine check */
. = 0x200 . = 0x200
MachineCheck: MachineCheck:
EXCEPTION_PROLOG EXCEPTION_PROLOG handle_dar_dsisr=1
save_dar_dsisr_on_stack r4, r5, r11 save_dar_dsisr_on_stack r4, r5, r11
li r6, RPN_PATTERN li r6, RPN_PATTERN
mtspr SPRN_DAR, r6 /* Tag DAR, to be used in DTLB Error */ mtspr SPRN_DAR, r6 /* Tag DAR, to be used in DTLB Error */
...@@ -140,7 +140,7 @@ MachineCheck: ...@@ -140,7 +140,7 @@ MachineCheck:
/* Alignment exception */ /* Alignment exception */
. = 0x600 . = 0x600
Alignment: Alignment:
EXCEPTION_PROLOG EXCEPTION_PROLOG handle_dar_dsisr=1
save_dar_dsisr_on_stack r4, r5, r11 save_dar_dsisr_on_stack r4, r5, r11
li r6, RPN_PATTERN li r6, RPN_PATTERN
mtspr SPRN_DAR, r6 /* Tag DAR, to be used in DTLB Error */ mtspr SPRN_DAR, r6 /* Tag DAR, to be used in DTLB Error */
...@@ -462,20 +462,26 @@ InstructionTLBError: ...@@ -462,20 +462,26 @@ InstructionTLBError:
*/ */
. = 0x1400 . = 0x1400
DataTLBError: DataTLBError:
EXCEPTION_PROLOG_0 EXCEPTION_PROLOG_0 handle_dar_dsisr=1
mfspr r11, SPRN_DAR mfspr r11, SPRN_DAR
cmpwi cr1, r11, RPN_PATTERN cmpwi cr1, r11, RPN_PATTERN
beq- cr1, FixupDAR /* must be a buggy dcbX, icbi insn. */ beq- cr1, FixupDAR /* must be a buggy dcbX, icbi insn. */
DARFixed:/* Return from dcbx instruction bug workaround */ 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_1
EXCEPTION_PROLOG_2 EXCEPTION_PROLOG_2 handle_dar_dsisr=1
get_and_save_dar_dsisr_on_stack r4, r5, r11 get_and_save_dar_dsisr_on_stack r4, r5, r11
andis. r10,r5,DSISR_NOHPTE@h andis. r10,r5,DSISR_NOHPTE@h
beq+ .Ldtlbie beq+ .Ldtlbie
tlbie r4 tlbie r4
.Ldtlbie: .Ldtlbie:
#ifndef CONFIG_VMAP_STACK
li r10,RPN_PATTERN li r10,RPN_PATTERN
mtspr SPRN_DAR,r10 /* Tag DAR, to be used in DTLB Error */ mtspr SPRN_DAR,r10 /* Tag DAR, to be used in DTLB Error */
#endif
/* 0x300 is DataAccess exception, needed by bad_page_fault() */ /* 0x300 is DataAccess exception, needed by bad_page_fault() */
EXC_XFER_LITE(0x300, handle_page_fault) EXC_XFER_LITE(0x300, handle_page_fault)
...@@ -491,22 +497,29 @@ DARFixed:/* Return from dcbx instruction bug workaround */ ...@@ -491,22 +497,29 @@ DARFixed:/* Return from dcbx instruction bug workaround */
rfi rfi
#endif #endif
stack_overflow:
vmap_stack_overflow_exception
/* On the MPC8xx, these next four traps are used for development /* On the MPC8xx, these next four traps are used for development
* support of breakpoints and such. Someday I will get around to * support of breakpoints and such. Someday I will get around to
* using them. * using them.
*/ */
do_databreakpoint: do_databreakpoint:
EXCEPTION_PROLOG_1 EXCEPTION_PROLOG_1
EXCEPTION_PROLOG_2 EXCEPTION_PROLOG_2 handle_dar_dsisr=1
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_FRAME_OVERHEAD
mfspr r4,SPRN_BAR mfspr r4,SPRN_BAR
stw r4,_DAR(r11) stw r4,_DAR(r11)
#ifdef CONFIG_VMAP_STACK
lwz r5,_DSISR(r11)
#else
mfspr r5,SPRN_DSISR mfspr r5,SPRN_DSISR
#endif
EXC_XFER_STD(0x1c00, do_break) EXC_XFER_STD(0x1c00, do_break)
. = 0x1c00 . = 0x1c00
DataBreakpoint: DataBreakpoint:
EXCEPTION_PROLOG_0 EXCEPTION_PROLOG_0 handle_dar_dsisr=1
mfspr r11, SPRN_SRR0 mfspr r11, SPRN_SRR0
cmplwi cr1, r11, (.Ldtlbie - PAGE_OFFSET)@l cmplwi cr1, r11, (.Ldtlbie - PAGE_OFFSET)@l
cmplwi cr7, r11, (.Litlbie - PAGE_OFFSET)@l cmplwi cr7, r11, (.Litlbie - PAGE_OFFSET)@l
...@@ -655,7 +668,14 @@ FixupDAR:/* Entry point for dcbx workaround. */ ...@@ -655,7 +668,14 @@ FixupDAR:/* Entry point for dcbx workaround. */
152: 152:
mfdar r11 mfdar r11
mtctr r11 /* restore ctr reg from DAR */ 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 */ mtdar r10 /* save fault EA to DAR */
#endif
mfspr r10,SPRN_M_TW mfspr r10,SPRN_M_TW
b DARFixed /* Go back to normal TLB handling */ b DARFixed /* Go back to normal TLB handling */
......
...@@ -49,6 +49,7 @@ config PPC_8xx ...@@ -49,6 +49,7 @@ config PPC_8xx
select PPC_HAVE_KUEP select PPC_HAVE_KUEP
select PPC_HAVE_KUAP select PPC_HAVE_KUAP
select PPC_MM_SLICES if HUGETLB_PAGE select PPC_MM_SLICES if HUGETLB_PAGE
select HAVE_ARCH_VMAP_STACK
config 40x config 40x
bool "AMCC 40x" bool "AMCC 40x"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment