From mboxrd@z Thu Jan 1 00:00:00 1970 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Subject: Re: [RFC][PATCH] KVM: SVM: Sync g_pat with guest-written PAT value Date: Mon, 20 Apr 2015 18:14:02 +0200 Message-ID: <20150420161401.GB26491@potion.brq.redhat.com> References: <552B5128.4010909@siemens.com> <552B6923.3020602@siemens.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm , Joel Schopp To: Jan Kiszka Return-path: Received: from mx1.redhat.com ([209.132.183.28]:36406 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753822AbbDTQOG (ORCPT ); Mon, 20 Apr 2015 12:14:06 -0400 Content-Disposition: inline In-Reply-To: <552B6923.3020602@siemens.com> Sender: kvm-owner@vger.kernel.org List-ID: 2015-04-13 08:58+0200, Jan Kiszka: > When hardware supports the g_pat VMCB field, we can use it for emulat= ing > the PAT configuration that the guest configures by writing to the > corresponding MSR. >=20 > Signed-off-by: Jan Kiszka > --- >=20 > RFC because it is only compile-tested. >=20 > diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c > @@ -3245,6 +3245,15 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, = struct msr_data *msr) > case MSR_VM_IGNNE: > vcpu_unimpl(vcpu, "unimplemented wrmsr: 0x%x data 0x%llx\n", ecx, = data); > break; > + case MSR_IA32_CR_PAT: > + if (npt_enabled) { > + if (!kvm_mtrr_valid(vcpu, MSR_IA32_CR_PAT, data)) > + return 1; > + svm->vmcb->save.g_pat =3D data; > + vcpu->arch.pat =3D data; Disregarding my Reviewed-by, the code is missing: mark_dirty(svm->vmcb, VMCB_NPT); Also, Tested-by: Radim Kr=C4=8Dm=C3=A1=C5=99