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

[Xen-changelog] [xen-4.0-testing] amd xsave: Move xsave initialization code to a common place



# HG changeset patch
# User Wei Huang <wei.huang2@xxxxxxx>
# Date 1319557480 -3600
# Node ID a5cc3b953ed99f61a2cfbef72a9f8befdfa49a24
# Parent  da9f945b3db87567bcc7b7c031a4a9c1975e0dcd
amd xsave: Move xsave initialization code to a common place

This patch moves xsave/xrstor code to CPU common file. First of all,
it prepares xsave/xrstor support for AMD CPUs. Secondly, Xen would
crash on __context_switch() without this patch on xsave-capable AMD
CPUs. The crash was due to cpu_has_xsave reports true in domain.c
while xsave space wasn't initialized.

Signed-off-by: Wei Huang <wei.huang2@xxxxxxx>
xen-unstable changeset:   22462:98eb4a334b77
xen-unstable date:        Tue Dec 07 18:26:38 2010 +0000
---


diff -r da9f945b3db8 -r a5cc3b953ed9 xen/arch/x86/cpu/common.c
--- a/xen/arch/x86/cpu/common.c Mon Oct 24 18:04:42 2011 +0100
+++ b/xen/arch/x86/cpu/common.c Tue Oct 25 16:44:40 2011 +0100
@@ -22,6 +22,9 @@
 static int disable_x86_fxsr __cpuinitdata;
 static int disable_x86_serial_nr __cpuinitdata;
 
+static int use_xsave;
+boolean_param("xsave", use_xsave);
+
 struct cpu_dev * cpu_devs[X86_VENDOR_NUM] = {};
 
 /*
@@ -391,6 +394,13 @@
        if (this_cpu->c_init)
                this_cpu->c_init(c);
 
+        /* Initialize xsave/xrstor features */
+       if ( !use_xsave )
+               clear_bit(X86_FEATURE_XSAVE, boot_cpu_data.x86_capability);
+
+       if ( cpu_has_xsave )
+               xsave_init();
+
        /* Disable the PN if appropriate */
        squash_the_stupid_serial_number(c);
 
diff -r da9f945b3db8 -r a5cc3b953ed9 xen/arch/x86/cpu/intel.c
--- a/xen/arch/x86/cpu/intel.c  Mon Oct 24 18:04:42 2011 +0100
+++ b/xen/arch/x86/cpu/intel.c  Tue Oct 25 16:44:40 2011 +0100
@@ -30,9 +30,6 @@
 integer_param("cpuid_mask_ecx", opt_cpuid_mask_ecx);
 integer_param("cpuid_mask_edx", opt_cpuid_mask_edx);
 
-static int use_xsave;
-boolean_param("xsave", use_xsave);
-
 #ifdef CONFIG_X86_INTEL_USERCOPY
 /*
  * Alignment at which movsl is preferred for bulk memory copies.
@@ -219,12 +216,6 @@
                set_bit(X86_FEATURE_ARAT, c->x86_capability);
 
        start_vmx();
-
-       if ( !use_xsave )
-               clear_bit(X86_FEATURE_XSAVE, boot_cpu_data.x86_capability);
-
-       if ( cpu_has_xsave )
-               xsave_init();
 }
 
 

_______________________________________________
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®.