diff options
Diffstat (limited to 'arch/x86/kvm/svm.c')
-rw-r--r-- | arch/x86/kvm/svm.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index e2ee264740c7..8233b86c778c 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -62,6 +62,7 @@ static int npt = 1; | |||
62 | module_param(npt, int, S_IRUGO); | 62 | module_param(npt, int, S_IRUGO); |
63 | 63 | ||
64 | static void kvm_reput_irq(struct vcpu_svm *svm); | 64 | static void kvm_reput_irq(struct vcpu_svm *svm); |
65 | static void svm_flush_tlb(struct kvm_vcpu *vcpu); | ||
65 | 66 | ||
66 | static inline struct vcpu_svm *to_svm(struct kvm_vcpu *vcpu) | 67 | static inline struct vcpu_svm *to_svm(struct kvm_vcpu *vcpu) |
67 | { | 68 | { |
@@ -878,6 +879,10 @@ set: | |||
878 | static void svm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) | 879 | static void svm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) |
879 | { | 880 | { |
880 | unsigned long host_cr4_mce = read_cr4() & X86_CR4_MCE; | 881 | unsigned long host_cr4_mce = read_cr4() & X86_CR4_MCE; |
882 | unsigned long old_cr4 = to_svm(vcpu)->vmcb->save.cr4; | ||
883 | |||
884 | if (npt_enabled && ((old_cr4 ^ cr4) & X86_CR4_PGE)) | ||
885 | force_new_asid(vcpu); | ||
881 | 886 | ||
882 | vcpu->arch.cr4 = cr4; | 887 | vcpu->arch.cr4 = cr4; |
883 | if (!npt_enabled) | 888 | if (!npt_enabled) |
@@ -1027,6 +1032,13 @@ static int pf_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run) | |||
1027 | KVMTRACE_3D(TDP_FAULT, &svm->vcpu, error_code, | 1032 | KVMTRACE_3D(TDP_FAULT, &svm->vcpu, error_code, |
1028 | (u32)fault_address, (u32)(fault_address >> 32), | 1033 | (u32)fault_address, (u32)(fault_address >> 32), |
1029 | handler); | 1034 | handler); |
1035 | /* | ||
1036 | * FIXME: Tis shouldn't be necessary here, but there is a flush | ||
1037 | * missing in the MMU code. Until we find this bug, flush the | ||
1038 | * complete TLB here on an NPF | ||
1039 | */ | ||
1040 | if (npt_enabled) | ||
1041 | svm_flush_tlb(&svm->vcpu); | ||
1030 | 1042 | ||
1031 | if (event_injection) | 1043 | if (event_injection) |
1032 | kvm_mmu_unprotect_page_virt(&svm->vcpu, fault_address); | 1044 | kvm_mmu_unprotect_page_virt(&svm->vcpu, fault_address); |