diff options
-rw-r--r-- | arch/x86/kvm/mmu.c | 15 | ||||
-rw-r--r-- | arch/x86/kvm/svm.c | 4 | ||||
-rw-r--r-- | include/asm-x86/kvm_host.h | 2 |
3 files changed, 20 insertions, 1 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 6651dfadae50..21cfa289d0fe 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -32,6 +32,15 @@ | |||
32 | #include <asm/cmpxchg.h> | 32 | #include <asm/cmpxchg.h> |
33 | #include <asm/io.h> | 33 | #include <asm/io.h> |
34 | 34 | ||
35 | /* | ||
36 | * When setting this variable to true it enables Two-Dimensional-Paging | ||
37 | * where the hardware walks 2 page tables: | ||
38 | * 1. the guest-virtual to guest-physical | ||
39 | * 2. while doing 1. it walks guest-physical to host-physical | ||
40 | * If the hardware supports that we don't need to do shadow paging. | ||
41 | */ | ||
42 | static bool tdp_enabled = false; | ||
43 | |||
35 | #undef MMU_DEBUG | 44 | #undef MMU_DEBUG |
36 | 45 | ||
37 | #undef AUDIT | 46 | #undef AUDIT |
@@ -1582,6 +1591,12 @@ out: | |||
1582 | } | 1591 | } |
1583 | EXPORT_SYMBOL_GPL(kvm_mmu_page_fault); | 1592 | EXPORT_SYMBOL_GPL(kvm_mmu_page_fault); |
1584 | 1593 | ||
1594 | void kvm_enable_tdp(void) | ||
1595 | { | ||
1596 | tdp_enabled = true; | ||
1597 | } | ||
1598 | EXPORT_SYMBOL_GPL(kvm_enable_tdp); | ||
1599 | |||
1585 | static void free_mmu_pages(struct kvm_vcpu *vcpu) | 1600 | static void free_mmu_pages(struct kvm_vcpu *vcpu) |
1586 | { | 1601 | { |
1587 | struct kvm_mmu_page *sp; | 1602 | struct kvm_mmu_page *sp; |
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index fb5d6c2e6a08..9e29a13136c4 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -426,8 +426,10 @@ static __init int svm_hardware_setup(void) | |||
426 | npt_enabled = false; | 426 | npt_enabled = false; |
427 | } | 427 | } |
428 | 428 | ||
429 | if (npt_enabled) | 429 | if (npt_enabled) { |
430 | printk(KERN_INFO "kvm: Nested Paging enabled\n"); | 430 | printk(KERN_INFO "kvm: Nested Paging enabled\n"); |
431 | kvm_enable_tdp(); | ||
432 | } | ||
431 | 433 | ||
432 | return 0; | 434 | return 0; |
433 | 435 | ||
diff --git a/include/asm-x86/kvm_host.h b/include/asm-x86/kvm_host.h index 274f153c8704..5c6ba2212b1b 100644 --- a/include/asm-x86/kvm_host.h +++ b/include/asm-x86/kvm_host.h | |||
@@ -493,6 +493,8 @@ int kvm_fix_hypercall(struct kvm_vcpu *vcpu); | |||
493 | 493 | ||
494 | int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t gva, u32 error_code); | 494 | int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t gva, u32 error_code); |
495 | 495 | ||
496 | void kvm_enable_tdp(void); | ||
497 | |||
496 | int load_pdptrs(struct kvm_vcpu *vcpu, unsigned long cr3); | 498 | int load_pdptrs(struct kvm_vcpu *vcpu, unsigned long cr3); |
497 | int complete_pio(struct kvm_vcpu *vcpu); | 499 | int complete_pio(struct kvm_vcpu *vcpu); |
498 | 500 | ||