]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
KVM: SVM: allow enabling/disabling NPT by reloading only the architecture module
authorJoerg Roedel <joerg.roedel@amd.com>
Mon, 14 Jul 2008 18:36:36 +0000 (20:36 +0200)
committerAvi Kivity <avi@qumranet.com>
Sun, 27 Jul 2008 08:34:09 +0000 (11:34 +0300)
If NPT is enabled after loading both KVM modules on AMD and it should be
disabled, both KVM modules must be reloaded. If only the architecture module is
reloaded the behavior is undefined. With this patch it is possible to disable
NPT only by reloading the kvm_amd module.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
arch/x86/kvm/mmu.c
arch/x86/kvm/svm.c
include/asm-x86/kvm_host.h

index b0e4ddca6c1856a2441fe9641ae46cc71ab39724..d087d9c4f2d9f5fcc14c9a039bc3588ed7f385d6 100644 (file)
@@ -1870,6 +1870,12 @@ void kvm_enable_tdp(void)
 }
 EXPORT_SYMBOL_GPL(kvm_enable_tdp);
 
+void kvm_disable_tdp(void)
+{
+       tdp_enabled = false;
+}
+EXPORT_SYMBOL_GPL(kvm_disable_tdp);
+
 static void free_mmu_pages(struct kvm_vcpu *vcpu)
 {
        struct kvm_mmu_page *sp;
index b756e876dce391b222c6e4ec84c7dd6447e738de..951b789cc913a046d1796956e494b021c7f09375 100644 (file)
@@ -453,7 +453,8 @@ static __init int svm_hardware_setup(void)
        if (npt_enabled) {
                printk(KERN_INFO "kvm: Nested Paging enabled\n");
                kvm_enable_tdp();
-       }
+       } else
+               kvm_disable_tdp();
 
        return 0;
 
index fdde0bedaa90dd310e60862a52ef8a73f09a2f47..bc34dc21f178a0381441f49a580e788df7d8d2cd 100644 (file)
@@ -556,6 +556,7 @@ int kvm_fix_hypercall(struct kvm_vcpu *vcpu);
 int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t gva, u32 error_code);
 
 void kvm_enable_tdp(void);
+void kvm_disable_tdp(void);
 
 int load_pdptrs(struct kvm_vcpu *vcpu, unsigned long cr3);
 int complete_pio(struct kvm_vcpu *vcpu);