From mboxrd@z Thu Jan 1 00:00:00 1970 From: elena.ufimtseva@oracle.com Subject: [PATCH 4/6] AMD-PVH: Do not get/set vlapic TPR Date: Mon, 22 Jun 2015 12:37:36 -0400 Message-ID: <1434991058-6585-5-git-send-email-elena.ufimtseva@oracle.com> References: <1434991058-6585-1-git-send-email-elena.ufimtseva@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1434991058-6585-1-git-send-email-elena.ufimtseva@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Elena Ufimtseva , keir@xen.org, jbeulich@suse.com, tim@xen.org, Aravind.Gopalakrishnan@amd.com, suravee.suthikulpanit@amd.com, boris.ostrovsky@oracle.com, Mukesh Rathor , roger.pau@citrix.com List-Id: xen-devel@lists.xenproject.org From: Elena Ufimtseva PVH doesn't use apic emulation hence vlapic->regs ptr is not set for it. Signed-off-by: Mukesh Rathor --- xen/arch/x86/hvm/svm/svm.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index e7262c9..64d22fe 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -1059,7 +1059,7 @@ static void noreturn svm_do_resume(struct vcpu *v) hvm_asid_flush_vcpu(v); } - if ( !vcpu_guestmode ) + if ( !vcpu_guestmode && !is_pvh_domain(v->domain) ) { vintr_t intr; @@ -2332,7 +2332,7 @@ void svm_vmexit_handler(struct cpu_user_regs *regs) * NB. We need to preserve the low bits of the TPR to make checked builds * of Windows work, even though they don't actually do anything. */ - if ( !vcpu_guestmode ) { + if ( !vcpu_guestmode && !is_pvh_domain(v->domain) ) { intr = vmcb_get_vintr(vmcb); vlapic_set_reg(vcpu_vlapic(v), APIC_TASKPRI, ((intr.fields.tpr & 0x0F) << 4) | @@ -2720,15 +2720,18 @@ void svm_vmexit_handler(struct cpu_user_regs *regs) } out: - if ( vcpu_guestmode ) - /* Don't clobber TPR of the nested guest. */ - return; - - /* The exit may have updated the TPR: reflect this in the hardware vtpr */ - intr = vmcb_get_vintr(vmcb); - intr.fields.tpr = - (vlapic_get_reg(vcpu_vlapic(v), APIC_TASKPRI) & 0xFF) >> 4; - vmcb_set_vintr(vmcb, intr); + /* Don't clobber TPR of the nested guest. */ + if ( vcpu_guestmode && !is_pvh_domain(v->domain) ) + { + /* + * The exit may have updated the TPR: reflect this in the hardware + * vtpr. + */ + intr = vmcb_get_vintr(vmcb); + intr.fields.tpr = + (vlapic_get_reg(vcpu_vlapic(v), APIC_TASKPRI) & 0xFF) >> 4; + vmcb_set_vintr(vmcb, intr); + } } void svm_trace_vmentry(void) -- 1.9.3