x86: Defer early TSC timecounter calibration to SI_SUB_CPU
authorMark Johnston <markj@FreeBSD.org>
Sat, 5 Mar 2022 00:34:43 +0000 (19:34 -0500)
committerMark Johnston <markj@FreeBSD.org>
Sat, 5 Mar 2022 00:34:43 +0000 (19:34 -0500)
commit075e2779aca7cbd8f201ce0e1bb60318d0cbd8b8
treef6aa90ae367a5acce2f413d694fbf629dd1b4b35
parentf7a6dccf426676bdd8c6be25491e57dca830de25
x86: Defer early TSC timecounter calibration to SI_SUB_CPU

If we can't determine the TSC frequency using CPU registers, we need to
give a chance for Hyper-V drivers to register a timecounter (during
SI_SUB_HYPERVISOR) since an emulated 8254 might not be available.
Thus, split probe_tsc_freq() into early and late stages, and wait until
the latter to attempt calibration using a reference clock.

Fixes: 84369dd52369 ("x86: Probe the TSC frequency earlier")
Reported and tested by: khng, Shawn Webb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34444
sys/x86/x86/tsc.c