From patchwork Tue Oct 25 08:41:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fei Li X-Patchwork-Id: 10596 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp890352wru; Tue, 25 Oct 2022 02:04:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4NXe5MjlJAWxEQZddfzUrDcBfPY7Xqx3BtSedsOBLCfPzRR0soWneXmsfWKKZ0z0BKkscZ X-Received: by 2002:a17:907:c05:b0:73d:6e0a:8d22 with SMTP id ga5-20020a1709070c0500b0073d6e0a8d22mr31641589ejc.646.1666688671480; Tue, 25 Oct 2022 02:04:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666688671; cv=none; d=google.com; s=arc-20160816; b=UUSole3D0Sj0E3gvHzVaGZN2DRAJ03/3iffFhWunKuZN0I67+jvIgdUxTBTPIVKpFI pWXAk6mJhOFk0g/eF15MnuS3gheWFOI+aBJLR6GMM2mcbNuq/ly2Rx/UmKdSLwtsuae2 DikQlUicoIBNfH+dKEzSlX9cukvo++sCH+BLKLldkcGWCSVW43p51o5L814fAH7BnFqU IbR1KCYHnsgQeskYxZxSCVkW1leOyQYX6cdDc77SH08tAmtpgFul6U2AJlLUgnw6IalK y8rMjQjgQuqpCcp4eldByjOvNmWqK9OSy1p9aNfSj7KYq2sf+teDwRP1y6ztXn8kZDp0 rdww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=JWRDw+JQzDjhhzQzPb1S9k9J8O7htWjdYSth4cNdhq8=; b=jQWMTqE5H1ZeZE9xzNyXaEIZ7Jpnrr1zf8RptU6cMGiURjnL396+hDkCU20XuXQPOK KNImeQMJbsOnrKUAivtJe2CIeQYB507ARxjbI1KiDpyLC/LU/6yDem1NnmPS06/ac0Qp ioSp1rk+JZ9NrIY+2QN6ULk0qO1OjzN2tgr+lol8a3UpZmH4F8bk01J9AFEeZRvfv+Ny yONhx0D4iJgHoTyjqhi5FvuAdcEd8Rn+P0oe5UgiPvm3QrpDxgZoPLjMP1Wg+1cNL3T2 8DZ7qVMxUUWj8wGaOzH64B5J4dzxRcqfHAIOZkWAJry7rMy8W5hw2m86PvhT/oFm2rcT RDNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ijfPwmJO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c3-20020a170906694300b0078a4aad3141si1891266ejs.211.2022.10.25.02.04.07; Tue, 25 Oct 2022 02:04:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ijfPwmJO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232291AbiJYIg0 (ORCPT + 99 others); Tue, 25 Oct 2022 04:36:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232373AbiJYIgI (ORCPT ); Tue, 25 Oct 2022 04:36:08 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92D24B1B97 for ; Tue, 25 Oct 2022 01:35:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666686959; x=1698222959; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=06nalujSve5fq7Zr8pswHrs1yGAHFNbk4ISagSP3o7w=; b=ijfPwmJOHDN9eFDM9cC4uxtbCkGfDpfdF8qpOLuE/HjS7EvprS8IpP48 BTmupnFeNDqT2HrxrJOeV7B8kgFV97nO8WmV3gpSNcPhG3er+Fve53R12 bSfuJT7tKjd/A9+9hNnjyKPs6ACxCS2oXWaeFnF1WFml89jAFaczDfRj+ j1JTAofwosILuP8Cx6MesRd0aJNTbMs3RTqLRsG/h7R7KWoTOVvirT5Pc Vv9rK2/mYvszwyxzuKoWm9jjYGHrMyGpj+ZHYcU/8IKQFTbhKCQkt28uI Lp5U4wA/nrGXtJEFniA+9LWmRdB/Qfd4aX7CFz4DbHfaNhGgW96VqPwVe Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10510"; a="309310189" X-IronPort-AV: E=Sophos;i="5.95,211,1661842800"; d="scan'208";a="309310189" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Oct 2022 01:35:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10510"; a="774117588" X-IronPort-AV: E=Sophos;i="5.95,211,1661842800"; d="scan'208";a="774117588" Received: from louislifei-optiplex-7090.sh.intel.com ([10.239.146.218]) by fmsmga001.fm.intel.com with ESMTP; 25 Oct 2022 01:35:48 -0700 From: Fei Li To: linux-kernel@vger.kernel.org, x86@kernel.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] x86/acrn: Set X86_FEATURE_TSC_KNOWN_FREQ Date: Tue, 25 Oct 2022 16:41:47 +0800 Message-Id: <20221025084147.4118463-1-fei1.li@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747649740328674407?= X-GMAIL-MSGID: =?utf-8?q?1747649740328674407?= 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 --- arch/x86/include/asm/acrn.h | 5 ----- arch/x86/kernel/cpu/acrn.c | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) base-commit: 1a2dcbdde82e3a5f1db9b2f4c48aa1aeba534fb2 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; } -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(); } +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 */