summaryrefslogtreecommitdiffstats
path: root/arch/i386/kernel/vmitime.c
diff options
context:
space:
mode:
authorZachary Amsden <zach@vmware.com>2007-03-05 00:30:36 -0800
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-03-05 07:57:52 -0800
commit1182d8528b620c23d043bccbbef092b42062960a (patch)
tree3df690a1a731811f8fecda06cb785a5a7b06d4d0 /arch/i386/kernel/vmitime.c
parent6cb9a8350aee789100a365794272ed20cc8f2401 (diff)
downloadblackbird-op-linux-1182d8528b620c23d043bccbbef092b42062960a.tar.gz
blackbird-op-linux-1182d8528b620c23d043bccbbef092b42062960a.zip
[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 'arch/i386/kernel/vmitime.c')
-rw-r--r--arch/i386/kernel/vmitime.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/arch/i386/kernel/vmitime.c b/arch/i386/kernel/vmitime.c
index f2aa8fab8c02..4bb218e2eb14 100644
--- a/arch/i386/kernel/vmitime.c
+++ b/arch/i386/kernel/vmitime.c
@@ -177,6 +177,15 @@ unsigned long long vmi_get_sched_cycles(void)
return read_available_cycles();
}
+unsigned long vmi_cpu_khz(void)
+{
+ unsigned long long khz;
+
+ khz = vmi_timer_ops.get_cycle_frequency();
+ (void)do_div(khz, 1000);
+ return khz;
+}
+
void __init vmi_time_init(void)
{
unsigned long long cycles_per_sec, cycles_per_msec;
@@ -206,7 +215,6 @@ void __init vmi_time_init(void)
(void)do_div(cycles_per_alarm, alarm_hz);
cycles_per_msec = cycles_per_sec;
(void)do_div(cycles_per_msec, 1000);
- cpu_khz = cycles_per_msec;
printk(KERN_WARNING "VMI timer cycles/sec = %llu ; cycles/jiffy = %llu ;"
"cycles/alarm = %llu\n", cycles_per_sec, cycles_per_jiffy,
OpenPOWER on IntegriCloud