Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e5eab0ce authored by Joerg Roedel's avatar Joerg Roedel Committed by Avi Kivity
Browse files

KVM: SVM: fix guest global tlb flushes with NPT



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: default avatarJoerg Roedel <joerg.roedel@amd.com>
Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
parent 44874f84
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -879,6 +879,10 @@ static void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0)
static void svm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
static void svm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
{
{
	unsigned long host_cr4_mce = read_cr4() & X86_CR4_MCE;
	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;
	vcpu->arch.cr4 = cr4;
	if (!npt_enabled)
	if (!npt_enabled)