From: Joerg Rodel Subject: [PATCH] KVM: SVM: fix guest global tlb flushes with NPT Date: Tue, 2 Sep 2008 18:51:17 +0200 Message-ID: <1220374277-12079-1-git-send-email-joerg.roedel@amd.com> Mime-Version: 1.0 Content-Type: text/plain Cc: kvm@vger.kernel.org, Joerg Roedel To: avi@qumranet.com Return-path: Received: from outbound-va3.frontbridge.com ([216.32.180.16]:39744 "EHLO VA3EHSOBE006.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751295AbYIBQvj (ORCPT ); Tue, 2 Sep 2008 12:51:39 -0400 Sender: kvm-owner@vger.kernel.org List-ID: From: Joerg Roedel 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 --- arch/x86/kvm/svm.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 961dc3b..6022888 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -860,6 +860,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) -- 1.5.3.7