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

[Xen-changelog] Fix HVM MSR save/restore.



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 6f874e089244ec193922236de975bffb1c1c2910
# Parent  4ca6f052cdf6f1c18209042e4c9960ca41e75d4b
Fix HVM MSR save/restore.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
Signed-off-by: Yunhong Jiang <yunhong.jiang@xxxxxxxxx>
Signed-off-by: Xin Li <xin.b.li@xxxxxxxxx>

diff -r 4ca6f052cdf6 -r 6f874e089244 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     Fri Feb 17 11:49:11 2006
+++ b/xen/arch/x86/domain.c     Fri Feb 17 15:29:24 2006
@@ -435,8 +435,6 @@
 
         if ( !hvm_initialize_guest_resources(v) )
             return -EINVAL;
-
-        hvm_switch_on = 1;
     }
 
     update_pagetables(v);
@@ -685,6 +683,8 @@
                CTXT_SWITCH_STACK_BYTES);
         unlazy_fpu(p);
         save_segments(p);
+        if ( HVM_DOMAIN(p) )
+            hvm_load_msrs();
     }
 
     if ( !is_idle_vcpu(n) )
@@ -710,6 +710,10 @@
             set_int80_direct_trap(n);
             switch_kernel_stack(n, cpu);
         }
+        else
+        {
+            hvm_restore_msrs(next);
+        }
     }
 
     if ( p->domain != n->domain )
@@ -765,16 +769,10 @@
         /* Re-enable interrupts before restoring state which may fault. */
         local_irq_enable();
 
-        if ( HVM_DOMAIN(next) )
-        {
-            hvm_restore_msrs(next);
-        }
-        else
+        if ( !HVM_DOMAIN(next) )
         {
             load_LDT(next);
             load_segments(next);
-            if ( HVM_DOMAIN(next) )
-                hvm_load_msrs(next);
         }
     }
 
diff -r 4ca6f052cdf6 -r 6f874e089244 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c    Fri Feb 17 11:49:11 2006
+++ b/xen/arch/x86/hvm/hvm.c    Fri Feb 17 15:29:24 2006
@@ -46,7 +46,6 @@
 #include <public/hvm/hvm_info_table.h>
 
 int hvm_enabled = 0;
-int hvm_switch_on = 0;
 
 unsigned int opt_hvm_debug_level = 0;
 integer_param("hvm_debug", opt_hvm_debug_level);
diff -r 4ca6f052cdf6 -r 6f874e089244 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Fri Feb 17 11:49:11 2006
+++ b/xen/arch/x86/hvm/svm/svm.c        Fri Feb 17 15:29:24 2006
@@ -251,13 +251,10 @@
  * are not modified once set for generic domains, we don't save them,
  * but simply reset them to the values set at percpu_traps_init().
  */
-void svm_load_msrs(struct vcpu *n)
+void svm_load_msrs(void)
 {
     struct svm_msr_state *host_state = &percpu_msr[smp_processor_id()];
     int i;
-
-    if ( !hvm_switch_on )
-        return;
 
     while ( host_state->flags )
     {
diff -r 4ca6f052cdf6 -r 6f874e089244 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Fri Feb 17 11:49:11 2006
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Fri Feb 17 15:29:24 2006
@@ -124,13 +124,10 @@
  * are not modified once set for generic domains, we don't save them,
  * but simply reset them to the values set at percpu_traps_init().
  */
-void vmx_load_msrs(struct vcpu *n)
+void vmx_load_msrs(void)
 {
     struct vmx_msr_state *host_state = &percpu_msr[smp_processor_id()];
     int i;
-
-    if ( !hvm_switch_on )
-        return;
 
     while ( host_state->flags )
     {
diff -r 4ca6f052cdf6 -r 6f874e089244 xen/include/asm-x86/hvm/hvm.h
--- a/xen/include/asm-x86/hvm/hvm.h     Fri Feb 17 11:49:11 2006
+++ b/xen/include/asm-x86/hvm/hvm.h     Fri Feb 17 15:29:24 2006
@@ -50,7 +50,7 @@
     void (*load_cpu_guest_regs)(struct vcpu *v, struct cpu_user_regs *r);
 #ifdef __x86_64__
     void (*save_segments)(struct vcpu *v);
-    void (*load_msrs)(struct vcpu *v);
+    void (*load_msrs)(void);
     void (*restore_msrs)(struct vcpu *v);
 #endif
     void (*store_cpu_guest_ctrl_regs)(struct vcpu *v, unsigned long crs[8]);
@@ -116,10 +116,10 @@
 }
 
 static inline void
-hvm_load_msrs(struct vcpu *v)
+hvm_load_msrs(void)
 {
     if (hvm_funcs.load_msrs)
-        hvm_funcs.load_msrs(v);
+        hvm_funcs.load_msrs();
 }
 
 static inline void
diff -r 4ca6f052cdf6 -r 6f874e089244 xen/include/asm-x86/hvm/support.h
--- a/xen/include/asm-x86/hvm/support.h Fri Feb 17 11:49:11 2006
+++ b/xen/include/asm-x86/hvm/support.h Fri Feb 17 15:29:24 2006
@@ -133,7 +133,6 @@
     } while (0)
 
 extern int hvm_enabled;
-extern int hvm_switch_on;
 
 enum { HVM_COPY_IN = 0, HVM_COPY_OUT };
 extern int hvm_copy(void *buf, unsigned long vaddr, int size, int dir);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
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®.