From nobody Wed Aug 26 11:49:30 2026 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) (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 21C694D2EF5 for ; Wed, 1 Jul 2026 19:32:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782934371; cv=none; b=FiohakD1GBJDHMplArgwQfFEGGOWs6lsK7RNAHNfK+OK8g+/XeUgkLvxd4jzkuJt06UOVIFIYYGR2poSdIkvsBL9F6XsO/U0Pgf5e9CcjLa9WDp6ykbXucSLfvmD0KkhzK3upibQx6Ba14nQ2rZQttrzVHpzkvFag8fpAy3RGJo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782934371; c=relaxed/simple; bh=bCu106G3ke2QslwQjzoF0iFGAeRR147Dfw14C3mfIq8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Xe8GjAuxKLcxw9i97F0eYWOXD1As3a/ObwqqjFtliMFoJAUg0eCA3+3JVXXmRJQwYYP3Y8cHDyZAeONy4cQ9vcH87oGj8TkPMbwJVR/DVhKeE6Yogxvy8CuT8wbD54RKL1sIoN3S6URZ2XJ7d//+jOP10iM+ohOURF4hm1sZP88= 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=RGim8zLW; arc=none smtp.client-ip=209.85.216.73 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="RGim8zLW" Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-36d97a4e08fso1162546a91.0 for ; Wed, 01 Jul 2026 12:32:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1782934367; x=1783539167; 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=wWnD58giubyrEvhTS3JtzvsAOScPFFHLvCt5ZIn12HI=; b=RGim8zLW1wlz5dJnZqYLWL3bGdYClN515n10wiLNcVizsBIPQujENdMajLs0iWsW6O O+Rx2mKWQRRHRrTpj90TOFoPGek5y9CvlljK8GTnhvSRp9QLcRy24rsh8suZh15fJuoC n+5xWIeSE6kJloQzUTTtO6yv2emTebfe/s/Sn6/AotYZtsHbAIQio2FU/fxvIKFXliYe gMZJLUWkCwWcwFqAMNiTLiX0Wl9+69Osa0QnHRn83EIUfNNL0IkjMwTy/pK0CnCJQ4CI S4sTgzOS5lzQ+vM2PlMED5NQfi5X02T2ecSVnPIwU2Vjn7mY/8D9XAipgF8imJCB2Hlo 2e9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782934367; x=1783539167; 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=wWnD58giubyrEvhTS3JtzvsAOScPFFHLvCt5ZIn12HI=; b=lhELPG5hu8CMcNXytVcgE5gSM65em4RcUgAB0rniT0VxuLRSiuR7smy6DVfKp3WrmY 0Eaej2gBHZY6d71u90twquAvVxoUUxQnR6Z16mSxEVV/3o2AWzDxvFZf1WAJwnGELIJL PGeFLKYTTiQrBLURBhQ3TQ+ps2AunQvL784Lxka3kitFbN3RxgpiT1xZrxGRAJ32UEHM /S0Z7jq4A6Oz2ErNLsmSrRy6ZWFaBi5zd2kfprdEND4l0ua8GsV4elZ3BDA0Fej3fHkl Ke2RXwvN33S/rPdfLQ9E9dsFbEvamuq1oeoQ/hisBUarQfGA89qoY9qIYaVFfqE6UMWZ 5jlQ== X-Forwarded-Encrypted: i=1; AHgh+RpyjhZXNi/eKtxfxLEYRzi684P1PqfVFi6tbqHOVklaZtWhnEXxyau+caeSm65z9PQwr27TONA+xpyGsSo=@vger.kernel.org X-Gm-Message-State: AOJu0YzUXxo63Ujtgs43PjujjcMAMsk3Bfrb4iOgsVCGB9qvwg1lNhLM QRfkvQ7CkHfr2jUDijFGg61gK8Sp/m3WdyrDhsBFnaAuzB0zeMLkwJ/PmZ2a8eZxXDDjIhjZkXA wTeZTpQ== X-Received: from pjbms18.prod.google.com ([2002:a17:90b:2352:b0:380:9651:afb9]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90a:e7ce:b0:37d:8426:40de with SMTP id 98e67ed59e1d1-380aa0ad396mr2721883a91.1.1782934366877; Wed, 01 Jul 2026 12:32:46 -0700 (PDT) Reply-To: Sean Christopherson Date: Wed, 1 Jul 2026 12:31:38 -0700 In-Reply-To: <20260701193212.749551-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: <20260701193212.749551-1-seanjc@google.com> X-Mailer: git-send-email 2.55.0.rc0.799.gd6f94ed593-goog Message-ID: <20260701193212.749551-18-seanjc@google.com> Subject: [PATCH v5 17/51] x86/tsc: Fold native_calibrate_cpu() into recalibrate_cpu_khz() From: Sean Christopherson To: Jonathan Corbet , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Kiryl Shutsemau , Rick Edgecombe , 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: Shuah Khan , "H. Peter Anvin" , Vitaly Kuznetsov , Broadcom internal kernel review list , Boris Ostrovsky , Stephen Boyd , linux-doc@vger.kernel.org, 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, Tom Lendacky , Nikunj A Dadhania , David Woodhouse , David Woodhouse , Michael Kelley , Thomas Gleixner Content-Transfer-Encoding: quoted-printable 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=3Dn #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 | 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; } =20 -#ifndef CONFIG_SMP -/** - * native_calibrate_cpu - calibrate the cpu - */ -static unsigned long native_calibrate_cpu(void) -{ - unsigned long tsc_freq =3D native_calibrate_cpu_early(); - - if (!tsc_freq) - tsc_freq =3D 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; =20 - cpu_khz =3D native_calibrate_cpu(); + cpu_khz =3D native_calibrate_cpu_early(); + if (!cpu_khz) + cpu_khz =3D native_calibrate_cpu_late(); tsc_khz =3D native_calibrate_tsc(); if (tsc_khz =3D=3D 0) tsc_khz =3D cpu_khz; --=20 2.55.0.rc0.799.gd6f94ed593-goog