aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/tsc.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/tsc.c')
-rw-r--r--arch/x86/kernel/tsc.c13
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
22unsigned int __read_mostly cpu_khz; /* TSC clocks / usec, not used here */ 23unsigned int __read_mostly cpu_khz; /* TSC clocks / usec, not used here */
23EXPORT_SYMBOL(cpu_khz); 24EXPORT_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) {