[PATCH 10/11] powerpc/40x: Add EXC_XFER_TEMPLATE_CRITICAL()

From: Christophe Leroy
Date: Mon Jan 28 2019 - 06:11:49 EST


This patch adds EXC_XFER_TEMPLATE_CRITICAL() for handling
transfer to critical exception handler. This will allow
to move the normal exception to using the standard
EXC_XFER_TEMPLATE() defined in head_32.h

Signed-off-by: Christophe Leroy <christophe.leroy@xxxxxx>
---
arch/powerpc/kernel/head_40x.S | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/arch/powerpc/kernel/head_40x.S b/arch/powerpc/kernel/head_40x.S
index 1203075c0c1a..d52e460ea85e 100644
--- a/arch/powerpc/kernel/head_40x.S
+++ b/arch/powerpc/kernel/head_40x.S
@@ -219,9 +219,7 @@ label:
START_EXCEPTION(n, label); \
CRITICAL_EXCEPTION_PROLOG; \
addi r3,r1,STACK_FRAME_OVERHEAD; \
- EXC_XFER_TEMPLATE(hdlr, n+2, (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), \
- NOCOPY, crit_transfer_to_handler, \
- ret_from_crit_exc)
+ EXC_XFER_TEMPLATE_CRITICAL(hdlr, n+2)

#define EXC_XFER_TEMPLATE(hdlr, trap, msr, copyee, tfer, ret) \
li r10,trap; \
@@ -233,6 +231,14 @@ label:
.long hdlr; \
.long ret

+#define EXC_XFER_TEMPLATE_CRITICAL(hdlr, trap) \
+ li r10,trap; \
+ stw r10,_TRAP(r11); \
+ li r10, MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE); \
+ bl crit_transfer_to_handler; \
+ .long hdlr; \
+ .long ret_from_crit_exc
+
#define COPY_EE(d, s) rlwimi d,s,0,16,16
#define NOCOPY(d, s)

@@ -733,9 +739,7 @@ label:
/* continue normal handling for a critical exception... */
2: mfspr r4,SPRN_DBSR
addi r3,r1,STACK_FRAME_OVERHEAD
- EXC_XFER_TEMPLATE(DebugException, 0x2002, \
- (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), \
- NOCOPY, crit_transfer_to_handler, ret_from_crit_exc)
+ EXC_XFER_TEMPLATE_CRITICAL(DebugException, 0x2002)

/* Programmable Interval Timer (PIT) Exception. (from 0x1000) */
Decrementer:
@@ -755,10 +759,7 @@ FITException:
WDTException:
CRITICAL_EXCEPTION_PROLOG;
addi r3,r1,STACK_FRAME_OVERHEAD;
- EXC_XFER_TEMPLATE(WatchdogException, 0x1020+2,
- (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)),
- NOCOPY, crit_transfer_to_handler,
- ret_from_crit_exc)
+ EXC_XFER_TEMPLATE_CRITICAL(WatchdogException, 0x1020+2)

/*
* The other Data TLB exceptions bail out to this point
--
2.13.3