[PATCH v5 17/51] x86/tsc: Fold native_calibrate_cpu() into recalibrate_cpu_khz()
From: Sean Christopherson
Date: Wed Jul 01 2026 - 15:44:31 EST
Fold the guts of native_calibrate_cpu() into its sole remaining caller,
recalibrate_cpu_khz() to eliminate the extra SMP=n #ifdef, and so that it's
more obvious that directly invoking the early vs. late calibration routines
in determine_cpu_tsc_frequencies() is intentional.
No functional change intended.
Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
---
arch/x86/kernel/tsc.c | 19 +++----------------
1 file changed, 3 insertions(+), 16 deletions(-)
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 9764ac758081..6ed6f8f012eb 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -918,21 +918,6 @@ static unsigned long native_calibrate_cpu_early(void)
return fast_calibrate;
}
-#ifndef CONFIG_SMP
-/**
- * native_calibrate_cpu - calibrate the cpu
- */
-static unsigned long native_calibrate_cpu(void)
-{
- unsigned long tsc_freq = native_calibrate_cpu_early();
-
- if (!tsc_freq)
- tsc_freq = native_calibrate_cpu_late();
-
- return tsc_freq;
-}
-#endif
-
void recalibrate_cpu_khz(void)
{
#ifndef CONFIG_SMP
@@ -944,7 +929,9 @@ void recalibrate_cpu_khz(void)
if (WARN_ON_ONCE(cpu_feature_enabled(X86_FEATURE_TSC_KNOWN_FREQ)))
return;
- cpu_khz = native_calibrate_cpu();
+ cpu_khz = native_calibrate_cpu_early();
+ if (!cpu_khz)
+ cpu_khz = native_calibrate_cpu_late();
tsc_khz = native_calibrate_tsc();
if (tsc_khz == 0)
tsc_khz = cpu_khz;
--
2.55.0.rc0.799.gd6f94ed593-goog