From patchwork Wed Jan 3 11:55:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "D, Lakshmi Sowjanya" X-Patchwork-Id: 184722 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4971116dyb; Wed, 3 Jan 2024 04:00:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IHKr6IjQ1AouNr7wRckhr+1Hr0IASwythlg4XyKzED/tcOLHEGtLqui6D5ZoZfMuHi4DuSH X-Received: by 2002:ac2:5308:0:b0:50e:4cad:ec84 with SMTP id c8-20020ac25308000000b0050e4cadec84mr7518560lfh.35.1704283209447; Wed, 03 Jan 2024 04:00:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704283209; cv=none; d=google.com; s=arc-20160816; b=VxwGPaqrHPvSD6krD1dKSJbQqMg99bLRn+3zsBJ704whTmxXIG/5Nb61SNN1GpXfvr b+6dpVpDowddaiCXS1pMzTQjzajzZQTMkwbvjH/0K/YCE3z/HWB/51O5JYCmelAIgGlr hJBrDuU1yeH3i6KsVx4YOf+zAqFwtF/h3uJ8P6dmbBYhDBiZ21tG7iHbn+jGwsh6X8iu m2evBe0SthfbSCQ+eZRV7qN3slLg8Nl6VHYPkR/6Wk6whTgYjxyRdSlfw2PWMY2ZLd53 h/2cvS08OXufcwdW2518BnBXRt1lFQtebeEYPjnxUVn5BgLkqiTcVHQPNdJSa/qRcr1W fiGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=wFgZIfJYPA9ni08Q5KyfOyr45+vqn8h5w/dqy8vH9/o=; fh=4NrVLy9e1N+ecgT+cYXeaYo3IQFJO3N8B6ul/oSBUd8=; b=sQgco+oEA6jIHWlYRUxtireX3purmOAgrznivo4aQdwQcPOXDAJtObRoi8bi4ARGRa oPp/4TosYpKNmfk2Aw6JwmhjnHIef+jcc0qmlgRx58u+Fm3f98DGRG6beWfFoxZo5Wse h7iMGTqz6gAO58yjsVUdtYlKWKsg0VM29FWf5NJwgHSPyBnOSJL9bbB/5X3wMjhmLggO inqwZtfFi1IuOXkX5RgL4eTs8T7f854Z/CQ+ut0no8QoRiNpqVqE1fxQUuUKyKe0/jhx o99R11YUoVu874DerUNCWeot2150V1InOVZpHaFKf3fojgE0xlBIXF4CqG9EWiSWPf4c mJkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=aj2i7tHt; spf=pass (google.com: domain of linux-kernel+bounces-15476-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15476-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id s29-20020a508d1d000000b0054d97562779si12226497eds.616.2024.01.03.04.00.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 04:00:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15476-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=aj2i7tHt; spf=pass (google.com: domain of linux-kernel+bounces-15476-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15476-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id DAED71F233FF for ; Wed, 3 Jan 2024 12:00:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3508C1B28F; Wed, 3 Jan 2024 11:57:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="aj2i7tHt" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 32C431B26C; Wed, 3 Jan 2024 11:57:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704283021; x=1735819021; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4gpaf4BC14HiFVie3Mg6WGP9gJol31Mpsd/4fnF9cP8=; b=aj2i7tHtbmn6UKdKUma5T7Rw9k6gouucPv+aWpUok4O11vCcq16SR76o b1eSYVzbSvlj2lx6rdj6kRoIeX8NKg9bdncH/1rar8AEGyWjxkAr+/bfE dLetl1rlSf7AsDS3BVX8PnOOmHVynBiXQO4AUGswPWE8ReTAnDRBYo7iL 48Vv96AleimN0XKsksczP35bbmZcnAud27Mgutr/wi1V3jSS1Otwvzyl+ zpPlO46c+pZFZUxik94LANaf5pfyuawkNm8e3IYmgb5/waf1j6XsU4QNb 9L7zbHzu4dXofsSuIqBE/tmqtyUNvp4tpHXW8uxE8/gy1Iqca1ZNlxWpx Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="428169574" X-IronPort-AV: E=Sophos;i="6.04,327,1695711600"; d="scan'208";a="428169574" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jan 2024 03:57:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="1111348117" X-IronPort-AV: E=Sophos;i="6.04,327,1695711600"; d="scan'208";a="1111348117" Received: from inlubt0316.iind.intel.com ([10.191.20.213]) by fmsmga005.fm.intel.com with ESMTP; 03 Jan 2024 03:56:54 -0800 From: lakshmi.sowjanya.d@intel.com To: tglx@linutronix.de, jstultz@google.com, giometti@enneenne.com, corbet@lwn.net, linux-kernel@vger.kernel.org Cc: x86@kernel.org, netdev@vger.kernel.org, linux-doc@vger.kernel.org, intel-wired-lan@lists.osuosl.org, andriy.shevchenko@linux.intel.com, eddie.dong@intel.com, christopher.s.hall@intel.com, jesse.brandeburg@intel.com, davem@davemloft.net, alexandre.torgue@foss.st.com, joabreu@synopsys.com, mcoquelin.stm32@gmail.com, perex@perex.cz, linux-sound@vger.kernel.org, anthony.l.nguyen@intel.com, pandith.n@intel.com, mallikarjunappa.sangannavar@intel.com, thejesh.reddy.t.r@intel.com, lakshmi.sowjanya.d@intel.com Subject: [RFC PATCH v3 08/11] x86/tsc: Remove art to tsc conversion functions which are obsolete Date: Wed, 3 Jan 2024 17:25:59 +0530 Message-Id: <20240103115602.19044-9-lakshmi.sowjanya.d@intel.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240103115602.19044-1-lakshmi.sowjanya.d@intel.com> References: <20240103115602.19044-1-lakshmi.sowjanya.d@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787070470833008187 X-GMAIL-MSGID: 1787070470833008187 From: Lakshmi Sowjanya D The convert_art_to_tsc() and convert_art_ns_to_tsc() interfaces are no longer required. This conversion is internally done in get_device_system_crosststamp() using convert_base_to_cs(). Signed-off-by: Lakshmi Sowjanya D --- arch/x86/include/asm/tsc.h | 3 -- arch/x86/kernel/tsc.c | 61 -------------------------------------- 2 files changed, 64 deletions(-) diff --git a/arch/x86/include/asm/tsc.h b/arch/x86/include/asm/tsc.h index 594fce0ca744..5e36495cc821 100644 --- a/arch/x86/include/asm/tsc.h +++ b/arch/x86/include/asm/tsc.h @@ -27,9 +27,6 @@ static inline cycles_t get_cycles(void) } #define get_cycles get_cycles -extern struct system_counterval_t convert_art_to_tsc(u64 art); -extern struct system_counterval_t convert_art_ns_to_tsc(u64 art_ns); - extern void tsc_early_init(void); extern void tsc_init(void); extern void mark_tsc_unstable(char *reason); diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 035ae5bec2e8..706ef369e33c 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c @@ -1298,67 +1298,6 @@ int unsynchronized_tsc(void) return 0; } -/* - * Convert ART to TSC given numerator/denominator found in detect_art() - */ -struct system_counterval_t convert_art_to_tsc(u64 art) -{ - u64 tmp, res, rem; - - rem = do_div(art, art_base_clk.denominator); - - res = art * art_base_clk.numerator; - tmp = rem * art_base_clk.numerator; - - do_div(tmp, art_base_clk.denominator); - res += tmp + art_base_clk.offset; - - return (struct system_counterval_t) { - .cs_id = have_art ? CSID_X86_TSC : CSID_GENERIC, - .cycles = res - }; -} -EXPORT_SYMBOL(convert_art_to_tsc); - -/** - * convert_art_ns_to_tsc() - Convert ART in nanoseconds to TSC. - * @art_ns: ART (Always Running Timer) in unit of nanoseconds - * - * PTM requires all timestamps to be in units of nanoseconds. When user - * software requests a cross-timestamp, this function converts system timestamp - * to TSC. - * - * This is valid when CPU feature flag X86_FEATURE_TSC_KNOWN_FREQ is set - * indicating the tsc_khz is derived from CPUID[15H]. Drivers should check - * that this flag is set before conversion to TSC is attempted. - * - * Return: - * struct system_counterval_t - system counter value with the ID of the - * corresponding clocksource - * @cycles: System counter value - * @cs_id: Clocksource ID corresponding to system counter value. - * Used by timekeeping code to verify comparability of two - * cycle values. - */ - -struct system_counterval_t convert_art_ns_to_tsc(u64 art_ns) -{ - u64 tmp, res, rem; - - rem = do_div(art_ns, USEC_PER_SEC); - - res = art_ns * tsc_khz; - tmp = rem * tsc_khz; - - do_div(tmp, USEC_PER_SEC); - res += tmp; - return (struct system_counterval_t) { - .cs_id = have_art ? CSID_X86_TSC : CSID_GENERIC, - .cycles = res - }; -} -EXPORT_SYMBOL(convert_art_ns_to_tsc); - static void tsc_refine_calibration_work(struct work_struct *work); static DECLARE_DELAYED_WORK(tsc_irqwork, tsc_refine_calibration_work); /**