HVM: Support XSAVE/XRSTOR and AVX for AMD CPUs
PATCH 1/3 HVM: Support XSAVE/XRSTOR and AVX for AMD CPUs
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 <[email protected]>
xen/arch/x86/cpu/common.c +9 -0
@@ -22,6 +22,8 @@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 @@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);
xen/arch/x86/cpu/intel.c +0 -9
@@ -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 @@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-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel