diff options
author | Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> | 2009-10-22 19:41:15 -0400 |
---|---|---|
committer | Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> | 2009-11-03 14:09:12 -0500 |
commit | 82d6469916c6fcfa345636a49004c9d1753905d1 (patch) | |
tree | f4d95a9159234b66d26e4e8ebe661e105929234b | |
parent | 7825cf10e31c64ece3cac66fb01a742f1094da51 (diff) |
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: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: Stable Kernel <stable@kernel.org>
-rw-r--r-- | arch/x86/xen/enlighten.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 23a4d80fb39e..dfbf70e65860 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -178,6 +178,7 @@ static __read_mostly unsigned int cpuid_leaf1_ecx_mask = ~0; | |||
178 | static void xen_cpuid(unsigned int *ax, unsigned int *bx, | 178 | static void xen_cpuid(unsigned int *ax, unsigned int *bx, |
179 | unsigned int *cx, unsigned int *dx) | 179 | unsigned int *cx, unsigned int *dx) |
180 | { | 180 | { |
181 | unsigned maskebx = ~0; | ||
181 | unsigned maskecx = ~0; | 182 | unsigned maskecx = ~0; |
182 | unsigned maskedx = ~0; | 183 | unsigned maskedx = ~0; |
183 | 184 | ||
@@ -185,9 +186,16 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx, | |||
185 | * Mask out inconvenient features, to try and disable as many | 186 | * Mask out inconvenient features, to try and disable as many |
186 | * unsupported kernel subsystems as possible. | 187 | * unsupported kernel subsystems as possible. |
187 | */ | 188 | */ |
188 | if (*ax == 1) { | 189 | switch (*ax) { |
190 | case 1: | ||
189 | maskecx = cpuid_leaf1_ecx_mask; | 191 | maskecx = cpuid_leaf1_ecx_mask; |
190 | maskedx = cpuid_leaf1_edx_mask; | 192 | maskedx = cpuid_leaf1_edx_mask; |
193 | break; | ||
194 | |||
195 | case 0xb: | ||
196 | /* Suppress extended topology stuff */ | ||
197 | maskebx = 0; | ||
198 | break; | ||
191 | } | 199 | } |
192 | 200 | ||
193 | asm(XEN_EMULATE_PREFIX "cpuid" | 201 | asm(XEN_EMULATE_PREFIX "cpuid" |
@@ -197,6 +205,7 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx, | |||
197 | "=d" (*dx) | 205 | "=d" (*dx) |
198 | : "0" (*ax), "2" (*cx)); | 206 | : "0" (*ax), "2" (*cx)); |
199 | 207 | ||
208 | *bx &= maskebx; | ||
200 | *cx &= maskecx; | 209 | *cx &= maskecx; |
201 | *dx &= maskedx; | 210 | *dx &= maskedx; |
202 | } | 211 | } |