Commit dd84c217 authored by Alexander Graf's avatar Alexander Graf Committed by Avi Kivity

KVM: PPC: Add KVM intercept handlers

When an interrupt occurs we don't know yet if we're in guest context or
in host context. When in guest context, KVM needs to handle it.

So let's pull the same trick we did on Book3S_64: Just add a macro to
determine if we're in guest context or not and if so jump on to KVM code.

CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
Acked-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent ada7ba17
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <asm/asm-offsets.h> #include <asm/asm-offsets.h>
#include <asm/ptrace.h> #include <asm/ptrace.h>
#include <asm/bug.h> #include <asm/bug.h>
#include <asm/kvm_book3s_asm.h>
/* 601 only have IBAT; cr0.eq is set on 601 when using this macro */ /* 601 only have IBAT; cr0.eq is set on 601 when using this macro */
#define LOAD_BAT(n, reg, RA, RB) \ #define LOAD_BAT(n, reg, RA, RB) \
...@@ -303,6 +304,7 @@ __secondary_hold_acknowledge: ...@@ -303,6 +304,7 @@ __secondary_hold_acknowledge:
*/ */
#define EXCEPTION(n, label, hdlr, xfer) \ #define EXCEPTION(n, label, hdlr, xfer) \
. = n; \ . = n; \
DO_KVM n; \
label: \ label: \
EXCEPTION_PROLOG; \ EXCEPTION_PROLOG; \
addi r3,r1,STACK_FRAME_OVERHEAD; \ addi r3,r1,STACK_FRAME_OVERHEAD; \
...@@ -358,6 +360,7 @@ i##n: \ ...@@ -358,6 +360,7 @@ i##n: \
* -- paulus. * -- paulus.
*/ */
. = 0x200 . = 0x200
DO_KVM 0x200
mtspr SPRN_SPRG_SCRATCH0,r10 mtspr SPRN_SPRG_SCRATCH0,r10
mtspr SPRN_SPRG_SCRATCH1,r11 mtspr SPRN_SPRG_SCRATCH1,r11
mfcr r10 mfcr r10
...@@ -381,6 +384,7 @@ i##n: \ ...@@ -381,6 +384,7 @@ i##n: \
/* Data access exception. */ /* Data access exception. */
. = 0x300 . = 0x300
DO_KVM 0x300
DataAccess: DataAccess:
EXCEPTION_PROLOG EXCEPTION_PROLOG
mfspr r10,SPRN_DSISR mfspr r10,SPRN_DSISR
...@@ -397,6 +401,7 @@ DataAccess: ...@@ -397,6 +401,7 @@ DataAccess:
/* Instruction access exception. */ /* Instruction access exception. */
. = 0x400 . = 0x400
DO_KVM 0x400
InstructionAccess: InstructionAccess:
EXCEPTION_PROLOG EXCEPTION_PROLOG
andis. r0,r9,0x4000 /* no pte found? */ andis. r0,r9,0x4000 /* no pte found? */
...@@ -413,6 +418,7 @@ InstructionAccess: ...@@ -413,6 +418,7 @@ InstructionAccess:
/* Alignment exception */ /* Alignment exception */
. = 0x600 . = 0x600
DO_KVM 0x600
Alignment: Alignment:
EXCEPTION_PROLOG EXCEPTION_PROLOG
mfspr r4,SPRN_DAR mfspr r4,SPRN_DAR
...@@ -427,6 +433,7 @@ Alignment: ...@@ -427,6 +433,7 @@ Alignment:
/* Floating-point unavailable */ /* Floating-point unavailable */
. = 0x800 . = 0x800
DO_KVM 0x800
FPUnavailable: FPUnavailable:
BEGIN_FTR_SECTION BEGIN_FTR_SECTION
/* /*
...@@ -450,6 +457,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_FPU_UNAVAILABLE) ...@@ -450,6 +457,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_FPU_UNAVAILABLE)
/* System call */ /* System call */
. = 0xc00 . = 0xc00
DO_KVM 0xc00
SystemCall: SystemCall:
EXCEPTION_PROLOG EXCEPTION_PROLOG
EXC_XFER_EE_LITE(0xc00, DoSyscall) EXC_XFER_EE_LITE(0xc00, DoSyscall)
...@@ -467,9 +475,11 @@ SystemCall: ...@@ -467,9 +475,11 @@ SystemCall:
* by executing an altivec instruction. * by executing an altivec instruction.
*/ */
. = 0xf00 . = 0xf00
DO_KVM 0xf00
b PerformanceMonitor b PerformanceMonitor
. = 0xf20 . = 0xf20
DO_KVM 0xf20
b AltiVecUnavailable b AltiVecUnavailable
/* /*
...@@ -882,6 +892,10 @@ __secondary_start: ...@@ -882,6 +892,10 @@ __secondary_start:
RFI RFI
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
#ifdef CONFIG_KVM_BOOK3S_HANDLER
#include "../kvm/book3s_rmhandlers.S"
#endif
/* /*
* Those generic dummy functions are kept for CPUs not * Those generic dummy functions are kept for CPUs not
* included in CONFIG_6xx * included in CONFIG_6xx
......
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