Commit 17bdc064 authored by Nicholas Piggin's avatar Nicholas Piggin Committed by Michael Ellerman

powerpc/64s/exception: merge KVM handler and skip variants

Conditionally expand the skip case if it is specified.

No generated code change.
Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent fa4cf6b7
...@@ -436,26 +436,17 @@ END_FTR_SECTION_NESTED(ftr,ftr,943) ...@@ -436,26 +436,17 @@ END_FTR_SECTION_NESTED(ftr,ftr,943)
.endif .endif
.endm .endm
.macro KVM_HANDLER area, hsrr, n .macro KVM_HANDLER area, hsrr, n, skip
.if \skip
cmpwi r10,KVM_GUEST_MODE_SKIP
beq 89f
.else
BEGIN_FTR_SECTION_NESTED(947) BEGIN_FTR_SECTION_NESTED(947)
ld r10,\area+EX_CFAR(r13) ld r10,\area+EX_CFAR(r13)
std r10,HSTATE_CFAR(r13) std r10,HSTATE_CFAR(r13)
END_FTR_SECTION_NESTED(CPU_FTR_CFAR,CPU_FTR_CFAR,947) END_FTR_SECTION_NESTED(CPU_FTR_CFAR,CPU_FTR_CFAR,947)
BEGIN_FTR_SECTION_NESTED(948) .endif
ld r10,\area+EX_PPR(r13)
std r10,HSTATE_PPR(r13)
END_FTR_SECTION_NESTED(CPU_FTR_HAS_PPR,CPU_FTR_HAS_PPR,948)
ld r10,\area+EX_R10(r13)
std r12,HSTATE_SCRATCH0(r13)
sldi r12,r9,32
ori r12,r12,(\n)
/* This reloads r9 before branching to kvmppc_interrupt */
__BRANCH_TO_KVM_EXIT(\area, kvmppc_interrupt)
.endm
.macro KVM_HANDLER_SKIP area, hsrr, n
cmpwi r10,KVM_GUEST_MODE_SKIP
beq 89f
BEGIN_FTR_SECTION_NESTED(948) BEGIN_FTR_SECTION_NESTED(948)
ld r10,\area+EX_PPR(r13) ld r10,\area+EX_PPR(r13)
std r10,HSTATE_PPR(r13) std r10,HSTATE_PPR(r13)
...@@ -466,6 +457,8 @@ END_FTR_SECTION_NESTED(ftr,ftr,943) ...@@ -466,6 +457,8 @@ END_FTR_SECTION_NESTED(ftr,ftr,943)
ori r12,r12,(\n) ori r12,r12,(\n)
/* This reloads r9 before branching to kvmppc_interrupt */ /* This reloads r9 before branching to kvmppc_interrupt */
__BRANCH_TO_KVM_EXIT(\area, kvmppc_interrupt) __BRANCH_TO_KVM_EXIT(\area, kvmppc_interrupt)
.if \skip
89: mtocrf 0x80,r9 89: mtocrf 0x80,r9
ld r9,\area+EX_R9(r13) ld r9,\area+EX_R9(r13)
ld r10,\area+EX_R10(r13) ld r10,\area+EX_R10(r13)
...@@ -474,14 +467,13 @@ END_FTR_SECTION_NESTED(ftr,ftr,943) ...@@ -474,14 +467,13 @@ END_FTR_SECTION_NESTED(ftr,ftr,943)
.else .else
b kvmppc_skip_interrupt b kvmppc_skip_interrupt
.endif .endif
.endif
.endm .endm
#else #else
.macro KVMTEST hsrr, n .macro KVMTEST hsrr, n
.endm .endm
.macro KVM_HANDLER area, hsrr, n .macro KVM_HANDLER area, hsrr, n, skip
.endm
.macro KVM_HANDLER_SKIP area, hsrr, n
.endm .endm
#endif #endif
......
...@@ -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, 0
#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 area, EXC_STD, n, 1
/* /*
* 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, 0
#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 area, EXC_HV, n + 0x2, 1
#define EXC_COMMON(name, realvec, hdlr) \ #define EXC_COMMON(name, realvec, hdlr) \
EXC_COMMON_BEGIN(name); \ EXC_COMMON_BEGIN(name); \
......
...@@ -1063,7 +1063,7 @@ TRAMP_KVM_BEGIN(do_kvm_0xc00) ...@@ -1063,7 +1063,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, 0
#endif #endif
......
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