From patchwork Wed Jan 3 11:55:52 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: 184715 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4970052dyb; Wed, 3 Jan 2024 03:57:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IHM0Py0ZcfcepslmoW7CDu5mHta2qqZZDZ1etGfrKAG6/HE7Q3iLxLfqliSnlgFXGBHYx8u X-Received: by 2002:a05:620a:a54:b0:781:e95a:725d with SMTP id j20-20020a05620a0a5400b00781e95a725dmr486316qka.151.1704283028702; Wed, 03 Jan 2024 03:57:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704283028; cv=none; d=google.com; s=arc-20160816; b=nDhkcRu2C4l2dG1JAwErkd/6JaUgOXSAmi0rzMJXJF3Qx5x1xsuC0Gr5HvPidf8c// XrSgnnueeEHYYDYUMuC5eW3KPhQGJiuh3Glm1YCpUmO9r+y6cAmC1QM33p1yDF2qcDYe 1NAua2fxAqQQLWL0+k5MHOBbUqx1vxOAaqKb9BWL1lDAJ+Mt5gdu2FERuVdmkEQmOPdd 8BQjmmTHSk/o0GG/fGZDgj5flOQ75AXJ8CGbclZ+sppZqcPwCjOJag84VLhBoLXfof+F mkcjUEaVCmme1rlbvUg2Kn4hNbuDEr8+L+RFRaF9TiSPiJW1BAYcpscqGWEP+9sYpJ7D RlXQ== 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=5Yr8uKLbu1hKndhzX8cohxHk9HUCuqp8jhMcRl7jT5U=; fh=4NrVLy9e1N+ecgT+cYXeaYo3IQFJO3N8B6ul/oSBUd8=; b=kU09azjsNVQUW/Vnv8PNPvblTKNrRUkKCYMSfvjJiF489gdUwGykgfp8haZjTHZ9/A 1WcxE/+O1HGumbMIj+dYrH4Ojen2HiWfovZn6XuLvlt2D7goUB1g92LKYvjy8v/gbCvS QBxeazm/uOOA19099hsPbLsuF7TR9eCpRYlmGma+RMYzL5SfKAFr05umr0FWpFrD4yLl YdM6KTP9KHLdGbCNvm79eB/uIhbr9NTWbRBCduDcQI6eppP1i5kvZ3e2ujRXB2BdOAeE uDYvcTQIXyZZkOMCCV5l4fP6o/p9O/bir4VphiWgSH+My7ZltJmBf2hrVL3xkiPo5J+f lrWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Wcb9MHcR; spf=pass (google.com: domain of linux-kernel+bounces-15469-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15469-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id f23-20020a05620a15b700b0077f7eb13558si27773685qkk.433.2024.01.03.03.57.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 03:57:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15469-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Wcb9MHcR; spf=pass (google.com: domain of linux-kernel+bounces-15469-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15469-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 6F3681C227E5 for ; Wed, 3 Jan 2024 11:57:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4AD771945C; Wed, 3 Jan 2024 11:56:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Wcb9MHcR" 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 053BF18EB8; Wed, 3 Jan 2024 11:56:16 +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=1704282977; x=1735818977; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZPkSKpjHiCLvC9ZF7FXCFqefztas4HRUN72CS6lqsI8=; b=Wcb9MHcRtS2bnwncLyxjYjyjwn0vl3qcvdz6TdDrW2HoKnn8Cray5Kkx b2WFB+0Pk4Mawtvr7KYAz/EAluM43b6GZuKRleUTmYzYXEIBCzPttmr+3 8AqVqZXhdimCu1xX5O4WYCx8YHJG/93csSxsAklfAolqwyRg0RKXmvmmE A5Cvt1g8KaKSoM9vwGtYr3W9n9bAc5KgjWU3TLBkWgzyVm4u/igZeJYR5 AGFr+UVu4ISdXWWMLrWqBNAVYtwpMZi4NvdBKOJU/MzJjnrSgbkk2+lLb nEqEGSsPT1XUHwBcPbdZym55trfewsoMtYM/2VEp4RtfW7jejJC+HefiU Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="428169417" X-IronPort-AV: E=Sophos;i="6.04,327,1695711600"; d="scan'208";a="428169417" 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:56:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="1111348031" X-IronPort-AV: E=Sophos;i="6.04,327,1695711600"; d="scan'208";a="1111348031" Received: from inlubt0316.iind.intel.com ([10.191.20.213]) by fmsmga005.fm.intel.com with ESMTP; 03 Jan 2024 03:56:09 -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 01/11] x86/tsc: Add base clock properties in clocksource structure Date: Wed, 3 Jan 2024 17:25:52 +0530 Message-Id: <20240103115602.19044-2-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: 1787070281364669444 X-GMAIL-MSGID: 1787070281364669444 From: Lakshmi Sowjanya D Add hardware abstraction, struct clocksource_base in clocksource. Add clocksource ID for x86 ART(Always Running Timer). Co-developed-by: Thomas Gleixner Signed-off-by: Thomas Gleixner Co-developed-by: Christopher S. Hall Signed-off-by: Christopher S. Hall Signed-off-by: Lakshmi Sowjanya D --- arch/x86/kernel/tsc.c | 43 ++++++++++++++++++--------------- include/linux/clocksource.h | 27 +++++++++++++++++++++ include/linux/clocksource_ids.h | 1 + 3 files changed, 52 insertions(+), 19 deletions(-) diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 868f09966b0f..035ae5bec2e8 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c @@ -51,9 +51,9 @@ int tsc_clocksource_reliable; static int __read_mostly tsc_force_recalibrate; -static u32 art_to_tsc_numerator; -static u32 art_to_tsc_denominator; -static u64 art_to_tsc_offset; +static struct clocksource_base art_base_clk = { + .id = CSID_X86_ART, +}; static bool have_art; struct cyc2ns { @@ -1075,7 +1075,7 @@ core_initcall(cpufreq_register_tsc_scaling); */ static void __init detect_art(void) { - unsigned int unused[2]; + unsigned int unused; if (boot_cpu_data.cpuid_level < ART_CPUID_LEAF) return; @@ -1090,13 +1090,14 @@ static void __init detect_art(void) tsc_async_resets) return; - cpuid(ART_CPUID_LEAF, &art_to_tsc_denominator, - &art_to_tsc_numerator, unused, unused+1); + cpuid(ART_CPUID_LEAF, &art_base_clk.denominator, + &art_base_clk.numerator, &art_base_clk.freq_khz, &unused); - if (art_to_tsc_denominator < ART_MIN_DENOMINATOR) + art_base_clk.freq_khz /= KHZ; + if (art_base_clk.denominator < ART_MIN_DENOMINATOR) return; - rdmsrl(MSR_IA32_TSC_ADJUST, art_to_tsc_offset); + rdmsrl(MSR_IA32_TSC_ADJUST, art_base_clk.offset); /* Make this sticky over multiple CPU init calls */ setup_force_cpu_cap(X86_FEATURE_ART); @@ -1304,13 +1305,13 @@ struct system_counterval_t convert_art_to_tsc(u64 art) { u64 tmp, res, rem; - rem = do_div(art, art_to_tsc_denominator); + rem = do_div(art, art_base_clk.denominator); - res = art * art_to_tsc_numerator; - tmp = rem * art_to_tsc_numerator; + res = art * art_base_clk.numerator; + tmp = rem * art_base_clk.numerator; - do_div(tmp, art_to_tsc_denominator); - res += tmp + art_to_tsc_offset; + 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, @@ -1351,7 +1352,6 @@ struct system_counterval_t convert_art_ns_to_tsc(u64 art_ns) do_div(tmp, USEC_PER_SEC); res += tmp; - return (struct system_counterval_t) { .cs_id = have_art ? CSID_X86_TSC : CSID_GENERIC, .cycles = res @@ -1359,7 +1359,6 @@ struct system_counterval_t convert_art_ns_to_tsc(u64 art_ns) } 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); /** @@ -1461,8 +1460,10 @@ static void tsc_refine_calibration_work(struct work_struct *work) if (tsc_unstable) goto unreg; - if (boot_cpu_has(X86_FEATURE_ART)) + if (boot_cpu_has(X86_FEATURE_ART)) { have_art = true; + clocksource_tsc.base = &art_base_clk; + } clocksource_register_khz(&clocksource_tsc, tsc_khz); unreg: clocksource_unregister(&clocksource_tsc_early); @@ -1487,8 +1488,10 @@ static int __init init_tsc_clocksource(void) * the refined calibration and directly register it as a clocksource. */ if (boot_cpu_has(X86_FEATURE_TSC_KNOWN_FREQ)) { - if (boot_cpu_has(X86_FEATURE_ART)) + if (boot_cpu_has(X86_FEATURE_ART)) { have_art = true; + clocksource_tsc.base = &art_base_clk; + } clocksource_register_khz(&clocksource_tsc, tsc_khz); clocksource_unregister(&clocksource_tsc_early); @@ -1512,10 +1515,12 @@ static bool __init determine_cpu_tsc_frequencies(bool early) if (early) { cpu_khz = x86_platform.calibrate_cpu(); - if (tsc_early_khz) + if (tsc_early_khz) { tsc_khz = tsc_early_khz; - else + } else { tsc_khz = x86_platform.calibrate_tsc(); + clocksource_tsc.freq_khz = tsc_khz; + } } else { /* We should not be here with non-native cpu calibration */ WARN_ON(x86_platform.calibrate_cpu != native_calibrate_cpu); diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index 1d42d4b17327..0a1110a0e660 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h @@ -21,6 +21,7 @@ #include #include +struct clocksource_base; struct clocksource; struct module; @@ -48,6 +49,7 @@ struct module; * @archdata: Optional arch-specific data * @max_cycles: Maximum safe cycle value which won't overflow on * multiplication + * @freq_khz: Clocksource frequency in khz. * @name: Pointer to clocksource name * @list: List head for registration (internal) * @rating: Rating value for selection (higher is better) @@ -70,6 +72,8 @@ struct module; * validate the clocksource from which the snapshot was * taken. * @flags: Flags describing special properties + * @base: Hardware abstraction for clock on which a clocksource + * is based * @enable: Optional function to enable the clocksource * @disable: Optional function to disable the clocksource * @suspend: Optional suspend function for the clocksource @@ -105,12 +109,14 @@ struct clocksource { struct arch_clocksource_data archdata; #endif u64 max_cycles; + u32 freq_khz; const char *name; struct list_head list; int rating; enum clocksource_ids id; enum vdso_clock_mode vdso_clock_mode; unsigned long flags; + struct clocksource_base *base; int (*enable)(struct clocksource *cs); void (*disable)(struct clocksource *cs); @@ -294,4 +300,25 @@ static inline void timer_probe(void) {} extern ulong max_cswd_read_retries; void clocksource_verify_percpu(struct clocksource *cs); +/** + * struct clocksource_base - hardware abstraction for clock on which a clocksource + * is based + * @id: Defaults to CSID_GENERIC. The id value is used for conversion + * functions which require that the current clocksource is based + * on a clocksource_base with a particular ID in certain snapshot + * functions to allow callers to validate the clocksource from + * which the snapshot was taken. + * @freq_khz: Nominal frequency of the base clock in kHz + * @offset: Offset between the base clock and the clocksource + * @numerator: Numerator of the clock ratio between base clock and the clocksource + * @denominator: Denominator of the clock ratio between base clock and the clocksource + */ +struct clocksource_base { + enum clocksource_ids id; + u32 freq_khz; + u64 offset; + u32 numerator; + u32 denominator; +}; + #endif /* _LINUX_CLOCKSOURCE_H */ diff --git a/include/linux/clocksource_ids.h b/include/linux/clocksource_ids.h index a4fa3436940c..2bb4d8c2f1b0 100644 --- a/include/linux/clocksource_ids.h +++ b/include/linux/clocksource_ids.h @@ -9,6 +9,7 @@ enum clocksource_ids { CSID_X86_TSC_EARLY, CSID_X86_TSC, CSID_X86_KVM_CLK, + CSID_X86_ART, CSID_MAX, }; From patchwork Wed Jan 3 11:55:53 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: 184716 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4970211dyb; Wed, 3 Jan 2024 03:57:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IF+pYONS27sFYs44ySKEeXYR8iQiMF0Jch858Ze/geaBPqFDibZg20bwHTt4laJic0A7gwa X-Received: by 2002:a05:6e02:16c7:b0:35f:ea7b:7c19 with SMTP id 7-20020a056e0216c700b0035fea7b7c19mr27601715ilx.30.1704283062736; Wed, 03 Jan 2024 03:57:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704283062; cv=none; d=google.com; s=arc-20160816; b=i6MHzhO9kzxn9GFLH4K+TOAy24t33mTPBraN5z3oXxNff2IUMmkANigyRXBioAsIYk bjOHHmLjhir3om/fCMEg2IE3hxJ3XAWC/LJ62IftaDec2vw8c6MbOPeIZJwL8oxxx4Il gJC75bucCOcqJSJFkK//wAatPevxGC2BynINBvrudVxMEOgvMs4e3ZkTDdsDMwTB7HQB qtOgs1hE7yonz6gaxtYFj9DBJjYPrIBY4iqTXmAWU+2FFE/JNF990NdeAZHktaf88BI3 yUn4UDOYYbU7e8HGvafDubqlTZJe2nxff2135c3oCoZLHmcpeEuCs8ARZke2J5GoVOoY QcIw== 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=iKXTcezb/3a0w+NiCVNwBnrWfz7ZYrcx9iCAE/fVtgc=; fh=4NrVLy9e1N+ecgT+cYXeaYo3IQFJO3N8B6ul/oSBUd8=; b=CANREPspzGvKhOtdBNSxw5ixurUIaxHUyrTyTuUoLEB/ew5JJ1OhZVTGwJc3k34IAb 1OW4hZm0RXmQRGS1hNVeRogWMg/COrm41wDcnUDK0Pk7YVAqM8Xt2/16ivlKbWDhzXfH ZGmJMcuEgRfsUgY/cMzjTTt+/8MSC14axhu1y/vy0EZjgvUU/pmbCTmqZMZAD3iF1566 XrzetruKDigcjyYMf5x0hTeWg2b74aKvueumDmE+jzkj0RSWAlql/OQZ11Y7CFlm9yXw KXh+mzcNv88qPPFwrirjR5zybYHaHIJzBmJX9h2qGZ9mK4vMbHgxRblzbIHEnSmXnReJ +5rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TT3llQM8; spf=pass (google.com: domain of linux-kernel+bounces-15470-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15470-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id bs128-20020a632886000000b005cdbeb8228dsi20923589pgb.433.2024.01.03.03.57.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 03:57:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15470-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TT3llQM8; spf=pass (google.com: domain of linux-kernel+bounces-15470-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15470-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id C0275B21928 for ; Wed, 3 Jan 2024 11:57:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9257F199B2; Wed, 3 Jan 2024 11:56:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="TT3llQM8" 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 594F419469; Wed, 3 Jan 2024 11:56:23 +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=1704282983; x=1735818983; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=w+aeq0HJvcCZ+KS3uPOjGfoNyocIUqM1MwjS66a3tiI=; b=TT3llQM8un7D5nR5HeDfu3UNlW2Uws8HFmkyW2f2sU5qjo4LyUy/iiBN qwf74oYwsVYUHme558vZANeJfxxy48rsFMH9wzVehDwnL6/blTEB+Nkdb vaHfEcSITt/uRmSPp+xPQCyX/EcawzUDX0R6P5ySFhVy+MFHCaYR+x3Jg 0gAnq/XQOw/bQDms97KBwQAAxD354HiBnc/XT8/HNyd8+YJ2Gh02W2b4E xTiKb12UPQYYkUkMpijbzfCq96MzkKfilVzF1GH1hFc8MyEPj9ke1u16B orF+rCNPBqcyQHP3+NtvOt1oyc4zcAllo62OrcQm50GhDwFZFZ1wiAufh g==; X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="428169439" X-IronPort-AV: E=Sophos;i="6.04,327,1695711600"; d="scan'208";a="428169439" 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:56:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="1111348035" X-IronPort-AV: E=Sophos;i="6.04,327,1695711600"; d="scan'208";a="1111348035" Received: from inlubt0316.iind.intel.com ([10.191.20.213]) by fmsmga005.fm.intel.com with ESMTP; 03 Jan 2024 03:56:16 -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 02/11] timekeeping: Add function to convert realtime to base clock Date: Wed, 3 Jan 2024 17:25:53 +0530 Message-Id: <20240103115602.19044-3-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: 1787070316638491377 X-GMAIL-MSGID: 1787070316638491377 From: Lakshmi Sowjanya D Introduce an interface ktime_real_to_base_clock(), to convert realtime to base clock. Convert base clock to system clock using convert_base_to_cs() in get_device_system_crosststamp(). Add a helper function to check whether the current clocksource has same base clock. Co-developed-by: Thomas Gleixner Signed-off-by: Thomas Gleixner Co-developed-by: Christopher S. Hall Signed-off-by: Christopher S. Hall Signed-off-by: Lakshmi Sowjanya D --- include/linux/timekeeping.h | 6 ++ kernel/time/timekeeping.c | 112 +++++++++++++++++++++++++++++++++++- 2 files changed, 116 insertions(+), 2 deletions(-) diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 0f00f382bb5d..2c3bc2eac974 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -274,12 +274,18 @@ struct system_device_crosststamp { * timekeeping code to verify comparability of two cycle values. * The default ID, CSID_GENERIC, does not identify a specific * clocksource. + * @nsecs: @cycles is in nanoseconds. */ struct system_counterval_t { u64 cycles; enum clocksource_ids cs_id; + bool nsecs; }; +extern bool ktime_real_to_base_clock(ktime_t treal, + enum clocksource_ids base_id, u64 *cycles); +extern bool timekeeping_clocksource_has_base(enum clocksource_ids id); + /* * Get cross timestamp between system clock and device clock */ diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 0ff065c5d25b..e68ecd77ee34 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1191,6 +1191,89 @@ static bool cycle_between(u64 before, u64 test, u64 after) return false; } +static bool convert_clock(u64 *val, u32 numerator, u32 denominator) +{ + u64 rem, res; + + if (numerator == 0 || denominator == 0) + return false; + + res = div64_u64_rem(*val, denominator, &rem) * numerator; + *val = res + div_u64(rem * numerator, denominator); + return true; +} + +static bool convert_base_to_cs(struct system_counterval_t *scv) +{ + struct clocksource *cs = tk_core.timekeeper.tkr_mono.clock; + struct clocksource_base *base = cs->base; + + /* The timestamp was taken from the time keeper clock source */ + if (cs->id == scv->cs_id) + return true; + + /* Check whether cs_id matches the base clock */ + if (!base || base->id != scv->cs_id) + return false; + + /* Avoid conversion to a less precise clock */ + if (scv->nsecs && cs->freq_khz != 0 && base->freq_khz < cs->freq_khz) { + if (!convert_clock(&scv->cycles, cs->freq_khz, USEC_PER_SEC)) + return false; + } else { + if (scv->nsecs) { + if (!convert_clock(&scv->cycles, base->freq_khz, USEC_PER_SEC)) + return false; + } + if (!convert_clock(&scv->cycles, base->numerator, base->denominator)) + return false; + } + scv->cycles += base->offset; + return true; +} + +static bool convert_cs_to_base(u64 *cycles, enum clocksource_ids base_id) +{ + struct clocksource *cs = tk_core.timekeeper.tkr_mono.clock; + struct clocksource_base *base = cs->base; + + /* Check whether base_id matches the base clock */ + if (!base || base->id != base_id) + return false; + + *cycles -= base->offset; + if (!convert_clock(cycles, base->denominator, base->numerator)) + return false; + return true; +} + +static u64 convert_ns_to_cs(u64 delta) +{ + struct tk_read_base *tkr = &tk_core.timekeeper.tkr_mono; + + return div_u64((delta << tkr->shift) - tkr->xtime_nsec, tkr->mult); +} + +bool ktime_real_to_base_clock(ktime_t treal, enum clocksource_ids base_id, u64 *cycles) +{ + struct timekeeper *tk = &tk_core.timekeeper; + unsigned int seq; + u64 delta; + + do { + seq = read_seqcount_begin(&tk_core.seq); + delta = (u64)treal - tk->tkr_mono.base_real; + if (delta > tk->tkr_mono.clock->max_idle_ns) + return false; + *cycles = tk->tkr_mono.cycle_last + convert_ns_to_cs(delta); + if (!convert_cs_to_base(cycles, base_id)) + return false; + } while (read_seqcount_retry(&tk_core.seq, seq)); + + return true; +} +EXPORT_SYMBOL_GPL(ktime_real_to_base_clock); + /** * get_device_system_crosststamp - Synchronously capture system/device timestamp * @get_time_fn: Callback to get simultaneous device time and @@ -1236,8 +1319,7 @@ int get_device_system_crosststamp(int (*get_time_fn) * system counter value is the same as for the currently * installed timekeeper clocksource */ - if (system_counterval.cs_id == CSID_GENERIC || - tk->tkr_mono.clock->id != system_counterval.cs_id) + if (!convert_base_to_cs(&system_counterval)) return -ENODEV; cycles = system_counterval.cycles; @@ -1304,6 +1386,32 @@ int get_device_system_crosststamp(int (*get_time_fn) } EXPORT_SYMBOL_GPL(get_device_system_crosststamp); +/** + * timekeeping_clocksource_has_base - Check whether the current clocksource + * has a base clock + * @id: The clocksource ID to check for + * + * Note: The return value is a snapshot which can become invalid right + * after the function returns. + * + * Return: true if the timekeeper clocksource has a base clock with @id, + * false otherwise + */ +bool timekeeping_clocksource_has_base(enum clocksource_ids id) +{ + unsigned int seq; + bool ret; + + do { + seq = read_seqcount_begin(&tk_core.seq); + ret = tk_core.timekeeper.tkr_mono.clock->base ? + tk_core.timekeeper.tkr_mono.clock->base->id == id : false; + } while (read_seqcount_retry(&tk_core.seq, seq)); + + return ret; +} +EXPORT_SYMBOL_GPL(timekeeping_clocksource_has_base); + /** * do_settimeofday64 - Sets the time of day. * @ts: pointer to the timespec64 variable containing the new time From patchwork Wed Jan 3 11:55:54 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: 184717 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4970493dyb; Wed, 3 Jan 2024 03:58:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IHP8gRyMN2SEi2LfLihyzTfkWjeekJIhRtTEvIreSndzfp0QlhUTxde5FwjNpOFLo4VMxWp X-Received: by 2002:a05:6358:63a1:b0:175:3314:6a25 with SMTP id k33-20020a05635863a100b0017533146a25mr1874920rwh.5.1704283111470; Wed, 03 Jan 2024 03:58:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704283111; cv=none; d=google.com; s=arc-20160816; b=N3Mlx3qiwHAt2dt++ee9cHnR8/MFes+5kM8AH7mFWnYt19S162QAKKD+ULeupMYVbZ cG58reK7oKZuqzc4XtxXWhoOJfoS03aXT4Y1cZN3eJRSVdsP3RmpdkSb3JwGJvSypxcc ZNW1FIDBIGkPdnz9E+/EYNLp+Ws+oHn2qCfdPJIxFsZbCLd7cp3vSLkByuOSqP1rikNb C3Jb3bKru29h9xgc6cmNp0Z2k5J9VDDOoyl4riZMQvYjJUfuC+LWFzknuzitE24dxp8W Evq6NsaSCeiMQA2OLGn6ELQjuHYriB7ojo0IQ1NSdwhqdv/eoYp5sEYYk6KwGMlqsMPm ZHow== 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=gis08HwNa13gqJT4xSWhecfMDHqbJ3I83Rn/h46vHzk=; fh=4NrVLy9e1N+ecgT+cYXeaYo3IQFJO3N8B6ul/oSBUd8=; b=FDXgAcekSbM+caKrupNEgLFxd3515LSwljrfocZW8+ysTF6TL4RpcMqdxHcdxRk0re 5gcqQtf6E5+mL0UW/agrUqtk9rWMvOug1Ek+H7ytEp0vJlFv/rq28HPmRs/CS1sBjzT8 TM0OSgPNTEjuCYNtsSUKNK3xSF/oTdYma/Do2jOX3juAyec764xYhvAwya2X3Zq51OM4 FGfoV0S4I8PzE8oQnvdGranR6F05JKIniZh8k7SPJ9Z/NLN8N+jpyMu33mKMgy/DZ3BL /gNOhJvuPAlK8oEl47Pq6RdPsVJOiRYqUnjlmkYEL06lyvKGJWzLObzh3uID0QLcanjN oT7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZyhPTenc; spf=pass (google.com: domain of linux-kernel+bounces-15471-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15471-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id l123-20020a633e81000000b005ce037d6bd4si17954282pga.96.2024.01.03.03.58.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 03:58:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15471-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZyhPTenc; spf=pass (google.com: domain of linux-kernel+bounces-15471-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15471-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 7E963B21A3A for ; Wed, 3 Jan 2024 11:58:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5C66319BDC; Wed, 3 Jan 2024 11:56:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ZyhPTenc" 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 3AF64199AB; Wed, 3 Jan 2024 11:56:46 +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=1704283006; x=1735819006; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PmpIlUpx7+DXd9SlbVWYDCreHkh1wtkoXMr9WfcfHRg=; b=ZyhPTencLXNPF2dU4knc9n1fhsabCJ2utgsXfuoYfBa0HSC7grQgeXpC D8jGW4DqxvrvK7uXygZVCxrWm4i8xUVB2CZ4hcuR7/FvSjgxzKAOkDrvH oNxE8WM5pSYFopr+r8oiLjoxH97v/X82qBQxnAHTC/CJG7ljHzLY9NUiq bl6ukYG0olxlgt6pZmUREZskMFjdkvwBU2xtvbhEzECmzOOPiILuDw7pC XA0sce5JAFaewm68GWAACwkG692ATk3wUUr7AXcHnTsVZLmNs2z1zcJYG d6B1oSLSs/SU5/+hKwkpBDYzWbjnXF6DzYPUaMCl9eI7/Ln1+WRiXhkGT Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="428169480" X-IronPort-AV: E=Sophos;i="6.04,327,1695711600"; d="scan'208";a="428169480" 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:56:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="1111348051" X-IronPort-AV: E=Sophos;i="6.04,327,1695711600"; d="scan'208";a="1111348051" Received: from inlubt0316.iind.intel.com ([10.191.20.213]) by fmsmga005.fm.intel.com with ESMTP; 03 Jan 2024 03:56:22 -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 03/11] e10002: remove convert_art_to_tsc() Date: Wed, 3 Jan 2024 17:25:54 +0530 Message-Id: <20240103115602.19044-4-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: 1787070368129700563 X-GMAIL-MSGID: 1787070368129700563 From: Thomas Gleixner Remove convert_art_to_tsc() function call, Pass system clock cycles and clocksource ID as input to get_device_system_crosststamp(). Signed-off-by: Thomas Gleixner Signed-off-by: Lakshmi Sowjanya D --- drivers/net/ethernet/intel/e1000e/ptp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/e1000e/ptp.c b/drivers/net/ethernet/intel/e1000e/ptp.c index 02d871bc112a..9d8be03a9827 100644 --- a/drivers/net/ethernet/intel/e1000e/ptp.c +++ b/drivers/net/ethernet/intel/e1000e/ptp.c @@ -124,7 +124,8 @@ static int e1000e_phc_get_syncdevicetime(ktime_t *device, sys_cycles = er32(PLTSTMPH); sys_cycles <<= 32; sys_cycles |= er32(PLTSTMPL); - *system = convert_art_to_tsc(sys_cycles); + system->cycles = sys_cycles; + system->cs_id = CSID_X86_ART; return 0; } From patchwork Wed Jan 3 11:55:55 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: 184718 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4970655dyb; Wed, 3 Jan 2024 03:58:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IGROP7F7s/QZwrHwaKLmKX9X24TlWgatdp1PjbynzQV+VpbvRbbrHv5UDjqLKe0MPhcqhbI X-Received: by 2002:ac8:7f4f:0:b0:428:24fd:ec1f with SMTP id g15-20020ac87f4f000000b0042824fdec1fmr5549050qtk.94.1704283137136; Wed, 03 Jan 2024 03:58:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704283137; cv=none; d=google.com; s=arc-20160816; b=Z1yHuNwdMZIBGxIjh/MwmCjs5oa2BR7UzR7Hjhl8OksV1MPXmDYr4nAMR7F0B8JFAH rLzcv7OUwCVvqtL88jAe2331nSEMmNZorufmNxuPF5k7DcbEHVuXvgfx9sbXUmtmh3ar cCTdlfUu+I/b71U0angULPUeq73EDkk3jh+xat0X4NOyZ1FcovnS++Xgy9KfrxWGoT2m 1PuOi2/INnbuMqjGLGIZ4b1XSns+mjGsTtIHB6IW4hRFfI1YFip8LRSDo8vJkRAIqtIP Q/pqTFbQqTV0+svCw38Rv9pOLbjL4jVpQLws69xkXHJa/kCASYFq9sRCij9EJWz9T2Ul hwwg== 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=HY+3K73QFQIQdkcgLLe45LamK6tjdiSgaK06u0vyUyw=; fh=4NrVLy9e1N+ecgT+cYXeaYo3IQFJO3N8B6ul/oSBUd8=; b=uTTAzbOx84BBlLrAdTQK9KBH4WQVNuurEziCKk3sCV/IBF+jKRwBrPnGQUP3HzvV0a LBtG59jlmSGPqhCa6u0hFPbPrEGGlWgGP5r+zgSD/99vB7dcLDQsuRGQ3G0wiOevTKQO CLCJm+xRYQqf9hCN3Z+KitY3q5+GSirdcrwCcaXvdGQqvIttUTSoQJQbbudaj14QlSP6 Xm36HqtDSBhaqK+2yrv5y0pcIhtYtKF9fek8vy+Yb3ErruPWzai9Vw9S1Mieb0hMb4So pbTwdxD7c4LLcV3MfEegRNfcK/2AUby0J9hs1XJoFhHBrQeAVBRNc10KtwFvETQvxazx uVcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=amo91kT+; spf=pass (google.com: domain of linux-kernel+bounces-15472-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15472-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id x1-20020a05622a000100b0042583ddd457si28581965qtw.305.2024.01.03.03.58.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 03:58:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15472-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=amo91kT+; spf=pass (google.com: domain of linux-kernel+bounces-15472-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15472-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E79CB1C227D5 for ; Wed, 3 Jan 2024 11:58:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9193E1A5A1; Wed, 3 Jan 2024 11:56:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="amo91kT+" 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 70551199B6; Wed, 3 Jan 2024 11:56:47 +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=1704283007; x=1735819007; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=D/PGOAIibkxDj9zFnqmFxn8bnVqH9KXwIHXO5AddAko=; b=amo91kT+8xIn8KuIt3zwL9Ez+7SbdFXLpbi3ascRlsd9/QThO/yAnogj x5lO7SyykgoQ1dPju528wDtEmpyJku3jZeHUFA+nqoUBEopWpArh74lX8 DQxzYoS7uhlf25W6sPEFx4abYzZFQJjTTeSdVMY/Xbho/iybviGCQYimP qzKcsW2etRk3VjaKa7sHlF3uAOqNRMQCPgicsc2qzsPeZxqbGY3W3q2FU 2PcSjteTIi7w2ZGa7UGZdqZnMOZI9p5pwkzbn142qlmWFWobCNl0kMKXs cqVrCZCgdUT4L3Gyrdf9Ng6n65yWOvU0tUr5CTAjXrP/cWljE5jZJF1pQ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="428169500" X-IronPort-AV: E=Sophos;i="6.04,327,1695711600"; d="scan'208";a="428169500" 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:56:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="1111348069" X-IronPort-AV: E=Sophos;i="6.04,327,1695711600"; d="scan'208";a="1111348069" Received: from inlubt0316.iind.intel.com ([10.191.20.213]) by fmsmga005.fm.intel.com with ESMTP; 03 Jan 2024 03:56:29 -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 04/11] igc: remove convert_art_to_tsc() Date: Wed, 3 Jan 2024 17:25:55 +0530 Message-Id: <20240103115602.19044-5-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: 1787070394774777406 X-GMAIL-MSGID: 1787070394774777406 From: Thomas Gleixner Remove convert_art_to_tsc() function call, Pass system clock cycles and clocksource ID as input to get_device_system_crosststamp(). Signed-off-by: Thomas Gleixner Signed-off-by: Lakshmi Sowjanya D --- drivers/net/ethernet/intel/igc/igc_ptp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/igc/igc_ptp.c b/drivers/net/ethernet/intel/igc/igc_ptp.c index 928f38792203..7899947cc855 100644 --- a/drivers/net/ethernet/intel/igc/igc_ptp.c +++ b/drivers/net/ethernet/intel/igc/igc_ptp.c @@ -911,7 +911,11 @@ static bool igc_is_crosststamp_supported(struct igc_adapter *adapter) static struct system_counterval_t igc_device_tstamp_to_system(u64 tstamp) { #if IS_ENABLED(CONFIG_X86_TSC) && !defined(CONFIG_UML) - return convert_art_ns_to_tsc(tstamp); + return (struct system_counterval_t) { + .cs_id = CSID_X86_ART, + .cycles = tstamp, + .nsecs = true, + }; #else return (struct system_counterval_t) { }; #endif From patchwork Wed Jan 3 11:55:56 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: 184719 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4970680dyb; Wed, 3 Jan 2024 03:59:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IE9nwXFJD9oM/50o+hcttKZ3fVpnUa56Is4qFxgXfcQsoDNkNQCfrKA5GIT49wQ3iJ75p9A X-Received: by 2002:a17:902:d4c9:b0:1d4:5ead:b700 with SMTP id o9-20020a170902d4c900b001d45eadb700mr14594384plg.30.1704283140946; Wed, 03 Jan 2024 03:59:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704283140; cv=none; d=google.com; s=arc-20160816; b=wryPxwbgDrxzSn2WTYNWUkXzEBk/TFSMLEpGzgZqNWc5PEKYhZtTWeiD/nxqMBKs/P h9frLNGwsBMQAG5EUhd0iwtU/oIdH366kcuw8aA1AjoaytbRKvufMy7ibTkJukNojkPl 2TgJvcD2uMRf8Ye3btTJyY2IodqZihrUlBIB89srvVBKycI5tXlTvy786F+EVeb1fIQC aN3oRf5DeqX+F5R7Tbo5VpX3i+9EgIMln3TMDkcip5nyc98i/1VTtpGf8XL7mc6y8Sdm tQzb9EfPDtxKYgHiQi77GJUo7kX3V9fXr6VYcaLGbeFBrD+EAW3GlWO/9fWD9eJxKfrB PCXA== 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=qbDf6mDOr5pUTTrGJy5r3HxwSzx5reuigJeU16xqtBs=; fh=4NrVLy9e1N+ecgT+cYXeaYo3IQFJO3N8B6ul/oSBUd8=; b=MsKG/SfYqUFefOyZadYkxsNSu9mh+NWWKiQi/R9o/FW8VIif0DXG7d8+j/PUbS542H BZmzNwRNtd3BRV1EU3JwAD5AcrW9Ib5HP4ADFpcFi1c4ufvp/azF1dXKm4McYB+DF3KL 6BOWBLMYAdNs3FiKVBYSPSy/2Fs/rc36S34xsdAmwtboYmCAg46kw2hbUeH0B/OEzPDH aZ9toliDP26wwCWj/kAVjYv4l25sWibCIaW+FK3LvPriQ7omb0YgM4zwDJLVNyQu0KUt oH1Xfm0nylcrAPmMm8SMHRXMfattZtnd3qU/h7ggP/J5EfxmrVj8Lmp6Hy71/AglbcEy tWeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YvX9s4Bh; spf=pass (google.com: domain of linux-kernel+bounces-15473-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15473-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id a11-20020a1709027d8b00b001d4b1c776c4si5480559plm.376.2024.01.03.03.59.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 03:59:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15473-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YvX9s4Bh; spf=pass (google.com: domain of linux-kernel+bounces-15473-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15473-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id B1DA8285276 for ; Wed, 3 Jan 2024 11:59:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CE05F1A5AB; Wed, 3 Jan 2024 11:56:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="YvX9s4Bh" 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 DCCC718EAB; Wed, 3 Jan 2024 11:56:47 +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=1704283008; x=1735819008; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uUU6Aeoh21pgVprRQuKox95GRqR5aTWn9mMsl4N1jcQ=; b=YvX9s4BhIIrfnwiiXiUSTSd9ON1+2DxaaQ15amj47ZNuWsaebkrOL0gD C77ewvKKlv2+hfQ63RKGW9mNUVjqKdmkpU1f1sny7l74XQlTb79QpRfG1 SI/N+OsDyJj8Ud3X9almYPKqsvoDYX0xYtpiTcsX4kD27X91OOMUpFwqh xBjhwvt5TV6uhDde2SSV7g9AmPeknasCnwHn/rNTHoKQGFHjjfAO1d/6Y OqLeZ8I409VK9AFSTKp3JQ4zH0hlFgQ0RCK6Q633H3X42+lD0OxqAwydq H9dGEzxGdD57wBidey9KTKnAKPLE+jvk4T8ZSKkln1cf6cIkAmeGk7PfK g==; X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="428169515" X-IronPort-AV: E=Sophos;i="6.04,327,1695711600"; d="scan'208";a="428169515" 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:56:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="1111348081" X-IronPort-AV: E=Sophos;i="6.04,327,1695711600"; d="scan'208";a="1111348081" Received: from inlubt0316.iind.intel.com ([10.191.20.213]) by fmsmga005.fm.intel.com with ESMTP; 03 Jan 2024 03:56:35 -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 05/11] stmmac: intel: remove convert_art_to_tsc() Date: Wed, 3 Jan 2024 17:25:56 +0530 Message-Id: <20240103115602.19044-6-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: 1787070398516561492 X-GMAIL-MSGID: 1787070398516561492 From: Thomas Gleixner Remove convert_art_to_tsc() function call, Pass system clock cycles and clocksource ID as input to get_device_system_crosststamp(). Signed-off-by: Thomas Gleixner Signed-off-by: Lakshmi Sowjanya D --- drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c index 60283543ffc8..e73fa34237d3 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c @@ -390,10 +390,11 @@ static int intel_crosststamp(ktime_t *device, *device = ns_to_ktime(ptp_time); read_unlock_irqrestore(&priv->ptp_lock, flags); get_arttime(priv->mii, intel_priv->mdio_adhoc_addr, &art_time); - *system = convert_art_to_tsc(art_time); + system->cycles = art_time; } system->cycles *= intel_priv->crossts_adj; + system->cs_id = CSID_X86_ART; priv->plat->flags &= ~STMMAC_FLAG_INT_SNAPSHOT_EN; return 0; From patchwork Wed Jan 3 11:55:57 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: 184720 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4970750dyb; Wed, 3 Jan 2024 03:59:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IEsjlVtAIVPNZggoPV5Wya8ek8gUPpC1NngaVKGVzsGLxAaCMtRzGwTKgzIFWQd6okplpAm X-Received: by 2002:a05:6a20:8e28:b0:197:792b:1d6e with SMTP id y40-20020a056a208e2800b00197792b1d6emr428023pzj.63.1704283153536; Wed, 03 Jan 2024 03:59:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704283153; cv=none; d=google.com; s=arc-20160816; b=VMRRmsPjTE0uqE/kE3NPJzZQ1DjNJY8mXFA8a+YCgCg1Ik4qR26fIlU9Swxu5RtbWI XK6gw+6v4Aqpzf0K3BcIiX9rdLKEPflJDHXAEEnRMysvA0XxwFKZQep8BBc6LqHtluAD D4pFTqQcLY7pGndqqFMYLMd4OUdpODk5xk6ePc/7IxiFQG1UpWBBeqaocPfEhPrdFBjO BqgQR7Y9X00YUFnLQAut4jCuu49g4dA1nuqjNoHWU5g0YQzKhWIiXpoeSk4vdn0OrJUs AjkO+iwOyYFNG2U2NApLbV+XqKMGBMw3I/9wtTmMM3JqelORUR/46YWNSrLrqymWwe1c Rc5w== 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=F6DDAwnJyc7gqeXQy1eTazJ5RGN2XJInOFeV5shtaVI=; fh=4NrVLy9e1N+ecgT+cYXeaYo3IQFJO3N8B6ul/oSBUd8=; b=BIpTt9d4Y6947NnpOZteEQRu0SkBy8dFkXAusNEJbXuIJSEwo8RC+ExvzVTnZe4pgt pM8nP39soWJCeWJrx8xL3fIudJK9Nc9JstKUP4Q3oluwrgYFwaRmps3KbMJpKX4o8eAO RW/NBQaX0QgPLTYwbY2u2M410zjf11B2BHvY4nrV8iee36NaaB8mA1dL8cOUX2rWTNdj Z6kLj81a8FxIr7UV0OnOXmlwFhHoCuZPdre9c2CT/aT6jIwDtiRDz5uUfV0NW4ag8Fbe WTx9zy4FkMq9BmRCAp6wnClDH1vn1zih2aBhR7ACRX6TCkbhkDdweQw1dHgxk+qVFUdl FgDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="DPhFDyz/"; spf=pass (google.com: domain of linux-kernel+bounces-15474-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15474-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id p13-20020a635b0d000000b005cdc2cc9a17si21638226pgb.797.2024.01.03.03.59.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 03:59:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15474-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="DPhFDyz/"; spf=pass (google.com: domain of linux-kernel+bounces-15474-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15474-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 51896284F5C for ; Wed, 3 Jan 2024 11:59:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 496061A70A; Wed, 3 Jan 2024 11:56:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="DPhFDyz/" 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 136C419469; Wed, 3 Jan 2024 11:56:49 +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=1704283009; x=1735819009; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=C3p46caV8CRS4j/dEHJyoZnEtIablwurupbiv6nNHMI=; b=DPhFDyz/my2D02keicqCZv6T6z8Du1LA10nwV56+pQPlU7Xd8VVcaryI hFo9KXImss8K+ygnr7CkKwLCf4FXenB8+5pWqsYSjhpfaCzquL7tb9IpX vDpjWYuoS9Lkb0kLcWsLfZAncIzdz86DJ67+r2oZdLcpiEi7LgvlZJtKY 1clerfFKahg6Sc1b83i7fG8BoKu3w2Hkc59MgfHOZmwhPtEtB7y37ZF+P G9tkCIuSlpAZnHnPO8pwS5bVd/TtMIku+eamU5XYrKguKdZxqQ+QtvMEE ValEAEH7eUa/l0LKramYG5HBlKbtFzs2nrEjp8g846gyqDfWkPRBl1oa8 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="428169541" X-IronPort-AV: E=Sophos;i="6.04,327,1695711600"; d="scan'208";a="428169541" 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:56:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="1111348097" X-IronPort-AV: E=Sophos;i="6.04,327,1695711600"; d="scan'208";a="1111348097" Received: from inlubt0316.iind.intel.com ([10.191.20.213]) by fmsmga005.fm.intel.com with ESMTP; 03 Jan 2024 03:56:41 -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 06/11] ALSA: hda: remove convert_art_to_tsc() Date: Wed, 3 Jan 2024 17:25:57 +0530 Message-Id: <20240103115602.19044-7-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: 1787070412118539387 X-GMAIL-MSGID: 1787070412118539387 From: Thomas Gleixner Remove convert_art_to_tsc() function call, Pass system clock cycles and clocksource ID as input to get_device_system_crosststamp(). Signed-off-by: Thomas Gleixner Signed-off-by: Lakshmi Sowjanya D --- sound/pci/hda/hda_controller.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c index c42e9ffff9db..787521d7f3b1 100644 --- a/sound/pci/hda/hda_controller.c +++ b/sound/pci/hda/hda_controller.c @@ -457,7 +457,8 @@ static int azx_get_sync_time(ktime_t *device, *device = ktime_add_ns(*device, (wallclk_cycles * NSEC_PER_SEC) / ((HDA_MAX_CYCLE_VALUE + 1) * runtime->rate)); - *system = convert_art_to_tsc(tsc_counter); + system->cycles = tsc_counter; + system->cs_id = CSID_X86_ART; return 0; } From patchwork Wed Jan 3 11:55:58 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: 184721 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4970938dyb; Wed, 3 Jan 2024 03:59:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IHapi/vhYx2SMdi/h99XK+2+U94AiFCiA/+h2YmyOBI65bZigcjS9mqw7IS8kjAHD1GMcN8 X-Received: by 2002:a17:906:f24c:b0:a26:c2ee:b088 with SMTP id gy12-20020a170906f24c00b00a26c2eeb088mr853759ejb.57.1704283185201; Wed, 03 Jan 2024 03:59:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704283185; cv=none; d=google.com; s=arc-20160816; b=vjPbf8EDHj9fdFv5/SxNrNILdDzG9Z4YiK3NpTMUmGQr216hm471pac78LC2lo7jU3 5vDNUouqB2H9zGaU6foWITUBD5ikZcSzIVlBTNmpj/oHrrubM4AvBznLF7gAr3Z28gMi 5+hIS+MdG9pDMsCVymf6L4TnGUhdD33vLZJPUpXfTLeKI+6L/783qVuIjqux4YgGP3ji hYzZ/CDYtwvmFoMhJq+porJI+DnV5M02m4ZfheK9kAoToizuFV3IzMRpnNeQ/0dKqxyZ rxpOYy3SJI5KgNRlEXF9ophXBAAz2K4dwxtfuZ7wVp+Ri/FwPqPiIoEhQ5fiW3IqJrib zE3Q== 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=+xK5Qg9KSIPkv/nQ9AM9OwYbjDloqDgJX/+IIJ7S58c=; fh=4NrVLy9e1N+ecgT+cYXeaYo3IQFJO3N8B6ul/oSBUd8=; b=JDrAAZl8V1v7c65jT6j9/8mUPIQeoLkSY14GrOWnOCldQkA4t1I5sS+d8zvnVRgYxb 6oM9LkHeSCf29v0JoNb19I/5bttlJYPjF7W+2RDvwmvIqRJGNJOHU9nLd46wEJKNFFYb NpRlyjXKzYavUWsKFLzIRedCKjk+L/e3cinfsDpkApTLNmdsym8oPC8j7H8df5DqBnyC KAPY1AOmAi3LX48OApDBthE97VYaYoUTIYPkdTh8VDOxN2Hkdmq9ictDQSUNXb+wLzml P5i22vP+VZSMXVpE062HDsvFtV4lu+4Md0yoLdbosb2uCj7R0BsD153Bm7xv0J2vZEJ3 UIZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ORtU6G6q; spf=pass (google.com: domain of linux-kernel+bounces-15475-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15475-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 gh20-20020a1709073c1400b00a26afef8ca3si10487873ejc.365.2024.01.03.03.59.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 03:59:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15475-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=ORtU6G6q; spf=pass (google.com: domain of linux-kernel+bounces-15475-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15475-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 C83841F23829 for ; Wed, 3 Jan 2024 11:59:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD9FF1A73F; Wed, 3 Jan 2024 11:56:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ORtU6G6q" 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 E645319469; Wed, 3 Jan 2024 11:56:54 +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=1704283015; x=1735819015; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+PyxmFRWe/t75785UAnv5jwKbLbVhxVPk8E+eOUGbOw=; b=ORtU6G6q9S0Fd8VQ/8UcYGBoMiWDuw7HpT4VHUURUf41b0x88ibB6sLi LRjw9sEcTlWk90JUMo9cqeeDBD//EKZjt+WEPtbvgNcHcFgAqe4YqWkKQ x/EDzpJJ9xJKB5jFGjkFsrAYDnAzk1qavKtHjcL3meIVOh6CKzy5nOCKx oyNWIgkL+u9R1MhPl4qTTc2AiR3/814i2LD0zsonVryX6oUFmvzzjN8Gg +X0a2cz76jK6gQX+q1ruc0DLEwy/ojREsQz4r7v5lFFoWD9FS2eA1KT+R 7wHlRwCXSZkpoP4zzTfVfQrRzhBuUW1MqcNRULqQD0ZZyuHHy5EzRVHPl A==; X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="428169554" X-IronPort-AV: E=Sophos;i="6.04,327,1695711600"; d="scan'208";a="428169554" 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:56:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="1111348106" X-IronPort-AV: E=Sophos;i="6.04,327,1695711600"; d="scan'208";a="1111348106" Received: from inlubt0316.iind.intel.com ([10.191.20.213]) by fmsmga005.fm.intel.com with ESMTP; 03 Jan 2024 03:56:48 -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 07/11] ice/ptp: remove convert_art_to_tsc() Date: Wed, 3 Jan 2024 17:25:58 +0530 Message-Id: <20240103115602.19044-8-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: 1787070445634716816 X-GMAIL-MSGID: 1787070445634716816 From: Thomas Gleixner Remove convert_art_to_tsc() function call, Pass system clock cycles and clocksource ID as input to get_device_system_crosststamp(). Signed-off-by: Thomas Gleixner Signed-off-by: Lakshmi Sowjanya D --- drivers/net/ethernet/intel/ice/ice_ptp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c index 71f405f8a6fe..f4611a5d8c27 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp.c +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c @@ -1978,7 +1978,7 @@ ice_ptp_get_syncdevicetime(ktime_t *device, hh_ts_lo = rd32(hw, GLHH_ART_TIME_L); hh_ts_hi = rd32(hw, GLHH_ART_TIME_H); hh_ts = ((u64)hh_ts_hi << 32) | hh_ts_lo; - *system = convert_art_ns_to_tsc(hh_ts); + system->cycles = hh_ts; /* Read Device source clock time */ hh_ts_lo = rd32(hw, GLTSYN_HHTIME_L(tmr_idx)); hh_ts_hi = rd32(hw, GLTSYN_HHTIME_H(tmr_idx)); 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); /** From patchwork Wed Jan 3 11:56:00 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: 184724 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4971779dyb; Wed, 3 Jan 2024 04:01:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IF1tLFZ4Owxn4UbuCn3tEycLI3+t/U4E8QTdz51i8Asy+vzocy5IyRbdR9IO1M1QJOkE5GC X-Received: by 2002:a17:902:6e0f:b0:1d4:7381:dc33 with SMTP id u15-20020a1709026e0f00b001d47381dc33mr11197382plk.0.1704283268206; Wed, 03 Jan 2024 04:01:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704283268; cv=none; d=google.com; s=arc-20160816; b=v7nkO4sgvJHXO9gszEPePB4WImNrphZYpPpX3Z/wBJJIogeEyML8fFBRTDYxeT97l+ ofv31mlyUfb2A3ojVkOKUu5fOt2xbFgjxFSotU3s+Sg22KR4QT8C3XnHsmnMPQUE08hY JIo+jEmiYx0jl2hWzCKvpS7Ix+gID++ogmhRzYybLrS2YP+KQO+dF4ljyLKGhDeuyEoF XErE/5u3PaFsb4YmhLZxWz0mcLp3oaL9uCE5hBD6mY7Df2pQ4gfBy/6cdcROX1DM8BWE VeYdyvXoGw9GxJeUPWqIY+90tEMfo8bgvdiQ+UNSnDxOnWVD6e422d+RRGVsRTMHnWp7 XXDA== 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=2QljlU7E2sJGrvdaG/a5w15mv5n+W3LSwChxBU+8OKg=; fh=4NrVLy9e1N+ecgT+cYXeaYo3IQFJO3N8B6ul/oSBUd8=; b=ojyFGri3LA89daHPzbPT/E6z+QHaCNWMYKPETnOl0L2xgRX8ZAxFdUk+i/UeXzMcer gYKKNL942LM3BqmCEOfTxiic4xj6ExAXCUs9zWKcnN8yrDjgymOqB5AxzUEZRrf398Q/ ZF9bRZCeqQqUd2vrqt3Jr3xQ8CFvyUk0MkrlBbflXGLIdv7xKteZhKRlvv/jcale/JQW bjhH+CAN7s/hBCbcVnisWG0xRdXkIMjPUzMXPnUAhpwVtc3oV1eWuKgdJPDBU1mEzuwP fFfApVXHl3pY1tluNdfbRiEqyx2rtoDQvtMm7WkEd+A0Tip43K/tdG9WFHzeFMIUak9R jZiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=io5Moj1v; spf=pass (google.com: domain of linux-kernel+bounces-15477-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15477-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 66-20020a17090a09c800b0028cbf77f0cesi1110555pjo.102.2024.01.03.04.01.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 04:01:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15477-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=io5Moj1v; spf=pass (google.com: domain of linux-kernel+bounces-15477-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15477-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 1B3D8B234AB for ; Wed, 3 Jan 2024 12:00:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7B7371BDD8; Wed, 3 Jan 2024 11:57:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="io5Moj1v" 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 34AA51B297; Wed, 3 Jan 2024 11:57:09 +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=1704283030; x=1735819030; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vQX8zNWVTLYYy3JY3x1fHcqNprd6z6ajaQA72ST/yRk=; b=io5Moj1vBF/0ceRrmUevbv8SRIsfvUATAAahtZHgvOrme+BCcpFHJ6Nj IwAdwGtI+uUKyhJMlCnpO0807AufbY6/h5RCgz65D66f6Mqq4amYqvlli SOUd5Aw7mH4dPHil9SaHMjSEPUFa9yCe1/hxkC7Ys6ff52N9Ux8afCfty 5g3eGGYRqzpldNDRiM11RNtVJg6E19AGvVLPwu7JjG53XVlmv2JXRgjue 06UFNEt5Jyk6W2TjhCOc5idPAvXImefT7dpsqVhBbzGpsvMWGDJAd6h08 KcKFrB0pNgWVfmjHghv/52v7+kA5CnSBRz6FHptXG7EtqdmXiDOHLauXJ g==; X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="428169590" X-IronPort-AV: E=Sophos;i="6.04,327,1695711600"; d="scan'208";a="428169590" 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:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="1111348126" X-IronPort-AV: E=Sophos;i="6.04,327,1695711600"; d="scan'208";a="1111348126" Received: from inlubt0316.iind.intel.com ([10.191.20.213]) by fmsmga005.fm.intel.com with ESMTP; 03 Jan 2024 03:57:00 -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 09/11] pps: generators: Add PPS Generator TIO Driver Date: Wed, 3 Jan 2024 17:26:00 +0530 Message-Id: <20240103115602.19044-10-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: 1787070532295466639 X-GMAIL-MSGID: 1787070532295466639 From: Lakshmi Sowjanya D The Intel Timed IO PPS generator driver outputs a PPS signal using dedicated hardware that is more accurate than software actuated PPS. The Timed IO hardware generates output events using the ART timer. The ART timer period varies based on platform type, but is less than 100 nanoseconds for all current platforms. Timed IO output accuracy is within 1 ART period. PPS output is enabled by writing '1' the 'enable' sysfs attribute. The driver uses hrtimers to schedule a wake-up 10 ms before each event (edge) target time. At wakeup, the driver converts the target time in terms of CLOCK_REALTIME to ART trigger time and writes this to the Timed IO hardware. The Timed IO hardware generates an event precisely at the requested system time without software involvement. Co-developed-by: Christopher Hall Signed-off-by: Christopher Hall Co-developed-by: Pandith N Signed-off-by: Pandith N Co-developed-by: Thejesh Reddy T R Signed-off-by: Thejesh Reddy T R Signed-off-by: Lakshmi Sowjanya D Reviewed-by: Eddie Dong Reviewed-by: Andy Shevchenko --- drivers/pps/generators/Kconfig | 16 ++ drivers/pps/generators/Makefile | 1 + drivers/pps/generators/pps_gen_tio.c | 245 +++++++++++++++++++++++++++ 3 files changed, 262 insertions(+) create mode 100644 drivers/pps/generators/pps_gen_tio.c diff --git a/drivers/pps/generators/Kconfig b/drivers/pps/generators/Kconfig index d615e640fcad..0f090932336f 100644 --- a/drivers/pps/generators/Kconfig +++ b/drivers/pps/generators/Kconfig @@ -12,3 +12,19 @@ config PPS_GENERATOR_PARPORT If you say yes here you get support for a PPS signal generator which utilizes STROBE pin of a parallel port to send PPS signals. It uses parport abstraction layer and hrtimers to precisely control the signal. + +config PPS_GENERATOR_TIO + tristate "TIO PPS signal generator" + depends on X86 && CPU_SUP_INTEL + help + If you say yes here you get support for a PPS TIO signal generator + which generates a pulse at a prescribed time based on the system clock. + It uses time translation and hrtimers to precisely generate a pulse. + This hardware is present on 2019 and newer Intel CPUs. However, this + driver is not useful without adding highly specialized hardware outside + the Linux system to observe these pulses. + + To compile this driver as a module, choose M here: the module + will be called pps_gen_tio. + + If unsure, say N. diff --git a/drivers/pps/generators/Makefile b/drivers/pps/generators/Makefile index 2d56dd0495d5..07004cfd3996 100644 --- a/drivers/pps/generators/Makefile +++ b/drivers/pps/generators/Makefile @@ -4,6 +4,7 @@ # obj-$(CONFIG_PPS_GENERATOR_PARPORT) += pps_gen_parport.o +obj-$(CONFIG_PPS_GENERATOR_TIO) += pps_gen_tio.o ifeq ($(CONFIG_PPS_DEBUG),y) EXTRA_CFLAGS += -DDEBUG diff --git a/drivers/pps/generators/pps_gen_tio.c b/drivers/pps/generators/pps_gen_tio.c new file mode 100644 index 000000000000..3ee271524482 --- /dev/null +++ b/drivers/pps/generators/pps_gen_tio.c @@ -0,0 +1,245 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Intel PPS signal Generator Driver + * + * Copyright (C) 2023 Intel Corporation + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define TIOCTL 0x00 +#define TIOCOMPV 0x10 + +/* Control Register */ +#define TIOCTL_EN BIT(0) +#define TIOCTL_DIR BIT(1) +#define TIOCTL_EP GENMASK(3, 2) +#define TIOCTL_EP_RISING_EDGE FIELD_PREP(TIOCTL_EP, 0) +#define TIOCTL_EP_FALLING_EDGE FIELD_PREP(TIOCTL_EP, 1) +#define TIOCTL_EP_TOGGLE_EDGE FIELD_PREP(TIOCTL_EP, 2) + +#define SAFE_TIME_NS (10 * NSEC_PER_MSEC) /* Safety time to set hrtimer early */ +#define MAGIC_CONST (NSEC_PER_SEC - SAFE_TIME_NS) +#define ART_HW_DELAY_CYCLES 2 + +struct pps_tio { + struct hrtimer timer; + struct device *dev; + spinlock_t lock; + struct attribute_group attrs; + void __iomem *base; + bool enabled; +}; + +static inline u32 pps_ctl_read(struct pps_tio *tio) +{ + return readl(tio->base + TIOCTL); +} + +static inline void pps_ctl_write(struct pps_tio *tio, u32 value) +{ + writel(value, tio->base + TIOCTL); +} + +/* For COMPV register, It's safer to write higher 32-bit followed by lower 32-bit */ +static inline void pps_compv_write(struct pps_tio *tio, u64 value) +{ + hi_lo_writeq(value, tio->base + TIOCOMPV); +} + +static inline ktime_t first_event(struct pps_tio *tio) +{ + return ktime_set(ktime_get_real_seconds() + 1, MAGIC_CONST); +} + +static u32 pps_tio_disable(struct pps_tio *tio) +{ + u32 ctrl; + + ctrl = pps_ctl_read(tio); + pps_compv_write(tio, 0); + + ctrl &= ~TIOCTL_EN; + pps_ctl_write(tio, ctrl); + + return ctrl; +} + +static void pps_tio_direction_output(struct pps_tio *tio) +{ + u32 ctrl; + + ctrl = pps_tio_disable(tio); + + /* We enable the device, be sure that the 'compare' value is invalid */ + pps_compv_write(tio, 0); + + ctrl &= ~(TIOCTL_DIR | TIOCTL_EP); + ctrl |= TIOCTL_EP_TOGGLE_EDGE; + pps_ctl_write(tio, ctrl); + + ctrl |= TIOCTL_EN; + pps_ctl_write(tio, ctrl); +} + +static bool pps_generate_next_pulse(struct pps_tio *tio, ktime_t expires) +{ + u64 art; + + if (!ktime_real_to_base_clock(expires, CSID_X86_ART, &art)) { + pps_tio_disable(tio); + return false; + } + + pps_compv_write(tio, art - ART_HW_DELAY_CYCLES); + return true; +} + +static enum hrtimer_restart hrtimer_callback(struct hrtimer *timer) +{ + struct pps_tio *tio = container_of(timer, struct pps_tio, timer); + ktime_t expires, now; + + guard(spinlock)(&tio->lock); + + expires = hrtimer_get_expires(timer); + now = ktime_get_real(); + + if (now - expires < SAFE_TIME_NS) { + if (!pps_generate_next_pulse(tio, expires + SAFE_TIME_NS)) + return HRTIMER_NORESTART; + } + + hrtimer_forward(timer, now, NSEC_PER_SEC / 2); + return HRTIMER_RESTART; +} + +static ssize_t enable_store(struct device *dev, struct device_attribute *attr, const char *buf, + size_t count) +{ + struct pps_tio *tio = dev_get_drvdata(dev); + bool enable; + int err; + + err = kstrtobool(buf, &enable); + if (err) + return err; + + guard(spinlock_irqsave)(&tio->lock); + if (enable && !tio->enabled) { + if (!timekeeping_clocksource_has_base(CSID_X86_ART)) { + dev_err(tio->dev, "PPS cannot be started as clock is not related to ART"); + return -EPERM; + } + pps_tio_direction_output(tio); + hrtimer_start(&tio->timer, first_event(tio), HRTIMER_MODE_ABS); + tio->enabled = true; + } else if (!enable && tio->enabled) { + hrtimer_cancel(&tio->timer); + pps_tio_disable(tio); + tio->enabled = false; + } + return count; +} + +static ssize_t enable_show(struct device *dev, struct device_attribute *devattr, char *buf) +{ + struct pps_tio *tio = dev_get_drvdata(dev); + u32 ctrl; + + ctrl = pps_ctl_read(tio); + ctrl &= TIOCTL_EN; + + return sysfs_emit(buf, "%u\n", ctrl); +} +static DEVICE_ATTR_RW(enable); + +static struct attribute *pps_tio_attrs[] = { + &dev_attr_enable.attr, + NULL +}; +ATTRIBUTE_GROUPS(pps_tio); + +static int pps_tio_probe(struct platform_device *pdev) +{ + struct pps_tio *tio; + + if (!(cpu_feature_enabled(X86_FEATURE_TSC_KNOWN_FREQ) && + cpu_feature_enabled(X86_FEATURE_ART))) { + dev_warn(&pdev->dev, "TSC/ART is not enabled"); + return -ENODEV; + } + + tio = devm_kzalloc(&pdev->dev, sizeof(*tio), GFP_KERNEL); + if (!tio) + return -ENOMEM; + + tio->dev = &pdev->dev; + tio->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(tio->base)) + return PTR_ERR(tio->base); + + pps_tio_disable(tio); + hrtimer_init(&tio->timer, CLOCK_REALTIME, HRTIMER_MODE_ABS); + tio->timer.function = hrtimer_callback; + spin_lock_init(&tio->lock); + tio->enabled = false; + platform_set_drvdata(pdev, tio); + + return 0; +} + +static int pps_tio_remove(struct platform_device *pdev) +{ + struct pps_tio *tio = platform_get_drvdata(pdev); + + hrtimer_cancel(&tio->timer); + pps_tio_disable(tio); + + return 0; +} + +static const struct acpi_device_id intel_pmc_tio_acpi_match[] = { + { "INTC1021" }, + { "INTC1022" }, + { "INTC1023" }, + { "INTC1024" }, + {} +}; +MODULE_DEVICE_TABLE(acpi, intel_pmc_tio_acpi_match); + +static struct platform_driver pps_tio_driver = { + .probe = pps_tio_probe, + .remove = pps_tio_remove, + .driver = { + .name = "intel-pps-generator", + .acpi_match_table = intel_pmc_tio_acpi_match, + .dev_groups = pps_tio_groups, + }, +}; +module_platform_driver(pps_tio_driver); + +MODULE_AUTHOR("Lakshmi Sowjanya D "); +MODULE_AUTHOR("Christopher Hall "); +MODULE_AUTHOR("Pandith N "); +MODULE_AUTHOR("Thejesh Reddy T R "); +MODULE_DESCRIPTION("Intel PMC Time-Aware IO Generator Driver"); +MODULE_LICENSE("GPL"); From patchwork Wed Jan 3 11:56:01 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: 184723 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4971630dyb; Wed, 3 Jan 2024 04:00:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IEm5UnifDCH1QFHe0lGmxWBV835/nQ3PP3DEFeVYQ6Luy1G7RY3B2xds5YvOqfICnNNtipL X-Received: by 2002:a05:6a20:7828:b0:198:e949:51fa with SMTP id a40-20020a056a20782800b00198e94951famr129809pzg.32.1704283257410; Wed, 03 Jan 2024 04:00:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704283257; cv=none; d=google.com; s=arc-20160816; b=a7RL7U7pdnQqamY0U2X7ACaNonIFgYHYraDIeaCyMxym1X4lA18ud/s8Otzd+xRUMq Xpg4GPZsNvyNJ6AH2ngNBXaptAZmtz110DoiksdVmTejzDAAORVay5IrqnE7p5m1hBQp tDhMvSRRHdnbxqUwPeDNeYMOBEhvq3XwnjGYOAm1Yvr7CHf1p0LtD1rFYrGohCabeZcg eNWFnbD0sPHIkmIOjJjWxqskCKDPPLTUsRPxCPnONncSOydXXjv4lK/NjtFvY2oGFl/R jOp8eY1fT0e63/qShWb62Aw93FMGr6ZrAG1po7+sytJPD3SPZrkbZxxAwte6BAX8e0XF 8q2g== 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=n74uyh1hgyzrSR0ZX3C64lsP4BVPxioetmd+G+ygx/c=; fh=4NrVLy9e1N+ecgT+cYXeaYo3IQFJO3N8B6ul/oSBUd8=; b=dV5ONALONNWJD4SydSwafj3TeuIk/h+SWG2f1gkyKGJ3iagYwmJC0dRYBDy/3hxcM5 pBJM+gwsjZ9uavJozgkN/2NQjSUtASwxfck4AbKi8HOdvPOzLih/dwFEyHEfK6AnpeR1 VT8SH2YsfKLZjaBMuuzfC5Asei9C6BcK4IRmjlqZDvSbGKMR/JRO3yuGU/CEUPSdJRO6 2kd8N4TsGUyjSAlQsUN8s5dhxGMuqLTsdVIE+DDLmXTP08oJB0C1AK7U4EBE0Ay7PK+v X/hZoh+95NJpK2Kp9EnR4Jry+EzZhcoP/K8bNpf26LjQNipcxfxcE6rHEVBiqkjgsKwI 9uCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Pz75pFel; spf=pass (google.com: domain of linux-kernel+bounces-15478-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15478-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q38-20020a635066000000b005ce3cd4ed95si13204697pgl.94.2024.01.03.04.00.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 04:00:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15478-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Pz75pFel; spf=pass (google.com: domain of linux-kernel+bounces-15478-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15478-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 3494D2853E8 for ; Wed, 3 Jan 2024 12:00:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B31331BDFF; Wed, 3 Jan 2024 11:57:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Pz75pFel" 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 B724C1BDDC; Wed, 3 Jan 2024 11:57:14 +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=1704283034; x=1735819034; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=M7wCBVGLoY9FqwR8B4e75uBEBjNx5OX2ShepOLnPD5U=; b=Pz75pFelc2mRnYThS2GGs684lGasXz3Uf19CZvKZPkD3NL4eg9ZCc2bo q2MyVzqvlmADUmefP1cO4p26F30WnEcsLId/jngSXb+75W4JqqHRfxykw eZpUTSs4+j8Ye/qXPVe1OwRm0wCwRdIf8fe1Rm4rFnSkCpp2E571FRPge GevduDB40XsqYV4V3MUsbNIu1+txGgaKb/FAeDunf6B1KcWnDiECfJ5uS vQ+48et6KrwdLeT5vyT5R3f63/aGdmpsYjZkLhHDcNLWjr2Pq2nLhYT1L fp9e9KQrsvYf4qSveMh46x1b8ZzFxIDp3e6a03NRTLGQC8JXrZliynspk g==; X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="428169616" X-IronPort-AV: E=Sophos;i="6.04,327,1695711600"; d="scan'208";a="428169616" 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:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="1111348139" X-IronPort-AV: E=Sophos;i="6.04,327,1695711600"; d="scan'208";a="1111348139" Received: from inlubt0316.iind.intel.com ([10.191.20.213]) by fmsmga005.fm.intel.com with ESMTP; 03 Jan 2024 03:57:07 -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 10/11] Documentation: driver-api: pps: Add Intel Timed I/O PPS generator Date: Wed, 3 Jan 2024 17:26:01 +0530 Message-Id: <20240103115602.19044-11-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: 1787070521116877749 X-GMAIL-MSGID: 1787070521116877749 From: Lakshmi Sowjanya D Add Intel Timed I/O PPS usage instructions. Co-developed-by: Pandith N Signed-off-by: Pandith N Signed-off-by: Lakshmi Sowjanya D Reviewed-by: Andy Shevchenko --- Documentation/driver-api/pps.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Documentation/driver-api/pps.rst b/Documentation/driver-api/pps.rst index 78dded03e5d8..cb1e4d814d37 100644 --- a/Documentation/driver-api/pps.rst +++ b/Documentation/driver-api/pps.rst @@ -246,3 +246,25 @@ delay between assert and clear edge as small as possible to reduce system latencies. But if it is too small slave won't be able to capture clear edge transition. The default of 30us should be good enough in most situations. The delay can be selected using 'delay' pps_gen_parport module parameter. + + +Intel Timed I/O PPS signal generator +------------------------------------ + +Intel Timed I/O is a high precision device, present on 2019 and newer Intel +CPUs, that can generate PPS signal. + +Timed I/O and system time are both driven by same hardware clock, The signal +generated with a precision of ~20 nanoseconds. The generated PPS signal +is used to synchronize an external device with system clock. For example, +Share your clock with a device that receives PPS signal, generated by +Timed I/O device. There are dedicated Timed I/O pins to deliver PPS signal +to an external device. + +Usage of Intel Timed I/O as PPS generator: + +Start generating PPS signal:: + $echo 1 > /sys/devices/platform/INTCxxxx\:00/enable + +Stop generating PPS signal:: + $echo 0 > /sys/devices/platform/INTCxxxx\:00/enable From patchwork Wed Jan 3 11:56:02 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: 184725 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4971935dyb; Wed, 3 Jan 2024 04:01:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IF0ifsMF9RK2jZ0gtB38y783oeRz+SxS4ok5UWTMLkY1m7STRc0uZzzluzvAY6nGGh1+56r X-Received: by 2002:a17:906:f35b:b0:a27:509:420f with SMTP id hg27-20020a170906f35b00b00a270509420fmr5893197ejb.115.1704283282404; Wed, 03 Jan 2024 04:01:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704283282; cv=none; d=google.com; s=arc-20160816; b=Mx2szYqmtDdU9hof2ZKd3pplkJOiPywG8kgtrk13o5wggYFtd0h2XZ7UBFNMF+lNHk jAAgzr5z19Pf5LKVxipZpeSNEomBSFmV55wI7ESs1/irKLCzlBNO064U5lHTSU9agaBi XvjRvn9wJJGceve8ijOQD7rL77iYwNC2rC+iIOTb7U4omU1QVuTndUnMZOem+2QejcWB zTwr2xmAwI0fcksGAeaAExS8+2n05KrnIRTqk11PBjE8fKaFj58nTXcrDxYbA6M3izVo /zaPICpITBDFNW8gXg0U+tMXjwfNnS+46Hg7AFfVjwto/ga/WilNsm+5khoqCeKoktRx E9NA== 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=hmM/9NilPCN9noFRVWVKP1WmjbRWhr5/hnnHeNNzx3k=; fh=4NrVLy9e1N+ecgT+cYXeaYo3IQFJO3N8B6ul/oSBUd8=; b=YCoOuRFo7RbzMl21fgLpeZaicu67jmemkZ4t7CshQyVN+bmU52A2X/bexnu8jMj6se zBpoS3k2jMjEafgk2EeRTJWZWd7GqgHrzr6RsIWtpFP8Szdu5Qrnob/x21ekMETMTAtX cgSoVooNutOQevR8MnZYxBLqoPpALEN9+RSfudyvgK+fY7nfrLgYoqEstlLGaNUxSGDZ n7DPI8xvwTGLmB2BIUvYIIN+Blyq1R4WpZZku19wcDdqAP6Z7j+rM1jPZ6qtJ24UBNh9 CeDjqL8QCKeVOX5f7UbKGHSubHK6ESadqK4Q8QqvjBQW8/HYVHOUGkVheASvEwwFY9x4 Me8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=F7UGDIyH; spf=pass (google.com: domain of linux-kernel+bounces-15479-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15479-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 an16-20020a17090656d000b00a2861e7c37fsi1008722ejc.400.2024.01.03.04.01.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 04:01:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15479-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=F7UGDIyH; spf=pass (google.com: domain of linux-kernel+bounces-15479-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15479-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 EC97B1F2153B for ; Wed, 3 Jan 2024 12:01:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 543EB1C2AD; Wed, 3 Jan 2024 11:57:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="F7UGDIyH" 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 683F71C282; Wed, 3 Jan 2024 11:57:24 +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=1704283044; x=1735819044; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ckkiO416SQGEhwV4zzqsvcHUPsFG/LHSPvD8m5tHmkY=; b=F7UGDIyHnBXnU/CluuIQbooWBXxWzeaYzgPWTafJRJfo9OT6cdT9NnRp sDSLBJYI3ADiwdcXaB3+UKVtME0CAUxLJq6hkA8woBJi3fNkd6niuhple xTaqnvtE8+wtwwq5zAn5Y7oEVheqxKu+h++bnQop/iI/qaCU//RZ9zkM6 SN1RUhPyyN/BQWIM/SVzmAA9bPxJxuvp3LMg2S1/YjqOJlxW+QZTbEdGG TeiLnOAbfz/+SzuWC4kJ1VuaRMDnZ9AbScMOMumA44fCiIzZ0zRFA4rhE qGIN8RvRGOwEfjvK/dK3Q+E3wSJ/RaJa9liIjozbmBRynJFYlYpbjNuNh Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="428169638" X-IronPort-AV: E=Sophos;i="6.04,327,1695711600"; d="scan'208";a="428169638" 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:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="1111348156" X-IronPort-AV: E=Sophos;i="6.04,327,1695711600"; d="scan'208";a="1111348156" Received: from inlubt0316.iind.intel.com ([10.191.20.213]) by fmsmga005.fm.intel.com with ESMTP; 03 Jan 2024 03:57:14 -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 11/11] ABI: pps: Add ABI documentation for Intel TIO Date: Wed, 3 Jan 2024 17:26:02 +0530 Message-Id: <20240103115602.19044-12-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: 1787070546636386334 X-GMAIL-MSGID: 1787070546636386334 From: Lakshmi Sowjanya D Document sysfs interface for Intel Timed I/O PPS driver Signed-off-by: Lakshmi Sowjanya D --- Documentation/ABI/testing/sysfs-platform-pps-tio | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-platform-pps-tio diff --git a/Documentation/ABI/testing/sysfs-platform-pps-tio b/Documentation/ABI/testing/sysfs-platform-pps-tio new file mode 100644 index 000000000000..24a2eb591a05 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-platform-pps-tio @@ -0,0 +1,7 @@ +What: /sys/devices/platform/INTCxxxx/enable +Date: March 2024 +KernelVersion 6.9 +Contact: Lakshmi Sowjanya D +Description: + (RW) Enable or disable PPS TIO generator output, read to + see the status of hardware(Enabled/Disabled).