aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/kernel/jailhouse.c
diff options
context:
space:
mode:
authorGravatar Daniel Drake <drake@endlessm.com> 2019-05-09 13:54:15 +0800
committerGravatar Ingo Molnar <mingo@kernel.org> 2019-05-09 11:06:48 +0200
commit604dc9170f2435d27da5039a3efd757dceadc684 (patch)
treec88e25a339f1e74feac4671c0b84a0db0a2a449f /arch/x86/kernel/jailhouse.c
parentMerge branch 'ras-core-for-linus' of git://git.kernel.org/pub/scm/linux/kerne... (diff)
downloadlinux-604dc9170f2435d27da5039a3efd757dceadc684.tar.gz
linux-604dc9170f2435d27da5039a3efd757dceadc684.tar.bz2
linux-604dc9170f2435d27da5039a3efd757dceadc684.zip
x86/tsc: Use CPUID.0x16 to calculate missing crystal frequency
native_calibrate_tsc() had a data mapping Intel CPU families and crystal clock speed, but hardcoded tables are not ideal, and this approach was already problematic at least in the Skylake X case, as seen in commit: b51120309348 ("x86/tsc: Fix erroneous TSC rate on Skylake Xeon") By examining CPUID data from http://instlatx64.atw.hu/ and units in the lab, we have found that 3 different scenarios need to be dealt with, and we can eliminate most of the hardcoded data using an approach a little more advanced than before: 1. ApolloLake, GeminiLake, CannonLake (and presumably all new chipsets from this point) report the crystal frequency directly via CPUID.0x15. That's definitive data that we can rely upon. 2. Skylake, Kabylake and all variants of those two chipsets report a crystal frequency of zero, however we can calculate the crystal clock speed by condidering data from CPUID.0x16. This method correctly distinguishes between the two crystal clock frequencies present on different Skylake X variants that caused headaches before. As the calculations do not quite match the previously-hardcoded values in some cases (e.g. 23913043Hz instead of 24MHz), TSC refinement is enabled on all platforms where we had to calculate the crystal frequency in this way. 3. Denverton (GOLDMONT_X) reports a crystal frequency of zero and does not support CPUID.0x16, so we leave this entry hardcoded. Suggested-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Daniel Drake <drake@endlessm.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Cc: Andy Lutomirski <luto@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: len.brown@intel.com Cc: linux@endlessm.com Cc: rafael.j.wysocki@intel.com Link: http://lkml.kernel.org/r/20190509055417.13152-1-drake@endlessm.com Link: https://lkml.kernel.org/r/20190419083533.32388-1-drake@endlessm.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/kernel/jailhouse.c')
0 files changed, 0 insertions, 0 deletions