From nobody Thu Apr 9 00:17:51 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1F17FA373D for ; Tue, 1 Nov 2022 05:24:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229881AbiKAFYu (ORCPT ); Tue, 1 Nov 2022 01:24:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229952AbiKAFYb (ORCPT ); Tue, 1 Nov 2022 01:24:31 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99CE213CD8 for ; Mon, 31 Oct 2022 22:24:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667280265; x=1698816265; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=0x5C1nQK2uQCFLLwOkAmqcIqfySyFJsnR0olbPOIh0w=; b=GY2mCd+kbHSGOeOLi04lhqBHk6Wdcn76slKyFugBR9UHpSipGWem7+n7 +3HE3Pd+PsPQLb7H4lDIrFtf02GqsTK3OapyWxehht6g1qFp+B+XhbPk5 2kLF62qkzBCLyTgcJgHzlCuVKXBHSfx2nDdK7jIPj91brtMexsc95a2gN GacJH168tmDrgVlk1ALkvu8Ys1rPJJWxFF3GbF2/UCyPudd2P/Y4yOJ6h UdAcwtxG3bn5IIpxVbCIeHrCBJ7Sm5YK/dhAzD0bqyHitldrTB0kBraXC 0/KQXdgmTSVhsyPqvecAWiF0YjVz1G/GEEqwrob7t0ijwL5SkjRvZ5seg Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10517"; a="292371390" X-IronPort-AV: E=Sophos;i="5.95,229,1661842800"; d="scan'208";a="292371390" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Oct 2022 22:24:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10517"; a="759080366" X-IronPort-AV: E=Sophos;i="5.95,229,1661842800"; d="scan'208";a="759080366" Received: from louislifei-optiplex-7090.sh.intel.com ([10.239.146.218]) by orsmga004.jf.intel.com with ESMTP; 31 Oct 2022 22:24:22 -0700 From: Fei Li To: linux-kernel@vger.kernel.org, x86@kernel.org, peterz@infradead.org Cc: dave.hansen@intel.com, gregkh@linuxfoundation.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, Yu1.Wang@intel.com, conghui.chen@intel.com, fengwei.yin@intel.com Subject: [PATCH v2] x86/acrn: Set X86_FEATURE_TSC_KNOWN_FREQ Date: Tue, 1 Nov 2022 13:30:19 +0800 Message-Id: <20221101053019.174948-1-fei1.li@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" If the TSC frequency is known from the acrn_get_tsc_khz(), the TSC frequency does not need to be recalibrated. Avoiding recalibration by setting X86_FEATURE_TSC_KNOWN_FREQ. This patch also removes `inline` for acrn_get_tsc_khz() since it doesn't make sense. Signed-off-by: Fei Li Reviewed-by: Yin, Fengwei --- v2: - Detail the commit message --- arch/x86/include/asm/acrn.h | 5 ----- arch/x86/kernel/cpu/acrn.c | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/x86/include/asm/acrn.h b/arch/x86/include/asm/acrn.h index 1dd14381bcb6..aa12c74ea959 100644 --- a/arch/x86/include/asm/acrn.h +++ b/arch/x86/include/asm/acrn.h @@ -30,11 +30,6 @@ static inline u32 acrn_cpuid_base(void) return 0; } =20 -static inline unsigned long acrn_get_tsc_khz(void) -{ - return cpuid_eax(ACRN_CPUID_TIMING_INFO); -} - /* * Hypercalls for ACRN * diff --git a/arch/x86/kernel/cpu/acrn.c b/arch/x86/kernel/cpu/acrn.c index 485441b7f030..c5ff75b6a949 100644 --- a/arch/x86/kernel/cpu/acrn.c +++ b/arch/x86/kernel/cpu/acrn.c @@ -24,6 +24,12 @@ static u32 __init acrn_detect(void) return acrn_cpuid_base(); } =20 +static unsigned long acrn_get_tsc_khz(void) +{ + setup_force_cpu_cap(X86_FEATURE_TSC_KNOWN_FREQ); + return cpuid_eax(ACRN_CPUID_TIMING_INFO); +} + static void __init acrn_init_platform(void) { /* Setup the IDT for ACRN hypervisor callback */ base-commit: 5aaef24b5c6d4246b2cac1be949869fa36577737 --=20 2.34.1