xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Mukesh Rathor <mukesh.rathor@oracle.com>
To: xen-devel@lists.xenproject.org
Cc: keir@xen.org, boris.ostrovsky@oracle.com,
	Aravind.Gopalakrishnan@amd.com, jbeulich@suse.com,
	suravee.suthikulpanit@amd.com
Subject: [V0 PATCH 4/6] AMD-PVH: Do not get/set vlapic TPR
Date: Fri, 15 Aug 2014 18:53:14 -0700	[thread overview]
Message-ID: <1408153996-16425-5-git-send-email-mukesh.rathor@oracle.com> (raw)
In-Reply-To: <1408153996-16425-1-git-send-email-mukesh.rathor@oracle.com>

PVH doesn't use apic emulation hence vlapic->regs ptr is not set for it.

Signed-off-by: Mukesh Rathor <mukesh.rathor@oracle.com>
---
 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 dac16f4..4bb4ff2 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -1052,7 +1052,7 @@ static void noreturn svm_do_resume(struct vcpu *v)
         hvm_asid_flush_vcpu(v);
     }
 
-    if ( !vcpu_guestmode )
+    if ( !vcpu_guestmode && vcpu_vlapic(v)->regs )
     {
         vintr_t intr;
 
@@ -2247,7 +2247,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 && vcpu_vlapic(v)->regs ) {
         intr = vmcb_get_vintr(vmcb);
         vlapic_set_reg(vcpu_vlapic(v), APIC_TASKPRI,
                    ((intr.fields.tpr & 0x0F) << 4) |
@@ -2628,15 +2628,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 && vcpu_vlapic(v)->regs )
+    {
+        /*
+         * 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.8.3.1

  parent reply	other threads:[~2014-08-16  1:53 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-16  1:53 [V0 PATCH 0/6] AMD-PVH: xen domU support Mukesh Rathor
2014-08-16  1:53 ` [V0 PATCH 1/6] AMD-PVH: construct vmcb changes Mukesh Rathor
2014-08-18  9:10   ` Roger Pau Monné
2014-08-18 23:46     ` Mukesh Rathor
2014-08-19  0:59       ` Boris Ostrovsky
2014-08-19  1:10         ` Mukesh Rathor
2014-08-22  9:39   ` Jan Beulich
2014-08-16  1:53 ` [V0 PATCH 2/6] AMD-PVH: cpuid intercept Mukesh Rathor
2014-08-16  1:53 ` [V0 PATCH 3/6] AMD-PVH: call hvm_emulate_one instead of handle_mmio Mukesh Rathor
2014-08-22  9:50   ` Jan Beulich
2014-08-22 18:52     ` Mukesh Rathor
2014-08-25  7:10       ` Jan Beulich
2014-08-26  1:53         ` Mukesh Rathor
2014-08-26  7:17           ` Jan Beulich
2014-08-28  1:07             ` Mukesh Rathor
2014-08-28  7:09               ` Jan Beulich
2014-08-16  1:53 ` Mukesh Rathor [this message]
2014-08-19  1:16   ` [V0 PATCH 4/6] AMD-PVH: Do not get/set vlapic TPR Boris Ostrovsky
2014-08-20 12:11     ` Jan Beulich
2014-08-22  9:52   ` Jan Beulich
2014-08-16  1:53 ` [V0 PATCH 5/6] AMD-PVH: Support TSC_MODE_NEVER_EMULATE for PVH Mukesh Rathor
2014-08-19  1:38   ` Boris Ostrovsky
2014-08-19  1:43     ` Boris Ostrovsky
2014-08-19  1:43     ` Mukesh Rathor
2014-08-16  1:53 ` [V0 PATCH 6/6] AMD-PVH: enable pvh if requirements met Mukesh Rathor
2014-09-30 16:04 ` [V0 PATCH 0/6] AMD-PVH: xen domU support Roger Pau Monné
2014-09-30 21:38   ` Mukesh Rathor
2014-09-30 21:49     ` Mukesh Rathor
  -- strict thread matches above, loose matches on Subject: below --
2014-12-13  2:58 [AMD PVH]: Partial/domU xen patches Mukesh Rathor
2014-12-13  2:58 ` [V0 PATCH 4/6] AMD-PVH: Do not get/set vlapic TPR Mukesh Rathor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1408153996-16425-5-git-send-email-mukesh.rathor@oracle.com \
    --to=mukesh.rathor@oracle.com \
    --cc=Aravind.Gopalakrishnan@amd.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=jbeulich@suse.com \
    --cc=keir@xen.org \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).