Skip to contentSkip to conversation

KVM: SVM: use kvm_pat_valid instead of kvm_mtrr_valid

PATCH New Ke Guo 1 participant 1 message Mar 29, 2023

Subsystems (3)
lore
Share & tools
lore

Ke Guo

author
#0 lore raw

PATCH 1/1 KVM: SVM: use kvm_pat_valid instead of kvm_mtrr_valid

Using kvm_pat_valid instead of kvm_mtrr_valid here is more appropriate. It does the same thing as calling kvm_mtrr_valid here without two useless check. MSR_IA32_CR_PAT is only related to PAT register but not the other MTRR related registers.

---
 arch/x86/kvm/svm/svm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/svm/svm.c +1 -1
index 252e7f37e4e2..834bf9e6c158 100644
@@ -2906,7 +2906,7 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr)
 
 		break;
 	case MSR_IA32_CR_PAT:
-		if (!kvm_mtrr_valid(vcpu, MSR_IA32_CR_PAT, data))
+		if (!kvm_pat_valid(data))
 			return 1;
 		vcpu->arch.pat = data;
 		svm->vmcb01.ptr->save.g_pat = data;
Signature · 1 line
2.25.1