]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/suse-2.6.27.25/patches.arch/x86-vmware-tsc-06-fix-vmware_get_tsc
Reenabled linux-xen and xen-image build
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.arch / x86-vmware-tsc-06-fix-vmware_get_tsc
CommitLineData
00e5a55c
BS
1From: Alok Kataria <akataria@vmware.com>
2Subject: x86: VMware: Fix vmware_get_tsc code
3Patch-mainline:
4References: bnc#441338
5
6Impact: Fix possible failure to calibrate the TSC on Vmware near 4 GHz
7
8The current version of the code to get the tsc frequency from
9the VMware hypervisor, will be broken on processor with frequency
10(4G-1) HZ, because on such processors eax will have UINT_MAX
11and that would be legitimate.
12We instead check that EBX did change to decide if we were able to
13read the frequency from the hypervisor.
14
15Signed-off-by: Alok N Kataria <akataria@vmware.com>
16Signed-off-by: H. Peter Anvin <hpa@zytor.com>
17Signed-off-by: Takashi Iwai <tiwai@suse.de>
18
19---
20
21 arch/x86/kernel/cpu/vmware.c | 4 ++--
22 1 files changed, 2 insertions(+), 2 deletions(-)
23
24
25diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c
26index 2ac4394..a0905ec 100644
27--- a/arch/x86/kernel/cpu/vmware.c
28+++ b/arch/x86/kernel/cpu/vmware.c
29@@ -36,7 +36,7 @@
30 "=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) : \
31 "0"(VMWARE_HYPERVISOR_MAGIC), \
32 "1"(VMWARE_PORT_CMD_##cmd), \
33- "2"(VMWARE_HYPERVISOR_PORT), "3"(0) : \
34+ "2"(VMWARE_HYPERVISOR_PORT), "3"(UINT_MAX) : \
35 "memory");
36
37 static inline int __vmware_platform(void)
38@@ -53,7 +53,7 @@ static unsigned long __vmware_get_tsc_khz(void)
39
40 VMWARE_PORT(GETHZ, eax, ebx, ecx, edx);
41
42- if (eax == (uint32_t)-1)
43+ if (ebx == UINT_MAX)
44 return 0;
45 tsc_hz = eax | (((uint64_t)ebx) << 32);
46 do_div(tsc_hz, 1000);