From: Joerg Roedel Date: Sat, 13 Sep 2008 05:38:42 +0000 (+0300) Subject: KVM: SVM: fix guest global tlb flushes with NPT X-Git-Tag: v2.6.26.6~54 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=689f18f9c2e72b4b8589b055a51ff7bc7ffbd5bd;p=karo-tx-linux.git KVM: SVM: fix guest global tlb flushes with NPT (cherry picked from commit e5eab0cede4b1ffaca4ad857d840127622038e55) Accesses to CR4 are intercepted even with Nested Paging enabled. But the code does not check if the guest wants to do a global TLB flush. So this flush gets lost. This patch adds the check and the flush to svm_set_cr4. Signed-off-by: Joerg Roedel Signed-off-by: Avi Kivity Signed-off-by: Greg Kroah-Hartman --- diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index fe88513a3296..45e228081a1e 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -880,6 +880,10 @@ set: static void svm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) { unsigned long host_cr4_mce = read_cr4() & X86_CR4_MCE; + unsigned long old_cr4 = to_svm(vcpu)->vmcb->save.cr4; + + if (npt_enabled && ((old_cr4 ^ cr4) & X86_CR4_PGE)) + force_new_asid(vcpu); vcpu->arch.cr4 = cr4; if (!npt_enabled)