xcp-1.6-updates/xen-4.1.hg

changeset 23312:b394b1f87ebc

x86: update Intel CPUID masking code to latest spec

..., which adds masking of the xsave feature leaf.

Also add back (and fix to actually make it do what it was supposed to
do from the beginning) the printing of what specific masking couldn't
be done in case the user requested something the hardware doesn't
support.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
xen-unstable changeset: 23726:fd97ca086df6
xen-unstable date: Tue Jul 19 14:14:51 2011 +0100

x86: add change missing in c/s 23726:fd97ca086df6

The early "do we need to do anything" check needs adjustment, too.
Thanks to Haitao Shan for pointing this out.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
xen-unstable changeset: 23731:48f72b389b04
xen-unstable date: Thu Jul 21 14:34:51 2011 +0100
author Jan Beulich <jbeulich@novell.com>
date Mon Jul 09 10:21:42 2012 +0100 (2012-07-09)
parents e8a3797e34d1
children 9fe2a77b740d
files xen/arch/x86/cpu/common.c xen/arch/x86/cpu/cpu.h xen/arch/x86/cpu/intel.c xen/include/asm-x86/msr-index.h
line diff
     1.1 --- a/xen/arch/x86/cpu/common.c	Mon Jul 09 10:19:15 2012 +0100
     1.2 +++ b/xen/arch/x86/cpu/common.c	Mon Jul 09 10:21:42 2012 +0100
     1.3 @@ -27,10 +27,15 @@ boolean_param("noserialnumber", disable_
     1.4  
     1.5  static bool_t __cpuinitdata use_xsave;
     1.6  boolean_param("xsave", use_xsave);
     1.7 +
     1.8  unsigned int __devinitdata opt_cpuid_mask_ecx = ~0u;
     1.9  integer_param("cpuid_mask_ecx", opt_cpuid_mask_ecx);
    1.10  unsigned int __devinitdata opt_cpuid_mask_edx = ~0u;
    1.11  integer_param("cpuid_mask_edx", opt_cpuid_mask_edx);
    1.12 +
    1.13 +unsigned int __devinitdata opt_cpuid_mask_xsave_eax = ~0u;
    1.14 +integer_param("cpuid_mask_xsave_eax", opt_cpuid_mask_xsave_eax);
    1.15 +
    1.16  unsigned int __devinitdata opt_cpuid_mask_ext_ecx = ~0u;
    1.17  integer_param("cpuid_mask_ext_ecx", opt_cpuid_mask_ext_ecx);
    1.18  unsigned int __devinitdata opt_cpuid_mask_ext_edx = ~0u;
     2.1 --- a/xen/arch/x86/cpu/cpu.h	Mon Jul 09 10:19:15 2012 +0100
     2.2 +++ b/xen/arch/x86/cpu/cpu.h	Mon Jul 09 10:21:42 2012 +0100
     2.3 @@ -22,6 +22,7 @@ struct cpu_dev {
     2.4  extern struct cpu_dev * cpu_devs [X86_VENDOR_NUM];
     2.5  
     2.6  extern unsigned int opt_cpuid_mask_ecx, opt_cpuid_mask_edx;
     2.7 +extern unsigned int opt_cpuid_mask_xsave_eax;
     2.8  extern unsigned int opt_cpuid_mask_ext_ecx, opt_cpuid_mask_ext_edx;
     2.9  
    2.10  extern int get_model_name(struct cpuinfo_x86 *c);
     3.1 --- a/xen/arch/x86/cpu/intel.c	Mon Jul 09 10:19:15 2012 +0100
     3.2 +++ b/xen/arch/x86/cpu/intel.c	Mon Jul 09 10:21:42 2012 +0100
     3.3 @@ -59,10 +59,12 @@ void set_cpuid_faulting(bool_t enable)
     3.4   */
     3.5  static void __devinit set_cpuidmask(const struct cpuinfo_x86 *c)
     3.6  {
     3.7 +	u32 eax, edx;
     3.8  	const char *extra = "";
     3.9  
    3.10  	if (!~(opt_cpuid_mask_ecx & opt_cpuid_mask_edx &
    3.11 -	       opt_cpuid_mask_ext_ecx & opt_cpuid_mask_ext_edx))
    3.12 +	       opt_cpuid_mask_ext_ecx & opt_cpuid_mask_ext_edx &
    3.13 +               opt_cpuid_mask_xsave_eax))
    3.14  		return;
    3.15  
    3.16  	/* Only family 6 supports this feature  */
    3.17 @@ -75,7 +77,11 @@ static void __devinit set_cpuidmask(cons
    3.18  		wrmsr(MSR_INTEL_CPUID_FEATURE_MASK,
    3.19  		      opt_cpuid_mask_ecx,
    3.20  		      opt_cpuid_mask_edx);
    3.21 -		if (!~(opt_cpuid_mask_ext_ecx & opt_cpuid_mask_ext_edx))
    3.22 +		if (~(opt_cpuid_mask_ext_ecx & opt_cpuid_mask_ext_edx))
    3.23 +			extra = "extended ";
    3.24 +		else if (~opt_cpuid_mask_xsave_eax)
    3.25 +			extra = "xsave ";
    3.26 +		else
    3.27  			return;
    3.28  		extra = "extended ";
    3.29  		break;
    3.30 @@ -97,11 +103,25 @@ static void __devinit set_cpuidmask(cons
    3.31  		wrmsr(MSR_INTEL_CPUID80000001_FEATURE_MASK,
    3.32  		      opt_cpuid_mask_ext_ecx,
    3.33  		      opt_cpuid_mask_ext_edx);
    3.34 +		if (!~opt_cpuid_mask_xsave_eax)
    3.35 +			return;
    3.36 +		extra = "xsave ";
    3.37 +		break;
    3.38 +	case 0x2a:
    3.39 +		wrmsr(MSR_INTEL_CPUID1_FEATURE_MASK_V2,
    3.40 +		      opt_cpuid_mask_ecx,
    3.41 +		      opt_cpuid_mask_edx);
    3.42 +		rdmsr(MSR_INTEL_CPUIDD_01_FEATURE_MASK, eax, edx);
    3.43 +		wrmsr(MSR_INTEL_CPUIDD_01_FEATURE_MASK,
    3.44 +		      opt_cpuid_mask_xsave_eax, edx);
    3.45 +		wrmsr(MSR_INTEL_CPUID80000001_FEATURE_MASK_V2,
    3.46 +		      opt_cpuid_mask_ext_ecx,
    3.47 +		      opt_cpuid_mask_ext_edx);
    3.48  		return;
    3.49  	}
    3.50  
    3.51 -	printk(XENLOG_ERR "Cannot set CPU feature mask on CPU#%d\n",
    3.52 -	       smp_processor_id());
    3.53 +	printk(XENLOG_ERR "Cannot set CPU %sfeature mask on CPU#%d\n",
    3.54 +	       extra, smp_processor_id());
    3.55  }
    3.56  
    3.57  void __devinit early_intel_workaround(struct cpuinfo_x86 *c)
     4.1 --- a/xen/include/asm-x86/msr-index.h	Mon Jul 09 10:19:15 2012 +0100
     4.2 +++ b/xen/include/asm-x86/msr-index.h	Mon Jul 09 10:21:42 2012 +0100
     4.3 @@ -495,6 +495,10 @@
     4.4  #define MSR_INTEL_CPUID1_FEATURE_MASK	0x00000130
     4.5  #define MSR_INTEL_CPUID80000001_FEATURE_MASK 0x00000131
     4.6  
     4.7 +#define MSR_INTEL_CPUID1_FEATURE_MASK_V2        0x00000132
     4.8 +#define MSR_INTEL_CPUID80000001_FEATURE_MASK_V2 0x00000133
     4.9 +#define MSR_INTEL_CPUIDD_01_FEATURE_MASK        0x00000134
    4.10 +
    4.11  /* Intel cpuid faulting MSRs */
    4.12  #define MSR_INTEL_PLATFORM_INFO		0x000000ce
    4.13  #define MSR_INTEL_MISC_FEATURES_ENABLES	0x00000140