aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-i386/tsc.h
diff options
context:
space:
mode:
authorAndres Salomon <dilinger@debian.org>2007-03-06 04:42:05 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-03-06 12:30:24 -0500
commit2272b0e03ea5731aca058eaf79c9955b36f0c083 (patch)
treee4563e3d3d72566d2c5023dec111c398d2f91cc6 /include/asm-i386/tsc.h
parente585047ef97b4002a7f416b0ca01ab894f7755de (diff)
[PATCH] i386: make x86_64 tsc header require i386 rather than vice-versa
Prior to commit 95492e4646e5de8b43d9a7908d6177fb737b61f0 ([PATCH] x86: rewrite SMP TSC sync code), the headers in asm-i386 did not really require anything in include/asm-x86_64. This means that distributions such as fedora did not include asm-x86_64 in kernel-devel headers for i386. Ingo's commit changed that, and broke things. This is easy enough to hack around in package builds by just including asm-x86_64 on i386, but that's kind of annoying. If anything, x86_64 should depend upon i386, not the other way around. This patch changes it so that asm-x86_64/tsc.h includes asm-i386/tsc.h, rather than vice-versa. Signed-off-by: Andres Salomon <dilinger@debian.org> Acked-by: Ingo Molnar <mingo@elte.hu> Cc: Andi Kleen <ak@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/asm-i386/tsc.h')
-rw-r--r--include/asm-i386/tsc.h68
1 files changed, 67 insertions, 1 deletions
diff --git a/include/asm-i386/tsc.h b/include/asm-i386/tsc.h
index e997891cc7cc..84016ff481b9 100644
--- a/include/asm-i386/tsc.h
+++ b/include/asm-i386/tsc.h
@@ -1 +1,67 @@
1#include <asm-x86_64/tsc.h> 1/*
2 * linux/include/asm-i386/tsc.h
3 *
4 * i386 TSC related functions
5 */
6#ifndef _ASM_i386_TSC_H
7#define _ASM_i386_TSC_H
8
9#include <asm/processor.h>
10
11/*
12 * Standard way to access the cycle counter.
13 */
14typedef unsigned long long cycles_t;
15
16extern unsigned int cpu_khz;
17extern unsigned int tsc_khz;
18
19static inline cycles_t get_cycles(void)
20{
21 unsigned long long ret = 0;
22
23#ifndef CONFIG_X86_TSC
24 if (!cpu_has_tsc)
25 return 0;
26#endif
27
28#if defined(CONFIG_X86_GENERIC) || defined(CONFIG_X86_TSC)
29 rdtscll(ret);
30#endif
31 return ret;
32}
33
34/* Like get_cycles, but make sure the CPU is synchronized. */
35static __always_inline cycles_t get_cycles_sync(void)
36{
37 unsigned long long ret;
38#ifdef X86_FEATURE_SYNC_RDTSC
39 unsigned eax;
40
41 /*
42 * Don't do an additional sync on CPUs where we know
43 * RDTSC is already synchronous:
44 */
45 alternative_io("cpuid", ASM_NOP2, X86_FEATURE_SYNC_RDTSC,
46 "=a" (eax), "0" (1) : "ebx","ecx","edx","memory");
47#else
48 sync_core();
49#endif
50 rdtscll(ret);
51
52 return ret;
53}
54
55extern void tsc_init(void);
56extern void mark_tsc_unstable(void);
57extern int unsynchronized_tsc(void);
58extern void init_tsc_clocksource(void);
59
60/*
61 * Boot-time check whether the TSCs are synchronized across
62 * all CPUs/cores:
63 */
64extern void check_tsc_sync_source(int cpu);
65extern void check_tsc_sync_target(void);
66
67#endif