diff options
Diffstat (limited to 'arch/powerpc/include/asm/kvm_host.h')
-rw-r--r-- | arch/powerpc/include/asm/kvm_host.h | 57 |
1 files changed, 34 insertions, 23 deletions
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h index 33283532e9d8..237d1d25b448 100644 --- a/arch/powerpc/include/asm/kvm_host.h +++ b/arch/powerpc/include/asm/kvm_host.h | |||
@@ -63,20 +63,17 @@ extern void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte); | |||
63 | 63 | ||
64 | #endif | 64 | #endif |
65 | 65 | ||
66 | /* We don't currently support large pages. */ | ||
67 | #define KVM_HPAGE_GFN_SHIFT(x) 0 | ||
68 | #define KVM_NR_PAGE_SIZES 1 | ||
69 | #define KVM_PAGES_PER_HPAGE(x) (1UL<<31) | ||
70 | |||
71 | #define HPTEG_CACHE_NUM (1 << 15) | 66 | #define HPTEG_CACHE_NUM (1 << 15) |
72 | #define HPTEG_HASH_BITS_PTE 13 | 67 | #define HPTEG_HASH_BITS_PTE 13 |
73 | #define HPTEG_HASH_BITS_PTE_LONG 12 | 68 | #define HPTEG_HASH_BITS_PTE_LONG 12 |
74 | #define HPTEG_HASH_BITS_VPTE 13 | 69 | #define HPTEG_HASH_BITS_VPTE 13 |
75 | #define HPTEG_HASH_BITS_VPTE_LONG 5 | 70 | #define HPTEG_HASH_BITS_VPTE_LONG 5 |
71 | #define HPTEG_HASH_BITS_VPTE_64K 11 | ||
76 | #define HPTEG_HASH_NUM_PTE (1 << HPTEG_HASH_BITS_PTE) | 72 | #define HPTEG_HASH_NUM_PTE (1 << HPTEG_HASH_BITS_PTE) |
77 | #define HPTEG_HASH_NUM_PTE_LONG (1 << HPTEG_HASH_BITS_PTE_LONG) | 73 | #define HPTEG_HASH_NUM_PTE_LONG (1 << HPTEG_HASH_BITS_PTE_LONG) |
78 | #define HPTEG_HASH_NUM_VPTE (1 << HPTEG_HASH_BITS_VPTE) | 74 | #define HPTEG_HASH_NUM_VPTE (1 << HPTEG_HASH_BITS_VPTE) |
79 | #define HPTEG_HASH_NUM_VPTE_LONG (1 << HPTEG_HASH_BITS_VPTE_LONG) | 75 | #define HPTEG_HASH_NUM_VPTE_LONG (1 << HPTEG_HASH_BITS_VPTE_LONG) |
76 | #define HPTEG_HASH_NUM_VPTE_64K (1 << HPTEG_HASH_BITS_VPTE_64K) | ||
80 | 77 | ||
81 | /* Physical Address Mask - allowed range of real mode RAM access */ | 78 | /* Physical Address Mask - allowed range of real mode RAM access */ |
82 | #define KVM_PAM 0x0fffffffffffffffULL | 79 | #define KVM_PAM 0x0fffffffffffffffULL |
@@ -89,6 +86,9 @@ struct lppaca; | |||
89 | struct slb_shadow; | 86 | struct slb_shadow; |
90 | struct dtl_entry; | 87 | struct dtl_entry; |
91 | 88 | ||
89 | struct kvmppc_vcpu_book3s; | ||
90 | struct kvmppc_book3s_shadow_vcpu; | ||
91 | |||
92 | struct kvm_vm_stat { | 92 | struct kvm_vm_stat { |
93 | u32 remote_tlb_flush; | 93 | u32 remote_tlb_flush; |
94 | }; | 94 | }; |
@@ -224,15 +224,15 @@ struct revmap_entry { | |||
224 | #define KVMPPC_GOT_PAGE 0x80 | 224 | #define KVMPPC_GOT_PAGE 0x80 |
225 | 225 | ||
226 | struct kvm_arch_memory_slot { | 226 | struct kvm_arch_memory_slot { |
227 | #ifdef CONFIG_KVM_BOOK3S_64_HV | 227 | #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE |
228 | unsigned long *rmap; | 228 | unsigned long *rmap; |
229 | unsigned long *slot_phys; | 229 | unsigned long *slot_phys; |
230 | #endif /* CONFIG_KVM_BOOK3S_64_HV */ | 230 | #endif /* CONFIG_KVM_BOOK3S_HV_POSSIBLE */ |
231 | }; | 231 | }; |
232 | 232 | ||
233 | struct kvm_arch { | 233 | struct kvm_arch { |
234 | unsigned int lpid; | 234 | unsigned int lpid; |
235 | #ifdef CONFIG_KVM_BOOK3S_64_HV | 235 | #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE |
236 | unsigned long hpt_virt; | 236 | unsigned long hpt_virt; |
237 | struct revmap_entry *revmap; | 237 | struct revmap_entry *revmap; |
238 | unsigned int host_lpid; | 238 | unsigned int host_lpid; |
@@ -256,7 +256,10 @@ struct kvm_arch { | |||
256 | cpumask_t need_tlb_flush; | 256 | cpumask_t need_tlb_flush; |
257 | struct kvmppc_vcore *vcores[KVM_MAX_VCORES]; | 257 | struct kvmppc_vcore *vcores[KVM_MAX_VCORES]; |
258 | int hpt_cma_alloc; | 258 | int hpt_cma_alloc; |
259 | #endif /* CONFIG_KVM_BOOK3S_64_HV */ | 259 | #endif /* CONFIG_KVM_BOOK3S_HV_POSSIBLE */ |
260 | #ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE | ||
261 | struct mutex hpt_mutex; | ||
262 | #endif | ||
260 | #ifdef CONFIG_PPC_BOOK3S_64 | 263 | #ifdef CONFIG_PPC_BOOK3S_64 |
261 | struct list_head spapr_tce_tables; | 264 | struct list_head spapr_tce_tables; |
262 | struct list_head rtas_tokens; | 265 | struct list_head rtas_tokens; |
@@ -267,6 +270,7 @@ struct kvm_arch { | |||
267 | #ifdef CONFIG_KVM_XICS | 270 | #ifdef CONFIG_KVM_XICS |
268 | struct kvmppc_xics *xics; | 271 | struct kvmppc_xics *xics; |
269 | #endif | 272 | #endif |
273 | struct kvmppc_ops *kvm_ops; | ||
270 | }; | 274 | }; |
271 | 275 | ||
272 | /* | 276 | /* |
@@ -294,6 +298,10 @@ struct kvmppc_vcore { | |||
294 | u64 stolen_tb; | 298 | u64 stolen_tb; |
295 | u64 preempt_tb; | 299 | u64 preempt_tb; |
296 | struct kvm_vcpu *runner; | 300 | struct kvm_vcpu *runner; |
301 | u64 tb_offset; /* guest timebase - host timebase */ | ||
302 | ulong lpcr; | ||
303 | u32 arch_compat; | ||
304 | ulong pcr; | ||
297 | }; | 305 | }; |
298 | 306 | ||
299 | #define VCORE_ENTRY_COUNT(vc) ((vc)->entry_exit_count & 0xff) | 307 | #define VCORE_ENTRY_COUNT(vc) ((vc)->entry_exit_count & 0xff) |
@@ -328,6 +336,7 @@ struct kvmppc_pte { | |||
328 | bool may_read : 1; | 336 | bool may_read : 1; |
329 | bool may_write : 1; | 337 | bool may_write : 1; |
330 | bool may_execute : 1; | 338 | bool may_execute : 1; |
339 | u8 page_size; /* MMU_PAGE_xxx */ | ||
331 | }; | 340 | }; |
332 | 341 | ||
333 | struct kvmppc_mmu { | 342 | struct kvmppc_mmu { |
@@ -340,7 +349,8 @@ struct kvmppc_mmu { | |||
340 | /* book3s */ | 349 | /* book3s */ |
341 | void (*mtsrin)(struct kvm_vcpu *vcpu, u32 srnum, ulong value); | 350 | void (*mtsrin)(struct kvm_vcpu *vcpu, u32 srnum, ulong value); |
342 | u32 (*mfsrin)(struct kvm_vcpu *vcpu, u32 srnum); | 351 | u32 (*mfsrin)(struct kvm_vcpu *vcpu, u32 srnum); |
343 | int (*xlate)(struct kvm_vcpu *vcpu, gva_t eaddr, struct kvmppc_pte *pte, bool data); | 352 | int (*xlate)(struct kvm_vcpu *vcpu, gva_t eaddr, |
353 | struct kvmppc_pte *pte, bool data, bool iswrite); | ||
344 | void (*reset_msr)(struct kvm_vcpu *vcpu); | 354 | void (*reset_msr)(struct kvm_vcpu *vcpu); |
345 | void (*tlbie)(struct kvm_vcpu *vcpu, ulong addr, bool large); | 355 | void (*tlbie)(struct kvm_vcpu *vcpu, ulong addr, bool large); |
346 | int (*esid_to_vsid)(struct kvm_vcpu *vcpu, ulong esid, u64 *vsid); | 356 | int (*esid_to_vsid)(struct kvm_vcpu *vcpu, ulong esid, u64 *vsid); |
@@ -360,6 +370,7 @@ struct kvmppc_slb { | |||
360 | bool large : 1; /* PTEs are 16MB */ | 370 | bool large : 1; /* PTEs are 16MB */ |
361 | bool tb : 1; /* 1TB segment */ | 371 | bool tb : 1; /* 1TB segment */ |
362 | bool class : 1; | 372 | bool class : 1; |
373 | u8 base_page_size; /* MMU_PAGE_xxx */ | ||
363 | }; | 374 | }; |
364 | 375 | ||
365 | # ifdef CONFIG_PPC_FSL_BOOK3E | 376 | # ifdef CONFIG_PPC_FSL_BOOK3E |
@@ -377,17 +388,6 @@ struct kvmppc_slb { | |||
377 | #define KVMPPC_EPR_USER 1 /* exit to userspace to fill EPR */ | 388 | #define KVMPPC_EPR_USER 1 /* exit to userspace to fill EPR */ |
378 | #define KVMPPC_EPR_KERNEL 2 /* in-kernel irqchip */ | 389 | #define KVMPPC_EPR_KERNEL 2 /* in-kernel irqchip */ |
379 | 390 | ||
380 | struct kvmppc_booke_debug_reg { | ||
381 | u32 dbcr0; | ||
382 | u32 dbcr1; | ||
383 | u32 dbcr2; | ||
384 | #ifdef CONFIG_KVM_E500MC | ||
385 | u32 dbcr4; | ||
386 | #endif | ||
387 | u64 iac[KVMPPC_BOOKE_MAX_IAC]; | ||
388 | u64 dac[KVMPPC_BOOKE_MAX_DAC]; | ||
389 | }; | ||
390 | |||
391 | #define KVMPPC_IRQ_DEFAULT 0 | 391 | #define KVMPPC_IRQ_DEFAULT 0 |
392 | #define KVMPPC_IRQ_MPIC 1 | 392 | #define KVMPPC_IRQ_MPIC 1 |
393 | #define KVMPPC_IRQ_XICS 2 | 393 | #define KVMPPC_IRQ_XICS 2 |
@@ -402,6 +402,10 @@ struct kvm_vcpu_arch { | |||
402 | int slb_max; /* 1 + index of last valid entry in slb[] */ | 402 | int slb_max; /* 1 + index of last valid entry in slb[] */ |
403 | int slb_nr; /* total number of entries in SLB */ | 403 | int slb_nr; /* total number of entries in SLB */ |
404 | struct kvmppc_mmu mmu; | 404 | struct kvmppc_mmu mmu; |
405 | struct kvmppc_vcpu_book3s *book3s; | ||
406 | #endif | ||
407 | #ifdef CONFIG_PPC_BOOK3S_32 | ||
408 | struct kvmppc_book3s_shadow_vcpu *shadow_vcpu; | ||
405 | #endif | 409 | #endif |
406 | 410 | ||
407 | ulong gpr[32]; | 411 | ulong gpr[32]; |
@@ -463,6 +467,8 @@ struct kvm_vcpu_arch { | |||
463 | u32 ctrl; | 467 | u32 ctrl; |
464 | ulong dabr; | 468 | ulong dabr; |
465 | ulong cfar; | 469 | ulong cfar; |
470 | ulong ppr; | ||
471 | ulong shadow_srr1; | ||
466 | #endif | 472 | #endif |
467 | u32 vrsave; /* also USPRG0 */ | 473 | u32 vrsave; /* also USPRG0 */ |
468 | u32 mmucr; | 474 | u32 mmucr; |
@@ -498,6 +504,8 @@ struct kvm_vcpu_arch { | |||
498 | 504 | ||
499 | u64 mmcr[3]; | 505 | u64 mmcr[3]; |
500 | u32 pmc[8]; | 506 | u32 pmc[8]; |
507 | u64 siar; | ||
508 | u64 sdar; | ||
501 | 509 | ||
502 | #ifdef CONFIG_KVM_EXIT_TIMING | 510 | #ifdef CONFIG_KVM_EXIT_TIMING |
503 | struct mutex exit_timing_lock; | 511 | struct mutex exit_timing_lock; |
@@ -531,7 +539,10 @@ struct kvm_vcpu_arch { | |||
531 | u32 eptcfg; | 539 | u32 eptcfg; |
532 | u32 epr; | 540 | u32 epr; |
533 | u32 crit_save; | 541 | u32 crit_save; |
534 | struct kvmppc_booke_debug_reg dbg_reg; | 542 | /* guest debug registers*/ |
543 | struct debug_reg dbg_reg; | ||
544 | /* hardware visible debug registers when in guest state */ | ||
545 | struct debug_reg shadow_dbg_reg; | ||
535 | #endif | 546 | #endif |
536 | gpa_t paddr_accessed; | 547 | gpa_t paddr_accessed; |
537 | gva_t vaddr_accessed; | 548 | gva_t vaddr_accessed; |
@@ -582,7 +593,7 @@ struct kvm_vcpu_arch { | |||
582 | struct kvmppc_icp *icp; /* XICS presentation controller */ | 593 | struct kvmppc_icp *icp; /* XICS presentation controller */ |
583 | #endif | 594 | #endif |
584 | 595 | ||
585 | #ifdef CONFIG_KVM_BOOK3S_64_HV | 596 | #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE |
586 | struct kvm_vcpu_arch_shared shregs; | 597 | struct kvm_vcpu_arch_shared shregs; |
587 | 598 | ||
588 | unsigned long pgfault_addr; | 599 | unsigned long pgfault_addr; |