Skip to content

Commit 8fcc514

Browse files
mhklinuxliuw
authored andcommitted
x86/hyperv: Set X86_FEATURE_TSC_KNOWN_FREQ when Hyper-V provides frequency
A Linux guest on Hyper-V gets the TSC frequency from a synthetic MSR, if available. In this case, set X86_FEATURE_TSC_KNOWN_FREQ so that Linux doesn't unnecessarily do refined TSC calibration when setting up the TSC clocksource. With this change, a message such as this is no longer output during boot when the TSC is used as the clocksource: [ 1.115141] tsc: Refined TSC clocksource calibration: 2918.408 MHz Furthermore, the guest and host will have exactly the same view of the TSC frequency, which is important for features such as the TSC deadline timer that are emulated by the Hyper-V host. Signed-off-by: Michael Kelley <[email protected]> Reviewed-by: Roman Kisel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Wei Liu <[email protected]> Message-ID: <[email protected]>
1 parent 3b85a2e commit 8fcc514

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

arch/x86/kernel/cpu/mshyperv.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ static void __init ms_hyperv_init_platform(void)
424424
ms_hyperv.misc_features & HV_FEATURE_FREQUENCY_MSRS_AVAILABLE) {
425425
x86_platform.calibrate_tsc = hv_get_tsc_khz;
426426
x86_platform.calibrate_cpu = hv_get_tsc_khz;
427+
setup_force_cpu_cap(X86_FEATURE_TSC_KNOWN_FREQ);
427428
}
428429

429430
if (ms_hyperv.priv_high & HV_ISOLATION) {

0 commit comments

Comments
 (0)