Commit 4508a74a authored by Nicholas Piggin's avatar Nicholas Piggin Committed by Michael Ellerman

powerpc/64s/exception: remove H concatenation for EXC_HV variants

Replace all instances of this with gas macros that test the hsrr
parameter and use the appropriate register names / labels.

No generated code change.
Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
[mpe: Remove extraneous 2nd check for 0xea0 in SOFTEN_TEST]
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 1efd8caa
This diff is collapsed.
...@@ -387,22 +387,22 @@ end_##sname: ...@@ -387,22 +387,22 @@ end_##sname:
#define TRAMP_KVM(area, n) \ #define TRAMP_KVM(area, n) \
TRAMP_KVM_BEGIN(do_kvm_##n); \ TRAMP_KVM_BEGIN(do_kvm_##n); \
KVM_HANDLER(area, EXC_STD, n); \ KVM_HANDLER area, EXC_STD, n
#define TRAMP_KVM_SKIP(area, n) \ #define TRAMP_KVM_SKIP(area, n) \
TRAMP_KVM_BEGIN(do_kvm_##n); \ TRAMP_KVM_BEGIN(do_kvm_##n); \
KVM_HANDLER_SKIP(area, EXC_STD, n); \ KVM_HANDLER_SKIP area, EXC_STD, n
/* /*
* HV variant exceptions get the 0x2 bit added to their trap number. * HV variant exceptions get the 0x2 bit added to their trap number.
*/ */
#define TRAMP_KVM_HV(area, n) \ #define TRAMP_KVM_HV(area, n) \
TRAMP_KVM_BEGIN(do_kvm_H##n); \ TRAMP_KVM_BEGIN(do_kvm_H##n); \
KVM_HANDLER(area, EXC_HV, n + 0x2); \ KVM_HANDLER area, EXC_HV, n + 0x2
#define TRAMP_KVM_HV_SKIP(area, n) \ #define TRAMP_KVM_HV_SKIP(area, n) \
TRAMP_KVM_BEGIN(do_kvm_H##n); \ TRAMP_KVM_BEGIN(do_kvm_H##n); \
KVM_HANDLER_SKIP(area, EXC_HV, n + 0x2); \ KVM_HANDLER_SKIP area, EXC_HV, n + 0x2
#define EXC_COMMON(name, realvec, hdlr) \ #define EXC_COMMON(name, realvec, hdlr) \
EXC_COMMON_BEGIN(name); \ EXC_COMMON_BEGIN(name); \
......
...@@ -356,7 +356,7 @@ machine_check_pSeries_0: ...@@ -356,7 +356,7 @@ machine_check_pSeries_0:
* nested machine check corrupts it. machine_check_common enables * nested machine check corrupts it. machine_check_common enables
* MSR_RI. * MSR_RI.
*/ */
EXCEPTION_PROLOG_2_NORI(machine_check_common, EXC_STD) EXCEPTION_PROLOG_2_NORI machine_check_common, EXC_STD
TRAMP_KVM_SKIP(PACA_EXMC, 0x200) TRAMP_KVM_SKIP(PACA_EXMC, 0x200)
...@@ -598,7 +598,7 @@ EXCEPTION_PROLOG_1(PACA_EXGEN, KVMTEST_PR, 0x300) ...@@ -598,7 +598,7 @@ EXCEPTION_PROLOG_1(PACA_EXGEN, KVMTEST_PR, 0x300)
mfspr r11,SPRN_DSISR mfspr r11,SPRN_DSISR
std r10,PACA_EXGEN+EX_DAR(r13) std r10,PACA_EXGEN+EX_DAR(r13)
stw r11,PACA_EXGEN+EX_DSISR(r13) stw r11,PACA_EXGEN+EX_DSISR(r13)
EXCEPTION_PROLOG_2(data_access_common, EXC_STD) EXCEPTION_PROLOG_2 data_access_common, EXC_STD
EXC_VIRT_BEGIN(data_access, 0x4300, 0x80) EXC_VIRT_BEGIN(data_access, 0x4300, 0x80)
SET_SCRATCH0(r13) /* save r13 */ SET_SCRATCH0(r13) /* save r13 */
...@@ -608,7 +608,7 @@ EXCEPTION_PROLOG_1(PACA_EXGEN, NOTEST, 0x300) ...@@ -608,7 +608,7 @@ EXCEPTION_PROLOG_1(PACA_EXGEN, NOTEST, 0x300)
mfspr r11,SPRN_DSISR mfspr r11,SPRN_DSISR
std r10,PACA_EXGEN+EX_DAR(r13) std r10,PACA_EXGEN+EX_DAR(r13)
stw r11,PACA_EXGEN+EX_DSISR(r13) stw r11,PACA_EXGEN+EX_DSISR(r13)
EXCEPTION_PROLOG_2_RELON(data_access_common, EXC_STD) EXCEPTION_PROLOG_2_RELON data_access_common, EXC_STD
EXC_VIRT_END(data_access, 0x4300, 0x80) EXC_VIRT_END(data_access, 0x4300, 0x80)
TRAMP_KVM_SKIP(PACA_EXGEN, 0x300) TRAMP_KVM_SKIP(PACA_EXGEN, 0x300)
...@@ -645,7 +645,7 @@ TRAMP_REAL_BEGIN(tramp_real_data_access_slb) ...@@ -645,7 +645,7 @@ TRAMP_REAL_BEGIN(tramp_real_data_access_slb)
EXCEPTION_PROLOG_1(PACA_EXSLB, KVMTEST_PR, 0x380) EXCEPTION_PROLOG_1(PACA_EXSLB, KVMTEST_PR, 0x380)
mfspr r10,SPRN_DAR mfspr r10,SPRN_DAR
std r10,PACA_EXSLB+EX_DAR(r13) std r10,PACA_EXSLB+EX_DAR(r13)
EXCEPTION_PROLOG_2(data_access_slb_common, EXC_STD) EXCEPTION_PROLOG_2 data_access_slb_common, EXC_STD
EXC_VIRT_BEGIN(data_access_slb, 0x4380, 0x80) EXC_VIRT_BEGIN(data_access_slb, 0x4380, 0x80)
SET_SCRATCH0(r13) /* save r13 */ SET_SCRATCH0(r13) /* save r13 */
...@@ -653,7 +653,7 @@ EXCEPTION_PROLOG_0(PACA_EXSLB) ...@@ -653,7 +653,7 @@ EXCEPTION_PROLOG_0(PACA_EXSLB)
EXCEPTION_PROLOG_1(PACA_EXSLB, NOTEST, 0x380) EXCEPTION_PROLOG_1(PACA_EXSLB, NOTEST, 0x380)
mfspr r10,SPRN_DAR mfspr r10,SPRN_DAR
std r10,PACA_EXSLB+EX_DAR(r13) std r10,PACA_EXSLB+EX_DAR(r13)
EXCEPTION_PROLOG_2_RELON(data_access_slb_common, EXC_STD) EXCEPTION_PROLOG_2_RELON data_access_slb_common, EXC_STD
EXC_VIRT_END(data_access_slb, 0x4380, 0x80) EXC_VIRT_END(data_access_slb, 0x4380, 0x80)
TRAMP_KVM_SKIP(PACA_EXSLB, 0x380) TRAMP_KVM_SKIP(PACA_EXSLB, 0x380)
...@@ -774,7 +774,7 @@ EXCEPTION_PROLOG_1(PACA_EXGEN, KVMTEST_PR, 0x600) ...@@ -774,7 +774,7 @@ EXCEPTION_PROLOG_1(PACA_EXGEN, KVMTEST_PR, 0x600)
mfspr r11,SPRN_DSISR mfspr r11,SPRN_DSISR
std r10,PACA_EXGEN+EX_DAR(r13) std r10,PACA_EXGEN+EX_DAR(r13)
stw r11,PACA_EXGEN+EX_DSISR(r13) stw r11,PACA_EXGEN+EX_DSISR(r13)
EXCEPTION_PROLOG_2(alignment_common, EXC_STD) EXCEPTION_PROLOG_2 alignment_common, EXC_STD
EXC_REAL_END(alignment, 0x600, 0x100) EXC_REAL_END(alignment, 0x600, 0x100)
EXC_VIRT_BEGIN(alignment, 0x4600, 0x100) EXC_VIRT_BEGIN(alignment, 0x4600, 0x100)
...@@ -785,7 +785,7 @@ EXCEPTION_PROLOG_1(PACA_EXGEN, NOTEST, 0x600) ...@@ -785,7 +785,7 @@ EXCEPTION_PROLOG_1(PACA_EXGEN, NOTEST, 0x600)
mfspr r11,SPRN_DSISR mfspr r11,SPRN_DSISR
std r10,PACA_EXGEN+EX_DAR(r13) std r10,PACA_EXGEN+EX_DAR(r13)
stw r11,PACA_EXGEN+EX_DSISR(r13) stw r11,PACA_EXGEN+EX_DSISR(r13)
EXCEPTION_PROLOG_2_RELON(alignment_common, EXC_STD) EXCEPTION_PROLOG_2_RELON alignment_common, EXC_STD
EXC_VIRT_END(alignment, 0x4600, 0x100) EXC_VIRT_END(alignment, 0x4600, 0x100)
TRAMP_KVM(PACA_EXGEN, 0x600) TRAMP_KVM(PACA_EXGEN, 0x600)
...@@ -1053,7 +1053,7 @@ TRAMP_KVM_BEGIN(do_kvm_0xc00) ...@@ -1053,7 +1053,7 @@ TRAMP_KVM_BEGIN(do_kvm_0xc00)
SET_SCRATCH0(r10) SET_SCRATCH0(r10)
std r9,PACA_EXGEN+EX_R9(r13) std r9,PACA_EXGEN+EX_R9(r13)
mfcr r9 mfcr r9
KVM_HANDLER(PACA_EXGEN, EXC_STD, 0xc00) KVM_HANDLER PACA_EXGEN, EXC_STD, 0xc00
#endif #endif
...@@ -1320,7 +1320,7 @@ EXC_REAL_BEGIN(denorm_exception_hv, 0x1500, 0x100) ...@@ -1320,7 +1320,7 @@ EXC_REAL_BEGIN(denorm_exception_hv, 0x1500, 0x100)
#endif #endif
KVMTEST_HV(0x1500) KVMTEST_HV(0x1500)
EXCEPTION_PROLOG_2(denorm_common, EXC_HV) EXCEPTION_PROLOG_2 denorm_common, EXC_HV
EXC_REAL_END(denorm_exception_hv, 0x1500, 0x100) EXC_REAL_END(denorm_exception_hv, 0x1500, 0x100)
#ifdef CONFIG_PPC_DENORMALISATION #ifdef CONFIG_PPC_DENORMALISATION
...@@ -1442,7 +1442,7 @@ EXC_VIRT_NONE(0x5800, 0x100) ...@@ -1442,7 +1442,7 @@ EXC_VIRT_NONE(0x5800, 0x100)
std r12,PACA_EXGEN+EX_R12(r13); \ std r12,PACA_EXGEN+EX_R12(r13); \
GET_SCRATCH0(r10); \ GET_SCRATCH0(r10); \
std r10,PACA_EXGEN+EX_R13(r13); \ std r10,PACA_EXGEN+EX_R13(r13); \
EXCEPTION_PROLOG_2(soft_nmi_common, _H) EXCEPTION_PROLOG_2 soft_nmi_common, _H
/* /*
* Branch to soft_nmi_interrupt using the emergency stack. The emergency * Branch to soft_nmi_interrupt using the emergency stack. The emergency
...@@ -1477,35 +1477,50 @@ EXC_COMMON_BEGIN(soft_nmi_common) ...@@ -1477,35 +1477,50 @@ EXC_COMMON_BEGIN(soft_nmi_common)
* - Else it is one of PACA_IRQ_MUST_HARD_MASK, so hard disable and return. * - Else it is one of PACA_IRQ_MUST_HARD_MASK, so hard disable and return.
* This is called with r10 containing the value to OR to the paca field. * This is called with r10 containing the value to OR to the paca field.
*/ */
#define MASKED_INTERRUPT(_H) \ .macro MASKED_INTERRUPT hsrr
masked_##_H##interrupt: \ .if \hsrr
std r11,PACA_EXGEN+EX_R11(r13); \ masked_Hinterrupt:
lbz r11,PACAIRQHAPPENED(r13); \ .else
or r11,r11,r10; \ masked_interrupt:
stb r11,PACAIRQHAPPENED(r13); \ .endif
cmpwi r10,PACA_IRQ_DEC; \ std r11,PACA_EXGEN+EX_R11(r13)
bne 1f; \ lbz r11,PACAIRQHAPPENED(r13)
lis r10,0x7fff; \ or r11,r11,r10
ori r10,r10,0xffff; \ stb r11,PACAIRQHAPPENED(r13)
mtspr SPRN_DEC,r10; \ cmpwi r10,PACA_IRQ_DEC
b MASKED_DEC_HANDLER_LABEL; \ bne 1f
1: andi. r10,r10,PACA_IRQ_MUST_HARD_MASK; \ lis r10,0x7fff
beq 2f; \ ori r10,r10,0xffff
mfspr r10,SPRN_##_H##SRR1; \ mtspr SPRN_DEC,r10
xori r10,r10,MSR_EE; /* clear MSR_EE */ \ b MASKED_DEC_HANDLER_LABEL
mtspr SPRN_##_H##SRR1,r10; \ 1: andi. r10,r10,PACA_IRQ_MUST_HARD_MASK
ori r11,r11,PACA_IRQ_HARD_DIS; \ beq 2f
stb r11,PACAIRQHAPPENED(r13); \ .if \hsrr
2: /* done */ \ mfspr r10,SPRN_HSRR1
mtcrf 0x80,r9; \ xori r10,r10,MSR_EE /* clear MSR_EE */
std r1,PACAR1(r13); \ mtspr SPRN_HSRR1,r10
ld r9,PACA_EXGEN+EX_R9(r13); \ .else
ld r10,PACA_EXGEN+EX_R10(r13); \ mfspr r10,SPRN_SRR1
ld r11,PACA_EXGEN+EX_R11(r13); \ xori r10,r10,MSR_EE /* clear MSR_EE */
/* returns to kernel where r13 must be set up, so don't restore it */ \ mtspr SPRN_SRR1,r10
##_H##RFI_TO_KERNEL; \ .endif
b .; \ ori r11,r11,PACA_IRQ_HARD_DIS
MASKED_DEC_HANDLER(_H) stb r11,PACAIRQHAPPENED(r13)
2: /* done */
mtcrf 0x80,r9
std r1,PACAR1(r13)
ld r9,PACA_EXGEN+EX_R9(r13)
ld r10,PACA_EXGEN+EX_R10(r13)
ld r11,PACA_EXGEN+EX_R11(r13)
/* returns to kernel where r13 must be set up, so don't restore it */
.if \hsrr
HRFI_TO_KERNEL
.else
RFI_TO_KERNEL
.endif
b .
MASKED_DEC_HANDLER(\hsrr\())
.endm
TRAMP_REAL_BEGIN(stf_barrier_fallback) TRAMP_REAL_BEGIN(stf_barrier_fallback)
std r9,PACA_EXRFI+EX_R9(r13) std r9,PACA_EXRFI+EX_R9(r13)
...@@ -1612,8 +1627,8 @@ TRAMP_REAL_BEGIN(hrfi_flush_fallback) ...@@ -1612,8 +1627,8 @@ TRAMP_REAL_BEGIN(hrfi_flush_fallback)
* cannot reach these if they are put there. * cannot reach these if they are put there.
*/ */
USE_FIXED_SECTION(virt_trampolines) USE_FIXED_SECTION(virt_trampolines)
MASKED_INTERRUPT() MASKED_INTERRUPT EXC_STD
MASKED_INTERRUPT(H) MASKED_INTERRUPT EXC_HV
#ifdef CONFIG_KVM_BOOK3S_64_HANDLER #ifdef CONFIG_KVM_BOOK3S_64_HANDLER
TRAMP_REAL_BEGIN(kvmppc_skip_interrupt) TRAMP_REAL_BEGIN(kvmppc_skip_interrupt)
......
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