]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
powerpc/32: save DEAR/DAR before calling handle_page_fault
authorChristophe Leroy <christophe.leroy@c-s.fr>
Sat, 21 Dec 2019 08:32:24 +0000 (08:32 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Sun, 26 Jan 2020 11:15:09 +0000 (22:15 +1100)
handle_page_fault() is the only function that save DAR/DEAR itself.

Save DAR/DEAR before calling handle_page_fault() to prepare for
VMAP stack which will require to save even before.

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/3a4d58d378091086f00fde42b59610c80289e120.1576916812.git.christophe.leroy@c-s.fr
arch/powerpc/kernel/entry_32.S
arch/powerpc/kernel/head_32.S
arch/powerpc/kernel/head_40x.S
arch/powerpc/kernel/head_8xx.S
arch/powerpc/kernel/head_booke.h
arch/powerpc/kernel/head_fsl_booke.S

index 6273b48624828c9429dc8b8a81a8a1e7c3adc6ea..317ad9df8ba837b6ed95a37d7cc4fc33d63fa43e 100644 (file)
@@ -621,7 +621,6 @@ ppc_swapcontext:
  */
        .globl  handle_page_fault
 handle_page_fault:
-       stw     r4,_DAR(r1)
        addi    r3,r1,STACK_FRAME_OVERHEAD
 #ifdef CONFIG_PPC_BOOK3S_32
        andis.  r0,r5,DSISR_DABRMATCH@h
index 9e868567b7165a9fd2f7a06a7aa618c460d3ff7f..bebb49d877f2c850ef5d2e46c221e5ab670ba310 100644 (file)
@@ -310,6 +310,7 @@ BEGIN_MMU_FTR_SECTION
 END_MMU_FTR_SECTION_IFSET(MMU_FTR_HPTE_TABLE)
 1:     lwz     r5,_DSISR(r11)          /* get DSISR value */
        mfspr   r4,SPRN_DAR
+       stw     r4, _DAR(r11)
        EXC_XFER_LITE(0x300, handle_page_fault)
 
 
@@ -327,6 +328,7 @@ BEGIN_MMU_FTR_SECTION
 END_MMU_FTR_SECTION_IFSET(MMU_FTR_HPTE_TABLE)
 1:     mr      r4,r12
        andis.  r5,r9,DSISR_SRR1_MATCH_32S@h /* Filter relevant SRR1 bits */
+       stw     r4, _DAR(r11)
        EXC_XFER_LITE(0x400, handle_page_fault)
 
 /* External interrupt */
index 585ea19765501112067f962183e8ebf93d6c4091..9bb663977e84e586bcbec5c48f96c43233a9043d 100644 (file)
@@ -313,6 +313,7 @@ _ENTRY(saved_ksp_limit)
        START_EXCEPTION(0x0400, InstructionAccess)
        EXCEPTION_PROLOG
        mr      r4,r12                  /* Pass SRR0 as arg2 */
+       stw     r4, _DEAR(r11)
        li      r5,0                    /* Pass zero as arg3 */
        EXC_XFER_LITE(0x400, handle_page_fault)
 
@@ -676,6 +677,7 @@ DataAccess:
        mfspr   r5,SPRN_ESR             /* Grab the ESR, save it, pass arg3 */
        stw     r5,_ESR(r11)
        mfspr   r4,SPRN_DEAR            /* Grab the DEAR, save it, pass arg2 */
+       stw     r4, _DEAR(r11)
        EXC_XFER_LITE(0x300, handle_page_fault)
 
 /* Other PowerPC processors, namely those derived from the 6xx-series
index dac7c0a34eea48c23868ff6611cfc10c01f6eee7..fb284d95c76abe72e668a9859dccdc7b539a64bc 100644 (file)
@@ -486,6 +486,7 @@ InstructionTLBError:
        tlbie   r4
        /* 0x400 is InstructionAccess exception, needed by bad_page_fault() */
 .Litlbie:
+       stw     r4, _DAR(r11)
        EXC_XFER_LITE(0x400, handle_page_fault)
 
 /* This is the data TLB error on the MPC8xx.  This could be due to
@@ -504,6 +505,7 @@ DARFixed:/* Return from dcbx instruction bug workaround */
        mfspr   r5,SPRN_DSISR
        stw     r5,_DSISR(r11)
        mfspr   r4,SPRN_DAR
+       stw     r4, _DAR(r11)
        andis.  r10,r5,DSISR_NOHPTE@h
        beq+    .Ldtlbie
        tlbie   r4
index 2ae635df9026d945a24145f6d5dd8c46d92fca19..37fc84ed90e3a0e1a7fb49885fe2aa2671e67777 100644 (file)
@@ -467,6 +467,7 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_EMB_HV)
        mfspr   r5,SPRN_ESR;            /* Grab the ESR and save it */        \
        stw     r5,_ESR(r11);                                                 \
        mfspr   r4,SPRN_DEAR;           /* Grab the DEAR */                   \
+       stw     r4, _DEAR(r11);                                               \
        EXC_XFER_LITE(0x0300, handle_page_fault)
 
 #define INSTRUCTION_STORAGE_EXCEPTION                                        \
@@ -475,6 +476,7 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_EMB_HV)
        mfspr   r5,SPRN_ESR;            /* Grab the ESR and save it */        \
        stw     r5,_ESR(r11);                                                 \
        mr      r4,r12;                 /* Pass SRR0 as arg2 */               \
+       stw     r4, _DEAR(r11);                                               \
        li      r5,0;                   /* Pass zero as arg3 */               \
        EXC_XFER_LITE(0x0400, handle_page_fault)
 
index 6f7a3a7162c524195adbcacebeb8fa15e75e7a38..840af004041eb17aa6d6e53d3e487b530bed94d4 100644 (file)
@@ -378,6 +378,7 @@ interrupt_base:
        mfspr   r4,SPRN_DEAR            /* Grab the DEAR, save it, pass arg2 */
        andis.  r10,r5,(ESR_ILK|ESR_DLK)@h
        bne     1f
+       stw     r4, _DEAR(r11)
        EXC_XFER_LITE(0x0300, handle_page_fault)
 1:
        addi    r3,r1,STACK_FRAME_OVERHEAD