public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: SVM: fix guest global tlb flushes with NPT
@ 2008-09-09 17:11 Joerg Rodel
  2008-09-10 15:08 ` Avi Kivity
  0 siblings, 1 reply; 3+ messages in thread
From: Joerg Rodel @ 2008-09-09 17:11 UTC (permalink / raw)
  To: avi; +Cc: kvm, Joerg Roedel

From: Joerg Roedel <joerg.roedel@amd.com>

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 <joerg.roedel@amd.com>
---
 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.6.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [PATCH] KVM: SVM: fix guest global tlb flushes with NPT
@ 2008-09-02 16:51 Joerg Rodel
  0 siblings, 0 replies; 3+ messages in thread
From: Joerg Rodel @ 2008-09-02 16:51 UTC (permalink / raw)
  To: avi; +Cc: kvm, Joerg Roedel

From: Joerg Roedel <joerg.roedel@amd.com>

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 <joerg.roedel@amd.com>
---
 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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-09-10 15:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-09 17:11 [PATCH] KVM: SVM: fix guest global tlb flushes with NPT Joerg Rodel
2008-09-10 15:08 ` Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2008-09-02 16:51 Joerg Rodel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox