Commit 5b1c9a0d authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc/32: Tag DAR in EXCEPTION_PROLOG_2 for the 8xx

8xx requires to tag the DAR with a magic value in order to
fixup DAR on faults generated by 'dcbX', as the 8xx
forgets to update the DAR for those faults.

Do the tagging as early as possible, that is before enabling MMU.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/853a2e28ca7c5fc85617037030f99fe6070c9536.1615552867.git.christophe.leroy@csgroup.eu
parent 7aa8dd67
...@@ -57,6 +57,12 @@ ...@@ -57,6 +57,12 @@
.endm .endm
.macro EXCEPTION_PROLOG_2 handle_dar_dsisr=0 .macro EXCEPTION_PROLOG_2 handle_dar_dsisr=0
#ifdef CONFIG_PPC_8xx
.if \handle_dar_dsisr
li r11, RPN_PATTERN
mtspr SPRN_DAR, r11 /* Tag DAR, to be used in DTLB Error */
.endif
#endif
LOAD_REG_IMMEDIATE(r11, MSR_KERNEL & ~(MSR_IR | MSR_RI)) /* can take DTLB miss */ LOAD_REG_IMMEDIATE(r11, MSR_KERNEL & ~(MSR_IR | MSR_RI)) /* can take DTLB miss */
mtmsr r11 mtmsr r11
isync isync
......
...@@ -30,6 +30,12 @@ ...@@ -30,6 +30,12 @@
#include <asm/export.h> #include <asm/export.h>
#include <asm/code-patching-asm.h> #include <asm/code-patching-asm.h>
/*
* Value for the bits that have fixed value in RPN entries.
* Also used for tagging DAR for DTLBerror.
*/
#define RPN_PATTERN 0x00f0
#include "head_32.h" #include "head_32.h"
.macro compare_to_kernel_boundary scratch, addr .macro compare_to_kernel_boundary scratch, addr
...@@ -42,12 +48,6 @@ ...@@ -42,12 +48,6 @@
#endif #endif
.endm .endm
/*
* Value for the bits that have fixed value in RPN entries.
* Also used for tagging DAR for DTLBerror.
*/
#define RPN_PATTERN 0x00f0
#define PAGE_SHIFT_512K 19 #define PAGE_SHIFT_512K 19
#define PAGE_SHIFT_8M 23 #define PAGE_SHIFT_8M 23
...@@ -124,8 +124,6 @@ instruction_counter: ...@@ -124,8 +124,6 @@ instruction_counter:
. = 0x200 . = 0x200
MachineCheck: MachineCheck:
EXCEPTION_PROLOG handle_dar_dsisr=1 EXCEPTION_PROLOG handle_dar_dsisr=1
li r6, RPN_PATTERN
mtspr SPRN_DAR, r6 /* Tag DAR, to be used in DTLB Error */
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_FRAME_OVERHEAD
EXC_XFER_STD(0x200, machine_check_exception) EXC_XFER_STD(0x200, machine_check_exception)
...@@ -136,8 +134,6 @@ MachineCheck: ...@@ -136,8 +134,6 @@ MachineCheck:
. = 0x600 . = 0x600
Alignment: Alignment:
EXCEPTION_PROLOG handle_dar_dsisr=1 EXCEPTION_PROLOG handle_dar_dsisr=1
li r6, RPN_PATTERN
mtspr SPRN_DAR, r6 /* Tag DAR, to be used in DTLB Error */
addi r3,r1,STACK_FRAME_OVERHEAD addi r3,r1,STACK_FRAME_OVERHEAD
b .Lalignment_exception_ool b .Lalignment_exception_ool
...@@ -331,8 +327,6 @@ DataTLBError: ...@@ -331,8 +327,6 @@ DataTLBError:
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 */
li r11, RPN_PATTERN
mtspr SPRN_DAR, r11 /* Tag DAR, to be used in DTLB Error */
EXCEPTION_PROLOG_1 EXCEPTION_PROLOG_1
EXCEPTION_PROLOG_2 handle_dar_dsisr=1 EXCEPTION_PROLOG_2 handle_dar_dsisr=1
lwz r4, _DAR(r11) lwz r4, _DAR(r11)
......
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