diff options
author | Zachary Amsden <zach@vmware.com> | 2007-03-05 03:30:36 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-03-05 10:57:52 -0500 |
commit | 1182d8528b620c23d043bccbbef092b42062960a (patch) | |
tree | 3df690a1a731811f8fecda06cb785a5a7b06d4d0 /include | |
parent | 6cb9a8350aee789100a365794272ed20cc8f2401 (diff) |
[PATCH] vmi: cpu cycles fix
In order to share the common code in tsc.c which does CPU Khz calibration, we
need to make an accurate value of CPU speed available to the tsc.c code. This
value loses a lot of precision in a VM because of the timing differences with
real hardware, but we need it to be as precise as possible so the guest can
make accurate time calculations with the cycle counters.
Signed-off-by: Zachary Amsden <zach@vmware.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-i386/paravirt.h | 2 | ||||
-rw-r--r-- | include/asm-i386/timer.h | 2 | ||||
-rw-r--r-- | include/asm-i386/vmi_time.h | 1 |
3 files changed, 5 insertions, 0 deletions
diff --git a/include/asm-i386/paravirt.h b/include/asm-i386/paravirt.h index a13230254f4f..a35c81480654 100644 --- a/include/asm-i386/paravirt.h +++ b/include/asm-i386/paravirt.h | |||
@@ -95,6 +95,7 @@ struct paravirt_ops | |||
95 | u64 (*read_tsc)(void); | 95 | u64 (*read_tsc)(void); |
96 | u64 (*read_pmc)(void); | 96 | u64 (*read_pmc)(void); |
97 | u64 (*get_scheduled_cycles)(void); | 97 | u64 (*get_scheduled_cycles)(void); |
98 | unsigned long (*get_cpu_khz)(void); | ||
98 | 99 | ||
99 | void (*load_tr_desc)(void); | 100 | void (*load_tr_desc)(void); |
100 | void (*load_gdt)(const struct Xgt_desc_struct *); | 101 | void (*load_gdt)(const struct Xgt_desc_struct *); |
@@ -275,6 +276,7 @@ static inline void halt(void) | |||
275 | #define rdtscll(val) (val = paravirt_ops.read_tsc()) | 276 | #define rdtscll(val) (val = paravirt_ops.read_tsc()) |
276 | 277 | ||
277 | #define get_scheduled_cycles(val) (val = paravirt_ops.get_scheduled_cycles()) | 278 | #define get_scheduled_cycles(val) (val = paravirt_ops.get_scheduled_cycles()) |
279 | #define calculate_cpu_khz() (paravirt_ops.get_cpu_khz()) | ||
278 | 280 | ||
279 | #define write_tsc(val1,val2) wrmsr(0x10, val1, val2) | 281 | #define write_tsc(val1,val2) wrmsr(0x10, val1, val2) |
280 | 282 | ||
diff --git a/include/asm-i386/timer.h b/include/asm-i386/timer.h index d1f7b4f575b4..12dd67bf760f 100644 --- a/include/asm-i386/timer.h +++ b/include/asm-i386/timer.h | |||
@@ -7,6 +7,7 @@ | |||
7 | 7 | ||
8 | void setup_pit_timer(void); | 8 | void setup_pit_timer(void); |
9 | unsigned long long native_sched_clock(void); | 9 | unsigned long long native_sched_clock(void); |
10 | unsigned long native_calculate_cpu_khz(void); | ||
10 | 11 | ||
11 | /* Modifiers for buggy PIT handling */ | 12 | /* Modifiers for buggy PIT handling */ |
12 | extern int pit_latch_buggy; | 13 | extern int pit_latch_buggy; |
@@ -17,6 +18,7 @@ extern int recalibrate_cpu_khz(void); | |||
17 | 18 | ||
18 | #ifndef CONFIG_PARAVIRT | 19 | #ifndef CONFIG_PARAVIRT |
19 | #define get_scheduled_cycles(val) rdtscll(val) | 20 | #define get_scheduled_cycles(val) rdtscll(val) |
21 | #define calculate_cpu_khz() native_calculate_cpu_khz() | ||
20 | #endif | 22 | #endif |
21 | 23 | ||
22 | #endif | 24 | #endif |
diff --git a/include/asm-i386/vmi_time.h b/include/asm-i386/vmi_time.h index f59c35d37352..1f971eb7f71e 100644 --- a/include/asm-i386/vmi_time.h +++ b/include/asm-i386/vmi_time.h | |||
@@ -50,6 +50,7 @@ extern void __init vmi_time_init(void); | |||
50 | extern unsigned long vmi_get_wallclock(void); | 50 | extern unsigned long vmi_get_wallclock(void); |
51 | extern int vmi_set_wallclock(unsigned long now); | 51 | extern int vmi_set_wallclock(unsigned long now); |
52 | extern unsigned long long vmi_get_sched_cycles(void); | 52 | extern unsigned long long vmi_get_sched_cycles(void); |
53 | extern unsigned long vmi_cpu_khz(void); | ||
53 | 54 | ||
54 | #ifdef CONFIG_X86_LOCAL_APIC | 55 | #ifdef CONFIG_X86_LOCAL_APIC |
55 | extern void __init vmi_timer_setup_boot_alarm(void); | 56 | extern void __init vmi_timer_setup_boot_alarm(void); |