aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2008-07-14 14:36:36 -0400
committerAvi Kivity <avi@qumranet.com>2008-07-27 04:34:09 -0400
commit5f4cb662a0a2533b45656607471571460310a5ca (patch)
tree19f3f431f75f7103a1b98e1eea56978712399c6b /arch
parent8be1a6d6c77ab4532e4476fdb8177030ef48b52c (diff)
KVM: SVM: allow enabling/disabling NPT by reloading only the architecture module
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kvm/mmu.c6
-rw-r--r--arch/x86/kvm/svm.c3
2 files changed, 8 insertions, 1 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index b0e4ddca6c18..d087d9c4f2d9 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -1870,6 +1870,12 @@ void kvm_enable_tdp(void)
1870} 1870}
1871EXPORT_SYMBOL_GPL(kvm_enable_tdp); 1871EXPORT_SYMBOL_GPL(kvm_enable_tdp);
1872 1872
1873void kvm_disable_tdp(void)
1874{
1875 tdp_enabled = false;
1876}
1877EXPORT_SYMBOL_GPL(kvm_disable_tdp);
1878
1873static void free_mmu_pages(struct kvm_vcpu *vcpu) 1879static void free_mmu_pages(struct kvm_vcpu *vcpu)
1874{ 1880{
1875 struct kvm_mmu_page *sp; 1881 struct kvm_mmu_page *sp;
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index b756e876dce3..951b789cc913 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -453,7 +453,8 @@ static __init int svm_hardware_setup(void)
453 if (npt_enabled) { 453 if (npt_enabled) {
454 printk(KERN_INFO "kvm: Nested Paging enabled\n"); 454 printk(KERN_INFO "kvm: Nested Paging enabled\n");
455 kvm_enable_tdp(); 455 kvm_enable_tdp();
456 } 456 } else
457 kvm_disable_tdp();
457 458
458 return 0; 459 return 0;
459 460