Commit 82d64699 authored by Jeremy Fitzhardinge's avatar Jeremy Fitzhardinge

xen: mask extended topology info in cpuid

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: default avatarJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: Stable Kernel <stable@kernel.org>
parent 7825cf10
...@@ -178,6 +178,7 @@ static __read_mostly unsigned int cpuid_leaf1_ecx_mask = ~0; ...@@ -178,6 +178,7 @@ static __read_mostly unsigned int cpuid_leaf1_ecx_mask = ~0;
static void xen_cpuid(unsigned int *ax, unsigned int *bx, static void xen_cpuid(unsigned int *ax, unsigned int *bx,
unsigned int *cx, unsigned int *dx) unsigned int *cx, unsigned int *dx)
{ {
unsigned maskebx = ~0;
unsigned maskecx = ~0; unsigned maskecx = ~0;
unsigned maskedx = ~0; unsigned maskedx = ~0;
...@@ -185,9 +186,16 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx, ...@@ -185,9 +186,16 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx,
* Mask out inconvenient features, to try and disable as many * Mask out inconvenient features, to try and disable as many
* unsupported kernel subsystems as possible. * unsupported kernel subsystems as possible.
*/ */
if (*ax == 1) { switch (*ax) {
case 1:
maskecx = cpuid_leaf1_ecx_mask; maskecx = cpuid_leaf1_ecx_mask;
maskedx = cpuid_leaf1_edx_mask; maskedx = cpuid_leaf1_edx_mask;
break;
case 0xb:
/* Suppress extended topology stuff */
maskebx = 0;
break;
} }
asm(XEN_EMULATE_PREFIX "cpuid" asm(XEN_EMULATE_PREFIX "cpuid"
...@@ -197,6 +205,7 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx, ...@@ -197,6 +205,7 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx,
"=d" (*dx) "=d" (*dx)
: "0" (*ax), "2" (*cx)); : "0" (*ax), "2" (*cx));
*bx &= maskebx;
*cx &= maskecx; *cx &= maskecx;
*dx &= maskedx; *dx &= maskedx;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment