diff options
author | Bin Gao <bin.gao@linux.intel.com> | 2016-11-15 15:27:22 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2016-11-18 04:58:30 -0500 |
commit | 4ca4df0b7eb06df264b2919759957f6d6ea1822e (patch) | |
tree | b0a209d16b86caed81f2454d13839020ef65c25a | |
parent | 47c95a46d0fae07762f0a38aa3709ae63f307048 (diff) |
x86/tsc: Mark TSC frequency determined by CPUID as known
CPUs/SoCs with CPUID leaf 0x15 come with a known frequency and will report
the frequency to software via CPUID instruction. This hardware provided
frequency is the "real" frequency of TSC.
Set the X86_FEATURE_TSC_KNOWN_FREQ flag for such systems to skip the
software calibration process.
A 24 hours test on one of the CPUID 0x15 capable platforms was
conducted. PIT calibrated frequency resulted in more than 3 seconds drift
whereas the CPUID determined frequency showed less than 0.5 second
drift.
Signed-off-by: Bin Gao <bin.gao@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1479241644-234277-3-git-send-email-bin.gao@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | arch/x86/kernel/tsc.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index d2c4ee4e4866..e58c31959666 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c | |||
@@ -702,6 +702,13 @@ unsigned long native_calibrate_tsc(void) | |||
702 | } | 702 | } |
703 | } | 703 | } |
704 | 704 | ||
705 | /* | ||
706 | * TSC frequency determined by CPUID is a "hardware reported" | ||
707 | * frequency and is the most accurate one so far we have. This | ||
708 | * is considered a known frequency. | ||
709 | */ | ||
710 | setup_force_cpu_cap(X86_FEATURE_TSC_KNOWN_FREQ); | ||
711 | |||
705 | return crystal_khz * ebx_numerator / eax_denominator; | 712 | return crystal_khz * ebx_numerator / eax_denominator; |
706 | } | 713 | } |
707 | 714 | ||