[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] nestedsvm: fix DRn handling


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Mon, 09 Jul 2012 19:00:10 +0000
  • Delivery-date: Mon, 09 Jul 2012 19:00:29 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Christoph Egger <Christoph.Egger@xxxxxxx>
# Date 1341824943 -3600
# Node ID f7b33a9f3b97b01da8e1a5740421c21577b7cee3
# Parent  7b0dc7f3ddfe65e65b0878661a6967f781023c7d
nestedsvm: fix DRn handling

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@xxxxxxx>
Committed-by: Keir Fraser <keir@xxxxxxx>
---


diff -r 7b0dc7f3ddfe -r f7b33a9f3b97 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Fri Jul 06 13:17:45 2012 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c        Mon Jul 09 10:09:03 2012 +0100
@@ -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)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.