]> xenbits.xensource.com Git - xen.git/commitdiff
amd xsave: Move xsave initialization code to a common place
authorWei Huang <wei.huang2@amd.com>
Tue, 25 Oct 2011 15:44:40 +0000 (16:44 +0100)
committerWei Huang <wei.huang2@amd.com>
Tue, 25 Oct 2011 15:44:40 +0000 (16:44 +0100)
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@amd.com>
xen-unstable changeset:   22462:98eb4a334b77
xen-unstable date:        Tue Dec 07 18:26:38 2010 +0000

xen/arch/x86/cpu/common.c
xen/arch/x86/cpu/intel.c

index 87d1a50c64444e1f0c5e2885876ddb7ba11a5c1f..eda7534c1c3e2d8ca5a345b371e3e7bec0946ffa 100644 (file)
@@ -22,6 +22,9 @@ static int cachesize_override __cpuinitdata = -1;
 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 @@ void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
        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);
 
index 1f3fcf73935ecf32868a0f17fbaed0bc3c405a91..8f19b1ce209a3d3d3c56eb377538d7ae7afec63d 100644 (file)
@@ -30,9 +30,6 @@ static unsigned int opt_cpuid_mask_ecx, opt_cpuid_mask_edx;
 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 @@ static void __devinit init_intel(struct cpuinfo_x86 *c)
                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();
 }