Skip to content

Commit 7aeae02

Browse files
Ke Guosean-jc
authored andcommitted
KVM: SVM: Use kvm_pat_valid() directly instead of kvm_mtrr_valid()
Use kvm_pat_valid() directly instead of bouncing through kvm_mtrr_valid(). The PAT is not an MTRR, and kvm_mtrr_valid() just redirects to kvm_pat_valid(), i.e. is exempt from KVM's "zap SPTEs" logic that's needed to honor guest MTRRs when the VM has a passthrough device with non-coherent DMA (KVM does NOT set "ignore guest PAT" in this case, and so enables hardware virtualization of the guest's PAT, i.e. doesn't need to manually emulate the PAT memtype). Signed-off-by: Ke Guo <guoke@uniontech.com> [sean: massage changelog] Reviewed-by: Kai Huang <kai.huang@intel.com> Link: https://lore.kernel.org/r/20230511233351.635053-3-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent a33ba1b commit 7aeae02

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

arch/x86/kvm/svm/svm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2939,7 +2939,7 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr)
29392939

29402940
break;
29412941
case MSR_IA32_CR_PAT:
2942-
if (!kvm_mtrr_valid(vcpu, MSR_IA32_CR_PAT, data))
2942+
if (!kvm_pat_valid(data))
29432943
return 1;
29442944
vcpu->arch.pat = data;
29452945
svm->vmcb01.ptr->save.g_pat = data;

0 commit comments

Comments
 (0)