]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
xen: mask extended topology info in cpuid
authorJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Thu, 22 Oct 2009 23:41:15 +0000 (16:41 -0700)
committerJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Tue, 3 Nov 2009 19:09:12 +0000 (11:09 -0800)
A Xen guest never needs to know about extended topology, and knowing
would just confuse it.

This patch just zeros ebx in leaf 0xb which indicates no topology info,
preventing a crash under Xen on cpus which support this leaf.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: Stable Kernel <stable@kernel.org>
arch/x86/xen/enlighten.c

index 23a4d80fb39e80a496bcd847e5de6d0886255fc3..dfbf70e65860dc768c255e07ac5d2c2b63e3a159 100644 (file)
@@ -178,6 +178,7 @@ static __read_mostly unsigned int cpuid_leaf1_ecx_mask = ~0;
 static void xen_cpuid(unsigned int *ax, unsigned int *bx,
                      unsigned int *cx, unsigned int *dx)
 {
+       unsigned maskebx = ~0;
        unsigned maskecx = ~0;
        unsigned maskedx = ~0;
 
@@ -185,9 +186,16 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx,
         * Mask out inconvenient features, to try and disable as many
         * unsupported kernel subsystems as possible.
         */
-       if (*ax == 1) {
+       switch (*ax) {
+       case 1:
                maskecx = cpuid_leaf1_ecx_mask;
                maskedx = cpuid_leaf1_edx_mask;
+               break;
+
+       case 0xb:
+               /* Suppress extended topology stuff */
+               maskebx = 0;
+               break;
        }
 
        asm(XEN_EMULATE_PREFIX "cpuid"
@@ -197,6 +205,7 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx,
                  "=d" (*dx)
                : "0" (*ax), "2" (*cx));
 
+       *bx &= maskebx;
        *cx &= maskecx;
        *dx &= maskedx;
 }