diff options
Diffstat (limited to 'arch/x86/include/asm/kvm_host.h')
-rw-r--r-- | arch/x86/include/asm/kvm_host.h | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index d2ac8e2ee897..dd51c83aa5de 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
@@ -48,7 +48,7 @@ | |||
48 | (~(unsigned long)(X86_CR4_VME | X86_CR4_PVI | X86_CR4_TSD | X86_CR4_DE\ | 48 | (~(unsigned long)(X86_CR4_VME | X86_CR4_PVI | X86_CR4_TSD | X86_CR4_DE\ |
49 | | X86_CR4_PSE | X86_CR4_PAE | X86_CR4_MCE \ | 49 | | X86_CR4_PSE | X86_CR4_PAE | X86_CR4_MCE \ |
50 | | X86_CR4_PGE | X86_CR4_PCE | X86_CR4_OSFXSR \ | 50 | | X86_CR4_PGE | X86_CR4_PCE | X86_CR4_OSFXSR \ |
51 | | X86_CR4_OSXSAVE \ | 51 | | X86_CR4_OSXSAVE | X86_CR4_SMEP | X86_CR4_RDWRGSFS \ |
52 | | X86_CR4_OSXMMEXCPT | X86_CR4_VMXE)) | 52 | | X86_CR4_OSXMMEXCPT | X86_CR4_VMXE)) |
53 | 53 | ||
54 | #define CR8_RESERVED_BITS (~(unsigned long)X86_CR8_TPR) | 54 | #define CR8_RESERVED_BITS (~(unsigned long)X86_CR8_TPR) |
@@ -205,6 +205,7 @@ union kvm_mmu_page_role { | |||
205 | unsigned invalid:1; | 205 | unsigned invalid:1; |
206 | unsigned nxe:1; | 206 | unsigned nxe:1; |
207 | unsigned cr0_wp:1; | 207 | unsigned cr0_wp:1; |
208 | unsigned smep_andnot_wp:1; | ||
208 | }; | 209 | }; |
209 | }; | 210 | }; |
210 | 211 | ||
@@ -227,15 +228,17 @@ struct kvm_mmu_page { | |||
227 | * in this shadow page. | 228 | * in this shadow page. |
228 | */ | 229 | */ |
229 | DECLARE_BITMAP(slot_bitmap, KVM_MEMORY_SLOTS + KVM_PRIVATE_MEM_SLOTS); | 230 | DECLARE_BITMAP(slot_bitmap, KVM_MEMORY_SLOTS + KVM_PRIVATE_MEM_SLOTS); |
230 | bool multimapped; /* More than one parent_pte? */ | ||
231 | bool unsync; | 231 | bool unsync; |
232 | int root_count; /* Currently serving as active root */ | 232 | int root_count; /* Currently serving as active root */ |
233 | unsigned int unsync_children; | 233 | unsigned int unsync_children; |
234 | union { | 234 | unsigned long parent_ptes; /* Reverse mapping for parent_pte */ |
235 | u64 *parent_pte; /* !multimapped */ | ||
236 | struct hlist_head parent_ptes; /* multimapped, kvm_pte_chain */ | ||
237 | }; | ||
238 | DECLARE_BITMAP(unsync_child_bitmap, 512); | 235 | DECLARE_BITMAP(unsync_child_bitmap, 512); |
236 | |||
237 | #ifdef CONFIG_X86_32 | ||
238 | int clear_spte_count; | ||
239 | #endif | ||
240 | |||
241 | struct rcu_head rcu; | ||
239 | }; | 242 | }; |
240 | 243 | ||
241 | struct kvm_pv_mmu_op_buffer { | 244 | struct kvm_pv_mmu_op_buffer { |
@@ -269,8 +272,6 @@ struct kvm_mmu { | |||
269 | gpa_t (*gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t gva, u32 access, | 272 | gpa_t (*gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t gva, u32 access, |
270 | struct x86_exception *exception); | 273 | struct x86_exception *exception); |
271 | gpa_t (*translate_gpa)(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access); | 274 | gpa_t (*translate_gpa)(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access); |
272 | void (*prefetch_page)(struct kvm_vcpu *vcpu, | ||
273 | struct kvm_mmu_page *page); | ||
274 | int (*sync_page)(struct kvm_vcpu *vcpu, | 275 | int (*sync_page)(struct kvm_vcpu *vcpu, |
275 | struct kvm_mmu_page *sp); | 276 | struct kvm_mmu_page *sp); |
276 | void (*invlpg)(struct kvm_vcpu *vcpu, gva_t gva); | 277 | void (*invlpg)(struct kvm_vcpu *vcpu, gva_t gva); |
@@ -346,8 +347,7 @@ struct kvm_vcpu_arch { | |||
346 | * put it here to avoid allocation */ | 347 | * put it here to avoid allocation */ |
347 | struct kvm_pv_mmu_op_buffer mmu_op_buffer; | 348 | struct kvm_pv_mmu_op_buffer mmu_op_buffer; |
348 | 349 | ||
349 | struct kvm_mmu_memory_cache mmu_pte_chain_cache; | 350 | struct kvm_mmu_memory_cache mmu_pte_list_desc_cache; |
350 | struct kvm_mmu_memory_cache mmu_rmap_desc_cache; | ||
351 | struct kvm_mmu_memory_cache mmu_page_cache; | 351 | struct kvm_mmu_memory_cache mmu_page_cache; |
352 | struct kvm_mmu_memory_cache mmu_page_header_cache; | 352 | struct kvm_mmu_memory_cache mmu_page_header_cache; |
353 | 353 | ||
@@ -393,6 +393,15 @@ struct kvm_vcpu_arch { | |||
393 | unsigned int hw_tsc_khz; | 393 | unsigned int hw_tsc_khz; |
394 | unsigned int time_offset; | 394 | unsigned int time_offset; |
395 | struct page *time_page; | 395 | struct page *time_page; |
396 | |||
397 | struct { | ||
398 | u64 msr_val; | ||
399 | u64 last_steal; | ||
400 | u64 accum_steal; | ||
401 | struct gfn_to_hva_cache stime; | ||
402 | struct kvm_steal_time steal; | ||
403 | } st; | ||
404 | |||
396 | u64 last_guest_tsc; | 405 | u64 last_guest_tsc; |
397 | u64 last_kernel_ns; | 406 | u64 last_kernel_ns; |
398 | u64 last_tsc_nsec; | 407 | u64 last_tsc_nsec; |
@@ -419,6 +428,11 @@ struct kvm_vcpu_arch { | |||
419 | u64 mcg_ctl; | 428 | u64 mcg_ctl; |
420 | u64 *mce_banks; | 429 | u64 *mce_banks; |
421 | 430 | ||
431 | /* Cache MMIO info */ | ||
432 | u64 mmio_gva; | ||
433 | unsigned access; | ||
434 | gfn_t mmio_gfn; | ||
435 | |||
422 | /* used for guest single stepping over the given code position */ | 436 | /* used for guest single stepping over the given code position */ |
423 | unsigned long singlestep_rip; | 437 | unsigned long singlestep_rip; |
424 | 438 | ||
@@ -441,6 +455,7 @@ struct kvm_arch { | |||
441 | unsigned int n_used_mmu_pages; | 455 | unsigned int n_used_mmu_pages; |
442 | unsigned int n_requested_mmu_pages; | 456 | unsigned int n_requested_mmu_pages; |
443 | unsigned int n_max_mmu_pages; | 457 | unsigned int n_max_mmu_pages; |
458 | unsigned int indirect_shadow_pages; | ||
444 | atomic_t invlpg_counter; | 459 | atomic_t invlpg_counter; |
445 | struct hlist_head mmu_page_hash[KVM_NUM_MMU_PAGES]; | 460 | struct hlist_head mmu_page_hash[KVM_NUM_MMU_PAGES]; |
446 | /* | 461 | /* |
@@ -477,6 +492,8 @@ struct kvm_arch { | |||
477 | u64 hv_guest_os_id; | 492 | u64 hv_guest_os_id; |
478 | u64 hv_hypercall; | 493 | u64 hv_hypercall; |
479 | 494 | ||
495 | atomic_t reader_counter; | ||
496 | |||
480 | #ifdef CONFIG_KVM_MMU_AUDIT | 497 | #ifdef CONFIG_KVM_MMU_AUDIT |
481 | int audit_point; | 498 | int audit_point; |
482 | #endif | 499 | #endif |
@@ -559,7 +576,7 @@ struct kvm_x86_ops { | |||
559 | void (*decache_cr4_guest_bits)(struct kvm_vcpu *vcpu); | 576 | void (*decache_cr4_guest_bits)(struct kvm_vcpu *vcpu); |
560 | void (*set_cr0)(struct kvm_vcpu *vcpu, unsigned long cr0); | 577 | void (*set_cr0)(struct kvm_vcpu *vcpu, unsigned long cr0); |
561 | void (*set_cr3)(struct kvm_vcpu *vcpu, unsigned long cr3); | 578 | void (*set_cr3)(struct kvm_vcpu *vcpu, unsigned long cr3); |
562 | void (*set_cr4)(struct kvm_vcpu *vcpu, unsigned long cr4); | 579 | int (*set_cr4)(struct kvm_vcpu *vcpu, unsigned long cr4); |
563 | void (*set_efer)(struct kvm_vcpu *vcpu, u64 efer); | 580 | void (*set_efer)(struct kvm_vcpu *vcpu, u64 efer); |
564 | void (*get_idt)(struct kvm_vcpu *vcpu, struct desc_ptr *dt); | 581 | void (*get_idt)(struct kvm_vcpu *vcpu, struct desc_ptr *dt); |
565 | void (*set_idt)(struct kvm_vcpu *vcpu, struct desc_ptr *dt); | 582 | void (*set_idt)(struct kvm_vcpu *vcpu, struct desc_ptr *dt); |
@@ -636,7 +653,6 @@ void kvm_mmu_module_exit(void); | |||
636 | void kvm_mmu_destroy(struct kvm_vcpu *vcpu); | 653 | void kvm_mmu_destroy(struct kvm_vcpu *vcpu); |
637 | int kvm_mmu_create(struct kvm_vcpu *vcpu); | 654 | int kvm_mmu_create(struct kvm_vcpu *vcpu); |
638 | int kvm_mmu_setup(struct kvm_vcpu *vcpu); | 655 | int kvm_mmu_setup(struct kvm_vcpu *vcpu); |
639 | void kvm_mmu_set_nonpresent_ptes(u64 trap_pte, u64 notrap_pte); | ||
640 | void kvm_mmu_set_mask_ptes(u64 user_mask, u64 accessed_mask, | 656 | void kvm_mmu_set_mask_ptes(u64 user_mask, u64 accessed_mask, |
641 | u64 dirty_mask, u64 nx_mask, u64 x_mask); | 657 | u64 dirty_mask, u64 nx_mask, u64 x_mask); |
642 | 658 | ||
@@ -830,11 +846,12 @@ enum { | |||
830 | asmlinkage void kvm_spurious_fault(void); | 846 | asmlinkage void kvm_spurious_fault(void); |
831 | extern bool kvm_rebooting; | 847 | extern bool kvm_rebooting; |
832 | 848 | ||
833 | #define __kvm_handle_fault_on_reboot(insn) \ | 849 | #define ____kvm_handle_fault_on_reboot(insn, cleanup_insn) \ |
834 | "666: " insn "\n\t" \ | 850 | "666: " insn "\n\t" \ |
835 | "668: \n\t" \ | 851 | "668: \n\t" \ |
836 | ".pushsection .fixup, \"ax\" \n" \ | 852 | ".pushsection .fixup, \"ax\" \n" \ |
837 | "667: \n\t" \ | 853 | "667: \n\t" \ |
854 | cleanup_insn "\n\t" \ | ||
838 | "cmpb $0, kvm_rebooting \n\t" \ | 855 | "cmpb $0, kvm_rebooting \n\t" \ |
839 | "jne 668b \n\t" \ | 856 | "jne 668b \n\t" \ |
840 | __ASM_SIZE(push) " $666b \n\t" \ | 857 | __ASM_SIZE(push) " $666b \n\t" \ |
@@ -844,6 +861,9 @@ extern bool kvm_rebooting; | |||
844 | _ASM_PTR " 666b, 667b \n\t" \ | 861 | _ASM_PTR " 666b, 667b \n\t" \ |
845 | ".popsection" | 862 | ".popsection" |
846 | 863 | ||
864 | #define __kvm_handle_fault_on_reboot(insn) \ | ||
865 | ____kvm_handle_fault_on_reboot(insn, "") | ||
866 | |||
847 | #define KVM_ARCH_WANT_MMU_NOTIFIER | 867 | #define KVM_ARCH_WANT_MMU_NOTIFIER |
848 | int kvm_unmap_hva(struct kvm *kvm, unsigned long hva); | 868 | int kvm_unmap_hva(struct kvm *kvm, unsigned long hva); |
849 | int kvm_age_hva(struct kvm *kvm, unsigned long hva); | 869 | int kvm_age_hva(struct kvm *kvm, unsigned long hva); |