From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C078D3F88BA for ; Fri, 29 May 2026 14:45:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780065909; cv=none; b=bqjtWb8nqfIFjSrw2dYmOR8xTXbzSNmHSqjn05a1DISWC+8pD64rUiHYlDPKPeovNeE2h5v6LFM+ObyE/c1dHK7Sxec/QlWeKweGZw1kKkmCCZE9L2sfkgdztqpKpH26fXVojRiKJcNV+izwPPQD7gir9rPnni4gF90VUh44aeU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780065909; c=relaxed/simple; bh=WHi2AWvhDQvTEIPut9U48s/z4C+6DTwQMXjBVRNgv1M=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=e6clWo/BTGUbl5CkUonFkuSuxVXN6Ne8jYTWHJIFTpYj5MLoIBgDnAPMrGulES0C7cqxEqUf5xhyMAETQkqQmNNtBfB1yaEs3QkVDUFh2sWcgiiTIEeSdFrRAKTByCUaOm6bI3XJ/XKEreZ0C/AY1Cvqi3OC1fQQr+cppgmEy9o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=TZflyEy1; arc=none smtp.client-ip=209.85.214.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="TZflyEy1" Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-2bf0453031aso26802395ad.2 for ; Fri, 29 May 2026 07:45:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780065907; x=1780670707; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=gZ7qyLV4Qg2/G7AZdfT7QLEMZtHiHfovzBdDbSmwy9M=; b=TZflyEy1vXcPT+mMlxETjxGB442PHHrQ3KtbjHbPVPy67lAEDR3oUASgqwmYjMqlQd e0oE7WW+J3P2Ij9tYaA/XRQg2ZXOimU1UtF0Mn9RUIbjwO/oVv8EacuAa4yOVcX+Fk/t AfIrkWcTVG59xXMhS+s32WW9ccnOsWBeKNgJvl/jQEiSRI3PA/W55xqCexy3t1YLy9ED Qk2mYc+dW9WPNxp8h65XQCoNWDPeiNO0cETnSiBcqiXy2gt3ua360gKb2lF88XjB81uG J+/eVcv2OiKN3kji2t+B6lCi82EjhvZOL6nUl1Iwto2afOKWCON90BZwBr/80UP5lffv j+7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780065907; x=1780670707; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gZ7qyLV4Qg2/G7AZdfT7QLEMZtHiHfovzBdDbSmwy9M=; b=XL7EQJ7zRDzq8QJyO69fL6MXAL7JjoUiwBOjtNXiLxoYxfP5WhApIc15vK+03t8gJ7 jPZZgvmCI0tAW/sg+yf7hbu9PPzzMfMZ7zQPYEsuX8E7K+uqTNZWosFegFfu161TRAx9 7dW5mzWrUJ2NJapWQYSr10onIcOCrVFqA4LE9FjqbJApkLr9UFRiYkuV/tKGXmmMAaCe 9lP+Lt/JMaCELuUj4om8WwLjG4D0sTVNUuze8pIUdHd1lO6cEKOxoiYpVKqq1mmbWxIA YORE2Yrj12JjF8kBuD9J8TyDIt5/kKTe8nZDc5c3lFZMY0/jufmxZuEGRKGhJH4V5c4z RbNQ== X-Forwarded-Encrypted: i=1; AFNElJ98hXdMiasnyXfwXAnYkF9LhdyNc+mqpXHaBlkO28bFPxTr2Iy7g8rvFD1RAW7ZYYH4h82kAcdckKNUlJc=@vger.kernel.org X-Gm-Message-State: AOJu0Yy/7TGtZCD4bs8w6NBuyXdHq079UJEn37nqwP6bH1SmaPg812V9 +i8pKIBq0aJADmkKkaCGaFTfFn744ntz7jgC4pKwEz6f6LGPz1KOa+ZGDxpI3CKKZYQBT9h2a3q jlQyAfg== X-Received: from plblk13.prod.google.com ([2002:a17:903:8cd:b0:2bf:1cdf:9e4b]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:f785:b0:2bf:b17:ae3c with SMTP id d9443c01a7336-2bf3684e2c2mr1144355ad.25.1780065906739; Fri, 29 May 2026 07:45:06 -0700 (PDT) Reply-To: Sean Christopherson Date: Fri, 29 May 2026 07:44:00 -0700 In-Reply-To: <20260529144435.704127-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260529144435.704127-1-seanjc@google.com> X-Mailer: git-send-email 2.54.0.823.g6e5bcc1fc9-goog Message-ID: <20260529144435.704127-14-seanjc@google.com> Subject: [PATCH v4 13/47] x86/tsc: Fold native_calibrate_cpu() into recalibrate_cpu_khz() From: Sean Christopherson To: Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Kiryl Shutsemau , Sean Christopherson , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Long Li , Ajay Kaher , Alexey Makhalov , Jan Kiszka , Andy Lutomirski , Peter Zijlstra , Juergen Gross , Daniel Lezcano , John Stultz Cc: "H. Peter Anvin" , Rick Edgecombe , Vitaly Kuznetsov , Broadcom internal kernel review list , Boris Ostrovsky , Stephen Boyd , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-coco@lists.linux.dev, linux-hyperv@vger.kernel.org, virtualization@lists.linux.dev, xen-devel@lists.xenproject.org, David Woodhouse , Tom Lendacky , Nikunj A Dadhania , David Woodhouse , Michael Kelley , Thomas Gleixner Content-Type: text/plain; charset="UTF-8" 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 --- arch/x86/kernel/tsc.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 534462c81c78..3e911f0f7364 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c @@ -945,21 +945,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 @@ -968,7 +953,10 @@ void recalibrate_cpu_khz(void) if (!boot_cpu_has(X86_FEATURE_TSC)) return; - cpu_khz = native_calibrate_cpu(); + cpu_khz = native_calibrate_cpu_early(); + if (!cpu_khz) + cpu_khz = native_calibrate_cpu_late(); + if (!boot_cpu_has(X86_FEATURE_TSC_KNOWN_FREQ)) tsc_khz = native_calibrate_tsc(); if (tsc_khz == 0) -- 2.54.0.823.g6e5bcc1fc9-goog