x86/APIC: calibrate against platform timer when possible
authorJan Beulich <jbeulich@suse.com>
Tue, 5 Apr 2022 09:36:32 +0000 (11:36 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 5 Apr 2022 09:36:32 +0000 (11:36 +0200)
commit3f3906b462d57613d45051940d9083d02f49d1d2
tree22422252b84817a244250ec827629560972c080c
parent39341fba7cb292d16ae77f54aaff1af3538f9115
x86/APIC: calibrate against platform timer when possible

Use the original calibration against PIT only when the platform timer
is PIT. This implicitly excludes the "xen_guest" case from using the PIT
logic (init_pit() fails there, and as of 5e73b2594c54 ["x86/time: minor
adjustments to init_pit()"] using_pit also isn't being set too early
anymore), so the respective hack there can be dropped at the same time.
This also reduces calibration time from 100ms to 50ms, albeit this step
is being skipped as of 0731a56c7c72 ("x86/APIC: no need for timer
calibration when using TDT") anyway.

While re-indenting the PIT logic in calibrate_APIC_clock(), besides
adjusting style also switch around the 2nd TSC/TMCCT read pair, to match
the order of the 1st one, yielding more consistent deltas.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
xen/arch/x86/apic.c
xen/arch/x86/include/asm/apic.h
xen/arch/x86/time.c