Skip to content

Commit 7a18c7c

Browse files
yanzhao56sean-jc
authored andcommitted
KVM: x86/mmu: Zap SPTEs when CR0.CD is toggled iff guest MTRRs are honored
Zap SPTEs when CR0.CD is toggled if and only if KVM's MMU is honoring guest MTRRs, which is the only time that KVM incorporates the guest's CR0.CD into the final memtype. Suggested-by: Chao Gao <[email protected]> Signed-off-by: Yan Zhao <[email protected]> Link: https://lore.kernel.org/r/[email protected] [sean: rephrase shortlog] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 1affe45 commit 7a18c7c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/kvm/x86.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,7 @@ void kvm_post_set_cr0(struct kvm_vcpu *vcpu, unsigned long old_cr0, unsigned lon
962962
kvm_mmu_reset_context(vcpu);
963963

964964
if (((cr0 ^ old_cr0) & X86_CR0_CD) &&
965-
kvm_arch_has_noncoherent_dma(vcpu->kvm) &&
965+
kvm_mmu_honors_guest_mtrrs(vcpu->kvm) &&
966966
!kvm_check_has_quirk(vcpu->kvm, KVM_X86_QUIRK_CD_NW_CLEARED))
967967
kvm_zap_gfn_range(vcpu->kvm, 0, ~0ULL);
968968
}

0 commit comments

Comments
 (0)