xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Egger <Christoph.Egger@amd.com>
To: "xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: [PATCH] nestedsvm: fix DRn handling
Date: Thu, 5 Jul 2012 15:55:30 +0200	[thread overview]
Message-ID: <4FF59CD2.9000502@amd.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 475 bytes --]


Always use l1 vmcb to handle DRn access. This avoids to interfere
with l1 hypervisor's DRn handling when it doesn't intercept DRn.
Fixes Hyper-V hang.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>


-- 
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85689 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632

[-- Attachment #2: xen_nh_dr.diff --]
[-- Type: text/plain, Size: 1681 bytes --]

diff -r c5b79f3b204c xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c	Thu Jul 05 12:25:13 2012 +0200
+++ b/xen/arch/x86/hvm/svm/svm.c	Thu Jul 05 14:45:46 2012 +0200
@@ -174,10 +174,8 @@ static void svm_save_dr(struct vcpu *v)
     v->arch.debugreg[7] = vmcb_get_dr7(vmcb);
 }
 
-static void __restore_debug_registers(struct vcpu *v)
+static void __restore_debug_registers(struct vmcb_struct *vmcb, struct vcpu *v)
 {
-    struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
-
     if ( v->arch.hvm_vcpu.flag_dr_dirty )
         return;
 
@@ -200,8 +198,9 @@ static void __restore_debug_registers(st
  */
 static void svm_restore_dr(struct vcpu *v)
 {
+    struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
     if ( unlikely(v->arch.debugreg[7] & DR7_ACTIVE_MASK) )
-        __restore_debug_registers(v);
+        __restore_debug_registers(vmcb, v);
 }
 
 static int svm_vmcb_save(struct vcpu *v, struct hvm_hw_cpu *c)
@@ -1078,7 +1077,7 @@ static void svm_inject_trap(struct hvm_t
     case TRAP_debug:
         if ( guest_cpu_user_regs()->eflags & X86_EFLAGS_TF )
         {
-            __restore_debug_registers(curr);
+            __restore_debug_registers(vmcb, curr);
             vmcb_set_dr6(vmcb, vmcb_get_dr6(vmcb) | 0x4000);
         }
         if ( cpu_has_monitor_trap_flag )
@@ -1455,8 +1454,10 @@ static void svm_vmexit_do_cr_access(
 
 static void svm_dr_access(struct vcpu *v, struct cpu_user_regs *regs)
 {
+    struct vmcb_struct *vmcb = vcpu_nestedhvm(v).nv_n1vmcx;
+
     HVMTRACE_0D(DR_WRITE);
-    __restore_debug_registers(v);
+    __restore_debug_registers(vmcb, v);
 }
 
 static int svm_msr_read_intercept(unsigned int msr, uint64_t *msr_content)

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

                 reply	other threads:[~2012-07-05 13:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4FF59CD2.9000502@amd.com \
    --to=christoph.egger@amd.com \
    --cc=xen-devel@lists.xen.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).