# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1291746398 0
# Node ID 98eb4a334b7723c3e515038feaddbd01cec45a3a
# Parent 70501ee741a6dccd940c1cb4481650cdc1afdcf3
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/arch/x86/cpu/common.c | 9 +++++++++
xen/arch/x86/cpu/intel.c | 9 ---------
2 files changed, 9 insertions(+), 9 deletions(-)
diff -r 70501ee741a6 -r 98eb4a334b77 xen/arch/x86/cpu/common.c
--- a/xen/arch/x86/cpu/common.c Tue Dec 07 18:24:12 2010 +0000
+++ b/xen/arch/x86/cpu/common.c Tue Dec 07 18:26:38 2010 +0000
@@ -22,6 +22,8 @@ static int disable_x86_fxsr __cpuinitdat
static int disable_x86_fxsr __cpuinitdata;
static int disable_x86_serial_nr __cpuinitdata;
+static int use_xsave;
+boolean_param("xsave", use_xsave);
unsigned int __devinitdata opt_cpuid_mask_ecx = ~0u;
integer_param("cpuid_mask_ecx", opt_cpuid_mask_ecx);
unsigned int __devinitdata opt_cpuid_mask_edx = ~0u;
@@ -404,6 +406,13 @@ void __cpuinit identify_cpu(struct cpuin
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 70501ee741a6 -r 98eb4a334b77 xen/arch/x86/cpu/intel.c
--- a/xen/arch/x86/cpu/intel.c Tue Dec 07 18:24:12 2010 +0000
+++ b/xen/arch/x86/cpu/intel.c Tue Dec 07 18:26:38 2010 +0000
@@ -20,9 +20,6 @@
extern int trap_init_f00f_bug(void);
-static int use_xsave;
-boolean_param("xsave", use_xsave);
-
#ifdef CONFIG_X86_INTEL_USERCOPY
/*
* Alignment at which movsl is preferred for bulk memory copies.
@@ -259,12 +256,6 @@ static void __devinit init_intel(struct
if ((c->cpuid_level >= 0x00000006) &&
(cpuid_eax(0x00000006) & (1u<<2)))
set_bit(X86_FEATURE_ARAT, c->x86_capability);
-
- 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
|