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

[Xen-changelog] [xen-4.1-testing] x86: update Intel CPUID masking code to latest spec


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-4.1-testing <patchbot@xxxxxxx>
  • Date: Mon, 09 Jul 2012 15:33:08 +0000
  • Delivery-date: Mon, 09 Jul 2012 15:33:17 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxxxx>
# Date 1341825702 -3600
# Node ID b394b1f87ebcdc88aa0478a93870862bb50df040
# Parent  e8a3797e34d1b6b13cd5547e43afe08ef7d95cb1
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@xxxxxxxxxx>
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@xxxxxxxxxx>
xen-unstable changeset:   23731:48f72b389b04
xen-unstable date:        Thu Jul 21 14:34:51 2011 +0100
---


diff -r e8a3797e34d1 -r b394b1f87ebc xen/arch/x86/cpu/common.c
--- a/xen/arch/x86/cpu/common.c Mon Jul 09 10:19:15 2012 +0100
+++ b/xen/arch/x86/cpu/common.c Mon Jul 09 10:21:42 2012 +0100
@@ -27,10 +27,15 @@ boolean_param("noserialnumber", disable_
 
 static bool_t __cpuinitdata 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;
 integer_param("cpuid_mask_edx", opt_cpuid_mask_edx);
+
+unsigned int __devinitdata opt_cpuid_mask_xsave_eax = ~0u;
+integer_param("cpuid_mask_xsave_eax", opt_cpuid_mask_xsave_eax);
+
 unsigned int __devinitdata opt_cpuid_mask_ext_ecx = ~0u;
 integer_param("cpuid_mask_ext_ecx", opt_cpuid_mask_ext_ecx);
 unsigned int __devinitdata opt_cpuid_mask_ext_edx = ~0u;
diff -r e8a3797e34d1 -r b394b1f87ebc xen/arch/x86/cpu/cpu.h
--- a/xen/arch/x86/cpu/cpu.h    Mon Jul 09 10:19:15 2012 +0100
+++ b/xen/arch/x86/cpu/cpu.h    Mon Jul 09 10:21:42 2012 +0100
@@ -22,6 +22,7 @@ struct cpu_dev {
 extern struct cpu_dev * cpu_devs [X86_VENDOR_NUM];
 
 extern unsigned int opt_cpuid_mask_ecx, opt_cpuid_mask_edx;
+extern unsigned int opt_cpuid_mask_xsave_eax;
 extern unsigned int opt_cpuid_mask_ext_ecx, opt_cpuid_mask_ext_edx;
 
 extern int get_model_name(struct cpuinfo_x86 *c);
diff -r e8a3797e34d1 -r b394b1f87ebc xen/arch/x86/cpu/intel.c
--- a/xen/arch/x86/cpu/intel.c  Mon Jul 09 10:19:15 2012 +0100
+++ b/xen/arch/x86/cpu/intel.c  Mon Jul 09 10:21:42 2012 +0100
@@ -59,10 +59,12 @@ void set_cpuid_faulting(bool_t enable)
  */
 static void __devinit set_cpuidmask(const struct cpuinfo_x86 *c)
 {
+       u32 eax, edx;
        const char *extra = "";
 
        if (!~(opt_cpuid_mask_ecx & opt_cpuid_mask_edx &
-              opt_cpuid_mask_ext_ecx & opt_cpuid_mask_ext_edx))
+              opt_cpuid_mask_ext_ecx & opt_cpuid_mask_ext_edx &
+               opt_cpuid_mask_xsave_eax))
                return;
 
        /* Only family 6 supports this feature  */
@@ -75,7 +77,11 @@ static void __devinit set_cpuidmask(cons
                wrmsr(MSR_INTEL_CPUID_FEATURE_MASK,
                      opt_cpuid_mask_ecx,
                      opt_cpuid_mask_edx);
-               if (!~(opt_cpuid_mask_ext_ecx & opt_cpuid_mask_ext_edx))
+               if (~(opt_cpuid_mask_ext_ecx & opt_cpuid_mask_ext_edx))
+                       extra = "extended ";
+               else if (~opt_cpuid_mask_xsave_eax)
+                       extra = "xsave ";
+               else
                        return;
                extra = "extended ";
                break;
@@ -97,11 +103,25 @@ static void __devinit set_cpuidmask(cons
                wrmsr(MSR_INTEL_CPUID80000001_FEATURE_MASK,
                      opt_cpuid_mask_ext_ecx,
                      opt_cpuid_mask_ext_edx);
+               if (!~opt_cpuid_mask_xsave_eax)
+                       return;
+               extra = "xsave ";
+               break;
+       case 0x2a:
+               wrmsr(MSR_INTEL_CPUID1_FEATURE_MASK_V2,
+                     opt_cpuid_mask_ecx,
+                     opt_cpuid_mask_edx);
+               rdmsr(MSR_INTEL_CPUIDD_01_FEATURE_MASK, eax, edx);
+               wrmsr(MSR_INTEL_CPUIDD_01_FEATURE_MASK,
+                     opt_cpuid_mask_xsave_eax, edx);
+               wrmsr(MSR_INTEL_CPUID80000001_FEATURE_MASK_V2,
+                     opt_cpuid_mask_ext_ecx,
+                     opt_cpuid_mask_ext_edx);
                return;
        }
 
-       printk(XENLOG_ERR "Cannot set CPU feature mask on CPU#%d\n",
-              smp_processor_id());
+       printk(XENLOG_ERR "Cannot set CPU %sfeature mask on CPU#%d\n",
+              extra, smp_processor_id());
 }
 
 void __devinit early_intel_workaround(struct cpuinfo_x86 *c)
diff -r e8a3797e34d1 -r b394b1f87ebc xen/include/asm-x86/msr-index.h
--- a/xen/include/asm-x86/msr-index.h   Mon Jul 09 10:19:15 2012 +0100
+++ b/xen/include/asm-x86/msr-index.h   Mon Jul 09 10:21:42 2012 +0100
@@ -495,6 +495,10 @@
 #define MSR_INTEL_CPUID1_FEATURE_MASK  0x00000130
 #define MSR_INTEL_CPUID80000001_FEATURE_MASK 0x00000131
 
+#define MSR_INTEL_CPUID1_FEATURE_MASK_V2        0x00000132
+#define MSR_INTEL_CPUID80000001_FEATURE_MASK_V2 0x00000133
+#define MSR_INTEL_CPUIDD_01_FEATURE_MASK        0x00000134
+
 /* Intel cpuid faulting MSRs */
 #define MSR_INTEL_PLATFORM_INFO                0x000000ce
 #define MSR_INTEL_MISC_FEATURES_ENABLES        0x00000140

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
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®.