diff options
author | Yan Zhao <yan.y.zhao@intel.com> | 2023-07-14 09:51:56 +0300 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2023-10-10 00:35:14 +0300 |
commit | 9a3768191d95a9cc9a74f67ae971764def45acb4 (patch) | |
tree | e1adc06283036249fcb396f7cdc95ef7f55d71e9 /arch/x86/kvm/mtrr.c | |
parent | 7a18c7c2b69a2e47e95e2a381f9b01b9aae36747 (diff) | |
download | linux-9a3768191d95a9cc9a74f67ae971764def45acb4.tar.xz |
KVM: x86/mmu: Zap SPTEs on MTRR update iff guest MTRRs are honored
When guest MTRRs are updated, zap SPTEs and do zap range calcluation if and
only if KVM's MMU is honoring guest MTRRs, which is the only time that KVM
incorporates the guest's MTRR type into the final memtype.
Suggested-by: Chao Gao <chao.gao@intel.com>
Suggested-by: Sean Christopherson <seanjc@google.com>
Cc: Kai Huang <kai.huang@intel.com>
Signed-off-by: Yan Zhao <yan.y.zhao@intel.com>
Link: https://lore.kernel.org/r/20230714065156.20375-1-yan.y.zhao@intel.com
[sean: rephrase shortlog]
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'arch/x86/kvm/mtrr.c')
-rw-r--r-- | arch/x86/kvm/mtrr.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kvm/mtrr.c b/arch/x86/kvm/mtrr.c index 3eb6e7f47e96..a67c28a56417 100644 --- a/arch/x86/kvm/mtrr.c +++ b/arch/x86/kvm/mtrr.c @@ -320,7 +320,7 @@ static void update_mtrr(struct kvm_vcpu *vcpu, u32 msr) struct kvm_mtrr *mtrr_state = &vcpu->arch.mtrr_state; gfn_t start, end; - if (!tdp_enabled || !kvm_arch_has_noncoherent_dma(vcpu->kvm)) + if (!kvm_mmu_honors_guest_mtrrs(vcpu->kvm)) return; if (!mtrr_is_enabled(mtrr_state) && msr != MSR_MTRRdefType) |