pc64 - If appropriate, determine TSC frequency via CPUID.
authorImre Vadász <imre@vdsz.com>
Sat, 4 Aug 2018 15:09:26 +0000 (17:09 +0200)
committerImre Vadász <imre@vdsz.com>
Sat, 4 Aug 2018 15:36:01 +0000 (17:36 +0200)
commit8b257adbda32b59bb93cb76a5daa122a9252f6c0
tree391f976d04d8e7f7a5193dbc37f0791771752300
parente389314b1feb6a5659f5f52a71878f14c29091af
pc64 - If appropriate, determine TSC frequency via CPUID.

On Intel systems with Skylake and newer CPUs, and on modern Atom CPUs this
avoids the ca. 200ms TSC calibration process at the beginning of booting.

On most modern Intel CPUs the TSC frequency can be determined via CPUID
information. For the most modern generations this is quite well documented.
If the CPUID information doesn't directly specify the "crystal clock",
we use the frequency values given in Intel's "Software Developer's Manual"
for the different cpu variants.

Since the "crystal clock" seems to exactly match the HPET frequency that we
use in the calibration, this method should be at least as good as our
calibration procedure.

Setting the tunable hw.tsc_ignore_cpuid=1 forces the kernel to calibrate
the TSC if it would otherwise just use the CPUID information.
sys/platform/pc64/x86_64/initcpu.c