aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/include')
-rw-r--r--arch/powerpc/include/asm/kvm_book3s.h2
-rw-r--r--arch/powerpc/include/asm/kvm_book3s_64_asm.h19
-rw-r--r--arch/powerpc/include/asm/kvm_host.h5
-rw-r--r--arch/powerpc/include/asm/kvm_ppc.h20
-rw-r--r--arch/powerpc/include/asm/paca.h5
5 files changed, 44 insertions, 7 deletions
diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h
index 74b7369770d0..f192017d799d 100644
--- a/arch/powerpc/include/asm/kvm_book3s.h
+++ b/arch/powerpc/include/asm/kvm_book3s.h
@@ -23,6 +23,7 @@
23#include <linux/types.h> 23#include <linux/types.h>
24#include <linux/kvm_host.h> 24#include <linux/kvm_host.h>
25#include <asm/kvm_ppc.h> 25#include <asm/kvm_ppc.h>
26#include <asm/kvm_book3s_64_asm.h>
26 27
27struct kvmppc_slb { 28struct kvmppc_slb {
28 u64 esid; 29 u64 esid;
@@ -69,6 +70,7 @@ struct kvmppc_sid_map {
69 70
70struct kvmppc_vcpu_book3s { 71struct kvmppc_vcpu_book3s {
71 struct kvm_vcpu vcpu; 72 struct kvm_vcpu vcpu;
73 struct kvmppc_book3s_shadow_vcpu shadow_vcpu;
72 struct kvmppc_sid_map sid_map[SID_MAP_NUM]; 74 struct kvmppc_sid_map sid_map[SID_MAP_NUM];
73 struct kvmppc_slb slb[64]; 75 struct kvmppc_slb slb[64];
74 struct { 76 struct {
diff --git a/arch/powerpc/include/asm/kvm_book3s_64_asm.h b/arch/powerpc/include/asm/kvm_book3s_64_asm.h
index 2e06ee8184ef..fca9404c1a7d 100644
--- a/arch/powerpc/include/asm/kvm_book3s_64_asm.h
+++ b/arch/powerpc/include/asm/kvm_book3s_64_asm.h
@@ -20,6 +20,8 @@
20#ifndef __ASM_KVM_BOOK3S_ASM_H__ 20#ifndef __ASM_KVM_BOOK3S_ASM_H__
21#define __ASM_KVM_BOOK3S_ASM_H__ 21#define __ASM_KVM_BOOK3S_ASM_H__
22 22
23#ifdef __ASSEMBLY__
24
23#ifdef CONFIG_KVM_BOOK3S_64_HANDLER 25#ifdef CONFIG_KVM_BOOK3S_64_HANDLER
24 26
25#include <asm/kvm_asm.h> 27#include <asm/kvm_asm.h>
@@ -55,4 +57,21 @@ kvmppc_resume_\intno:
55 57
56#endif /* CONFIG_KVM_BOOK3S_64_HANDLER */ 58#endif /* CONFIG_KVM_BOOK3S_64_HANDLER */
57 59
60#else /*__ASSEMBLY__ */
61
62struct kvmppc_book3s_shadow_vcpu {
63 ulong gpr[14];
64 u32 cr;
65 u32 xer;
66 ulong host_r1;
67 ulong host_r2;
68 ulong handler;
69 ulong scratch0;
70 ulong scratch1;
71 ulong vmhandler;
72 ulong rmhandler;
73};
74
75#endif /*__ASSEMBLY__ */
76
58#endif /* __ASM_KVM_BOOK3S_ASM_H__ */ 77#endif /* __ASM_KVM_BOOK3S_ASM_H__ */
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index 1201f62d0d73..d615fa8a1412 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -175,10 +175,13 @@ struct kvm_vcpu_arch {
175 ulong gpr[32]; 175 ulong gpr[32];
176 176
177 ulong pc; 177 ulong pc;
178 u32 cr;
179 ulong ctr; 178 ulong ctr;
180 ulong lr; 179 ulong lr;
180
181#ifdef CONFIG_BOOKE
181 ulong xer; 182 ulong xer;
183 u32 cr;
184#endif
182 185
183 ulong msr; 186 ulong msr;
184#ifdef CONFIG_PPC64 187#ifdef CONFIG_PPC64
diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
index d60b2f0cdcf2..89c5d79c3479 100644
--- a/arch/powerpc/include/asm/kvm_ppc.h
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -98,34 +98,42 @@ extern void kvmppc_core_destroy_mmu(struct kvm_vcpu *vcpu);
98 98
99#ifdef CONFIG_PPC_BOOK3S 99#ifdef CONFIG_PPC_BOOK3S
100 100
101/* We assume we're always acting on the current vcpu */
102
101static inline void kvmppc_set_gpr(struct kvm_vcpu *vcpu, int num, ulong val) 103static inline void kvmppc_set_gpr(struct kvm_vcpu *vcpu, int num, ulong val)
102{ 104{
103 vcpu->arch.gpr[num] = val; 105 if ( num < 14 )
106 get_paca()->shadow_vcpu.gpr[num] = val;
107 else
108 vcpu->arch.gpr[num] = val;
104} 109}
105 110
106static inline ulong kvmppc_get_gpr(struct kvm_vcpu *vcpu, int num) 111static inline ulong kvmppc_get_gpr(struct kvm_vcpu *vcpu, int num)
107{ 112{
108 return vcpu->arch.gpr[num]; 113 if ( num < 14 )
114 return get_paca()->shadow_vcpu.gpr[num];
115 else
116 return vcpu->arch.gpr[num];
109} 117}
110 118
111static inline void kvmppc_set_cr(struct kvm_vcpu *vcpu, u32 val) 119static inline void kvmppc_set_cr(struct kvm_vcpu *vcpu, u32 val)
112{ 120{
113 vcpu->arch.cr = val; 121 get_paca()->shadow_vcpu.cr = val;
114} 122}
115 123
116static inline u32 kvmppc_get_cr(struct kvm_vcpu *vcpu) 124static inline u32 kvmppc_get_cr(struct kvm_vcpu *vcpu)
117{ 125{
118 return vcpu->arch.cr; 126 return get_paca()->shadow_vcpu.cr;
119} 127}
120 128
121static inline void kvmppc_set_xer(struct kvm_vcpu *vcpu, u32 val) 129static inline void kvmppc_set_xer(struct kvm_vcpu *vcpu, u32 val)
122{ 130{
123 vcpu->arch.xer = val; 131 get_paca()->shadow_vcpu.xer = val;
124} 132}
125 133
126static inline u32 kvmppc_get_xer(struct kvm_vcpu *vcpu) 134static inline u32 kvmppc_get_xer(struct kvm_vcpu *vcpu)
127{ 135{
128 return vcpu->arch.xer; 136 return get_paca()->shadow_vcpu.xer;
129} 137}
130 138
131#else 139#else
diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index 5e9b4ef71415..d8a693109c82 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -19,6 +19,9 @@
19#include <asm/mmu.h> 19#include <asm/mmu.h>
20#include <asm/page.h> 20#include <asm/page.h>
21#include <asm/exception-64e.h> 21#include <asm/exception-64e.h>
22#ifdef CONFIG_KVM_BOOK3S_64_HANDLER
23#include <asm/kvm_book3s_64_asm.h>
24#endif
22 25
23register struct paca_struct *local_paca asm("r13"); 26register struct paca_struct *local_paca asm("r13");
24 27
@@ -135,6 +138,8 @@ struct paca_struct {
135 u64 esid; 138 u64 esid;
136 u64 vsid; 139 u64 vsid;
137 } kvm_slb[64]; /* guest SLB */ 140 } kvm_slb[64]; /* guest SLB */
141 /* We use this to store guest state in */
142 struct kvmppc_book3s_shadow_vcpu shadow_vcpu;
138 u8 kvm_slb_max; /* highest used guest slb entry */ 143 u8 kvm_slb_max; /* highest used guest slb entry */
139 u8 kvm_in_guest; /* are we inside the guest? */ 144 u8 kvm_in_guest; /* are we inside the guest? */
140#endif 145#endif