diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2009-08-20 11:06:25 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2009-08-31 03:35:47 -0400 |
commit | 2d826404f0bdcac2a4dd7e3c446b70d6a3b63b78 (patch) | |
tree | 7db2dc0fbde3a25a89f1fc1514152567f612ccde /arch/x86/kernel/tsc.c | |
parent | 47926214d8b2bef13b2be57c500194a804f16198 (diff) |
x86: Move tsc_calibration to x86_init_ops
TSC calibration is modified by the vmware hypervisor and paravirt by
separate means. Moorestown wants to add its own calibration routine as
well. So make calibrate_tsc a proper x86_init_ops function and
override it by paravirt or by the early setup of the vmware
hypervisor.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/tsc.c')
-rw-r--r-- | arch/x86/kernel/tsc.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 97a0bcbad100..9917632a8b49 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <asm/delay.h> | 18 | #include <asm/delay.h> |
19 | #include <asm/hypervisor.h> | 19 | #include <asm/hypervisor.h> |
20 | #include <asm/nmi.h> | 20 | #include <asm/nmi.h> |
21 | #include <asm/x86_init.h> | ||
21 | 22 | ||
22 | unsigned int __read_mostly cpu_khz; /* TSC clocks / usec, not used here */ | 23 | unsigned int __read_mostly cpu_khz; /* TSC clocks / usec, not used here */ |
23 | EXPORT_SYMBOL(cpu_khz); | 24 | EXPORT_SYMBOL(cpu_khz); |
@@ -401,15 +402,9 @@ unsigned long native_calibrate_tsc(void) | |||
401 | { | 402 | { |
402 | u64 tsc1, tsc2, delta, ref1, ref2; | 403 | u64 tsc1, tsc2, delta, ref1, ref2; |
403 | unsigned long tsc_pit_min = ULONG_MAX, tsc_ref_min = ULONG_MAX; | 404 | unsigned long tsc_pit_min = ULONG_MAX, tsc_ref_min = ULONG_MAX; |
404 | unsigned long flags, latch, ms, fast_calibrate, hv_tsc_khz; | 405 | unsigned long flags, latch, ms, fast_calibrate; |
405 | int hpet = is_hpet_enabled(), i, loopmin; | 406 | int hpet = is_hpet_enabled(), i, loopmin; |
406 | 407 | ||
407 | hv_tsc_khz = get_hypervisor_tsc_freq(); | ||
408 | if (hv_tsc_khz) { | ||
409 | printk(KERN_INFO "TSC: Frequency read from the hypervisor\n"); | ||
410 | return hv_tsc_khz; | ||
411 | } | ||
412 | |||
413 | local_irq_save(flags); | 408 | local_irq_save(flags); |
414 | fast_calibrate = quick_pit_calibrate(); | 409 | fast_calibrate = quick_pit_calibrate(); |
415 | local_irq_restore(flags); | 410 | local_irq_restore(flags); |
@@ -567,7 +562,7 @@ int recalibrate_cpu_khz(void) | |||
567 | unsigned long cpu_khz_old = cpu_khz; | 562 | unsigned long cpu_khz_old = cpu_khz; |
568 | 563 | ||
569 | if (cpu_has_tsc) { | 564 | if (cpu_has_tsc) { |
570 | tsc_khz = calibrate_tsc(); | 565 | tsc_khz = x86_platform.calibrate_tsc(); |
571 | cpu_khz = tsc_khz; | 566 | cpu_khz = tsc_khz; |
572 | cpu_data(0).loops_per_jiffy = | 567 | cpu_data(0).loops_per_jiffy = |
573 | cpufreq_scale(cpu_data(0).loops_per_jiffy, | 568 | cpufreq_scale(cpu_data(0).loops_per_jiffy, |
@@ -917,7 +912,7 @@ void __init tsc_init(void) | |||
917 | if (!cpu_has_tsc) | 912 | if (!cpu_has_tsc) |
918 | return; | 913 | return; |
919 | 914 | ||
920 | tsc_khz = calibrate_tsc(); | 915 | tsc_khz = x86_platform.calibrate_tsc(); |
921 | cpu_khz = tsc_khz; | 916 | cpu_khz = tsc_khz; |
922 | 917 | ||
923 | if (!tsc_khz) { | 918 | if (!tsc_khz) { |