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