Skip to content

Commit e098223

Browse files
jan-kiszkabonzini
authored andcommitted
KVM: SVM: Sync g_pat with guest-written PAT value
When hardware supports the g_pat VMCB field, we can use it for emulating the PAT configuration that the guest configures by writing to the corresponding MSR. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Tested-by: Joerg Roedel <jroedel@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 3c2e7f7 commit e098223

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

arch/x86/kvm/svm.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3350,6 +3350,16 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr)
33503350
case MSR_VM_IGNNE:
33513351
vcpu_unimpl(vcpu, "unimplemented wrmsr: 0x%x data 0x%llx\n", ecx, data);
33523352
break;
3353+
case MSR_IA32_CR_PAT:
3354+
if (npt_enabled) {
3355+
if (!kvm_mtrr_valid(vcpu, MSR_IA32_CR_PAT, data))
3356+
return 1;
3357+
vcpu->arch.pat = data;
3358+
svm_set_guest_pat(svm, &svm->vmcb->save.g_pat);
3359+
mark_dirty(svm->vmcb, VMCB_NPT);
3360+
break;
3361+
}
3362+
/* fall through */
33533363
default:
33543364
return kvm_set_msr_common(vcpu, msr);
33553365
}

0 commit comments

Comments
 (0)