mirror of https://gitee.com/openkylin/linux.git
powerpc/powernv: de-deuplicate OPAL call wrappers
Currently the code to perform an OPAL call is duplicated between the normal path and path taken when tracepoints are enabled. There's no real need for this and combining them makes opal_tracepoint_entry considerably easier to understand. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
parent
de78ae6c9e
commit
c3a08e93d6
|
@ -50,21 +50,13 @@ END_FTR_SECTION(0, 1); \
|
||||||
#define OPAL_BRANCH(LABEL)
|
#define OPAL_BRANCH(LABEL)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* TODO:
|
/*
|
||||||
*
|
* DO_OPAL_CALL assumes:
|
||||||
* - Trace irqs in/off (needs saving/restoring all args, argh...)
|
* r0 = opal call token
|
||||||
* - Get r11 feed up by Dave so I can have better register usage
|
* r12 = msr
|
||||||
|
* LR has been saved
|
||||||
*/
|
*/
|
||||||
|
#define DO_OPAL_CALL() \
|
||||||
#define OPAL_CALL(name, token) \
|
|
||||||
_GLOBAL_TOC(name); \
|
|
||||||
mfmsr r12; \
|
|
||||||
mflr r0; \
|
|
||||||
andi. r11,r12,MSR_IR|MSR_DR; \
|
|
||||||
std r0,PPC_LR_STKOFF(r1); \
|
|
||||||
li r0,token; \
|
|
||||||
beq opal_real_call; \
|
|
||||||
OPAL_BRANCH(opal_tracepoint_entry) \
|
|
||||||
mfcr r11; \
|
mfcr r11; \
|
||||||
stw r11,8(r1); \
|
stw r11,8(r1); \
|
||||||
li r11,0; \
|
li r11,0; \
|
||||||
|
@ -83,6 +75,18 @@ END_FTR_SECTION(0, 1); \
|
||||||
mtspr SPRN_HSRR0,r12; \
|
mtspr SPRN_HSRR0,r12; \
|
||||||
hrfid
|
hrfid
|
||||||
|
|
||||||
|
#define OPAL_CALL(name, token) \
|
||||||
|
_GLOBAL_TOC(name); \
|
||||||
|
mfmsr r12; \
|
||||||
|
mflr r0; \
|
||||||
|
andi. r11,r12,MSR_IR|MSR_DR; \
|
||||||
|
std r0,PPC_LR_STKOFF(r1); \
|
||||||
|
li r0,token; \
|
||||||
|
beq opal_real_call; \
|
||||||
|
OPAL_BRANCH(opal_tracepoint_entry) \
|
||||||
|
DO_OPAL_CALL()
|
||||||
|
|
||||||
|
|
||||||
opal_return:
|
opal_return:
|
||||||
/*
|
/*
|
||||||
* Fixup endian on OPAL return... we should be able to simplify
|
* Fixup endian on OPAL return... we should be able to simplify
|
||||||
|
@ -148,26 +152,13 @@ opal_tracepoint_entry:
|
||||||
ld r8,STK_REG(R29)(r1)
|
ld r8,STK_REG(R29)(r1)
|
||||||
ld r9,STK_REG(R30)(r1)
|
ld r9,STK_REG(R30)(r1)
|
||||||
ld r10,STK_REG(R31)(r1)
|
ld r10,STK_REG(R31)(r1)
|
||||||
|
|
||||||
|
/* setup LR so we return via tracepoint_return */
|
||||||
LOAD_REG_ADDR(r11,opal_tracepoint_return)
|
LOAD_REG_ADDR(r11,opal_tracepoint_return)
|
||||||
mfcr r12
|
|
||||||
std r11,16(r1)
|
std r11,16(r1)
|
||||||
stw r12,8(r1)
|
|
||||||
li r11,0
|
|
||||||
mfmsr r12
|
mfmsr r12
|
||||||
ori r11,r11,MSR_EE
|
DO_OPAL_CALL()
|
||||||
std r12,PACASAVEDMSR(r13)
|
|
||||||
andc r12,r12,r11
|
|
||||||
mtmsrd r12,1
|
|
||||||
LOAD_REG_ADDR(r11,opal_return)
|
|
||||||
mtlr r11
|
|
||||||
li r11,MSR_DR|MSR_IR|MSR_LE
|
|
||||||
andc r12,r12,r11
|
|
||||||
mtspr SPRN_HSRR1,r12
|
|
||||||
LOAD_REG_ADDR(r11,opal)
|
|
||||||
ld r12,8(r11)
|
|
||||||
ld r2,0(r11)
|
|
||||||
mtspr SPRN_HSRR0,r12
|
|
||||||
hrfid
|
|
||||||
|
|
||||||
opal_tracepoint_return:
|
opal_tracepoint_return:
|
||||||
std r3,STK_REG(R31)(r1)
|
std r3,STK_REG(R31)(r1)
|
||||||
|
|
Loading…
Reference in New Issue