aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/include/asm/kvm_host.h73
1 files changed, 72 insertions, 1 deletions
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index c9c930ed11d7..2cff5fe0cbe6 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -37,6 +37,8 @@
37#define KVM_NR_PAGE_SIZES 1 37#define KVM_NR_PAGE_SIZES 1
38#define KVM_PAGES_PER_HPAGE(x) (1UL<<31) 38#define KVM_PAGES_PER_HPAGE(x) (1UL<<31)
39 39
40#define HPTEG_CACHE_NUM 1024
41
40struct kvm; 42struct kvm;
41struct kvm_run; 43struct kvm_run;
42struct kvm_vcpu; 44struct kvm_vcpu;
@@ -63,6 +65,17 @@ struct kvm_vcpu_stat {
63 u32 dec_exits; 65 u32 dec_exits;
64 u32 ext_intr_exits; 66 u32 ext_intr_exits;
65 u32 halt_wakeup; 67 u32 halt_wakeup;
68#ifdef CONFIG_PPC64
69 u32 pf_storage;
70 u32 pf_instruc;
71 u32 sp_storage;
72 u32 sp_instruc;
73 u32 queue_intr;
74 u32 ld;
75 u32 ld_slow;
76 u32 st;
77 u32 st_slow;
78#endif
66}; 79};
67 80
68enum kvm_exit_types { 81enum kvm_exit_types {
@@ -109,9 +122,53 @@ struct kvmppc_exit_timing {
109struct kvm_arch { 122struct kvm_arch {
110}; 123};
111 124
125struct kvmppc_pte {
126 u64 eaddr;
127 u64 vpage;
128 u64 raddr;
129 bool may_read;
130 bool may_write;
131 bool may_execute;
132};
133
134struct kvmppc_mmu {
135 /* book3s_64 only */
136 void (*slbmte)(struct kvm_vcpu *vcpu, u64 rb, u64 rs);
137 u64 (*slbmfee)(struct kvm_vcpu *vcpu, u64 slb_nr);
138 u64 (*slbmfev)(struct kvm_vcpu *vcpu, u64 slb_nr);
139 void (*slbie)(struct kvm_vcpu *vcpu, u64 slb_nr);
140 void (*slbia)(struct kvm_vcpu *vcpu);
141 /* book3s */
142 void (*mtsrin)(struct kvm_vcpu *vcpu, u32 srnum, ulong value);
143 u32 (*mfsrin)(struct kvm_vcpu *vcpu, u32 srnum);
144 int (*xlate)(struct kvm_vcpu *vcpu, gva_t eaddr, struct kvmppc_pte *pte, bool data);
145 void (*reset_msr)(struct kvm_vcpu *vcpu);
146 void (*tlbie)(struct kvm_vcpu *vcpu, ulong addr, bool large);
147 int (*esid_to_vsid)(struct kvm_vcpu *vcpu, u64 esid, u64 *vsid);
148 u64 (*ea_to_vp)(struct kvm_vcpu *vcpu, gva_t eaddr, bool data);
149 bool (*is_dcbz32)(struct kvm_vcpu *vcpu);
150};
151
152struct hpte_cache {
153 u64 host_va;
154 u64 pfn;
155 ulong slot;
156 struct kvmppc_pte pte;
157};
158
112struct kvm_vcpu_arch { 159struct kvm_vcpu_arch {
113 u32 host_stack; 160 ulong host_stack;
114 u32 host_pid; 161 u32 host_pid;
162#ifdef CONFIG_PPC64
163 ulong host_msr;
164 ulong host_r2;
165 void *host_retip;
166 ulong trampoline_lowmem;
167 ulong trampoline_enter;
168 ulong highmem_handler;
169 ulong host_paca_phys;
170 struct kvmppc_mmu mmu;
171#endif
115 172
116 u64 fpr[32]; 173 u64 fpr[32];
117 ulong gpr[32]; 174 ulong gpr[32];
@@ -123,6 +180,10 @@ struct kvm_vcpu_arch {
123 ulong xer; 180 ulong xer;
124 181
125 ulong msr; 182 ulong msr;
183#ifdef CONFIG_PPC64
184 ulong shadow_msr;
185 ulong hflags;
186#endif
126 u32 mmucr; 187 u32 mmucr;
127 ulong sprg0; 188 ulong sprg0;
128 ulong sprg1; 189 ulong sprg1;
@@ -149,6 +210,7 @@ struct kvm_vcpu_arch {
149 u32 ivor[64]; 210 u32 ivor[64];
150 ulong ivpr; 211 ulong ivpr;
151 u32 pir; 212 u32 pir;
213 u32 pvr;
152 214
153 u32 shadow_pid; 215 u32 shadow_pid;
154 u32 pid; 216 u32 pid;
@@ -174,6 +236,9 @@ struct kvm_vcpu_arch {
174#endif 236#endif
175 237
176 u32 last_inst; 238 u32 last_inst;
239#ifdef CONFIG_PPC64
240 ulong fault_dsisr;
241#endif
177 ulong fault_dear; 242 ulong fault_dear;
178 ulong fault_esr; 243 ulong fault_esr;
179 gpa_t paddr_accessed; 244 gpa_t paddr_accessed;
@@ -186,7 +251,13 @@ struct kvm_vcpu_arch {
186 u32 cpr0_cfgaddr; /* holds the last set cpr0_cfgaddr */ 251 u32 cpr0_cfgaddr; /* holds the last set cpr0_cfgaddr */
187 252
188 struct timer_list dec_timer; 253 struct timer_list dec_timer;
254 u64 dec_jiffies;
189 unsigned long pending_exceptions; 255 unsigned long pending_exceptions;
256
257#ifdef CONFIG_PPC64
258 struct hpte_cache hpte_cache[HPTEG_CACHE_NUM];
259 int hpte_cache_offset;
260#endif
190}; 261};
191 262
192#endif /* __POWERPC_KVM_HOST_H__ */ 263#endif /* __POWERPC_KVM_HOST_H__ */