Message ID | 20240430085225.18086-1-lakshmi.sowjanya.d@intel.com |
---|---|
Headers | show
Return-Path: <intel-wired-lan-bounces@osuosl.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=iQlZnEwA; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VTDVP1Khfz23hd for <incoming@patchwork.ozlabs.org>; Tue, 30 Apr 2024 18:52:43 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id E2F3681F16; Tue, 30 Apr 2024 08:52:40 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 07HXi5YkspF9; Tue, 30 Apr 2024 08:52:39 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=<UNKNOWN> DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 013B681EF0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1714467159; bh=GOAoFZJPfCMen0GUrovc6j9diWj5b5LteM13OQTi62I=; h=From:To:Date:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:Cc:From; b=iQlZnEwAU9AE6AXbDAMHGRjFw0Viw9i7YsP3rSj5ZmEhe7GywpLUZBW3HT58lON/W FM2RXEW3vDWOYsdyk5J6bTTfgWtENlhN1/5im/OCMEKO4Xk15MHOzaPuc6rGpFX6ZT j4BZ+DhgTyZzLHTXq1cKDWqWJ8z2RWxb2t/otO+e7AGiBXapY9HWTr+hDCun/fjiwd kNXfaycTEzTcu2YfLIb5LsSV1cjM6nl4c063pV2CXvqadxaCs7SST/D7u5XN69NC/v wpq4OIjP8W37KbJtqML/xZZrVR/wMzfkGlQyIow2tFCD3CSjQm8qFg3meI2VCYrbAs apFHWfc5Yy2Zg== Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id 013B681EF0; Tue, 30 Apr 2024 08:52:38 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 659821BF215 for <intel-wired-lan@lists.osuosl.org>; Tue, 30 Apr 2024 08:52:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 5D2594055D for <intel-wired-lan@lists.osuosl.org>; Tue, 30 Apr 2024 08:52:37 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id grFI5DjAtiFi for <intel-wired-lan@lists.osuosl.org>; Tue, 30 Apr 2024 08:52:36 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=198.175.65.13; helo=mgamail.intel.com; envelope-from=lakshmi.sowjanya.d@intel.com; receiver=<UNKNOWN> DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org B66A740554 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org B66A740554 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) by smtp4.osuosl.org (Postfix) with ESMTPS id B66A740554 for <intel-wired-lan@lists.osuosl.org>; Tue, 30 Apr 2024 08:52:35 +0000 (UTC) X-CSE-ConnectionGUID: DxNGQvKfRF6gWhGtDo6fUg== X-CSE-MsgGUID: UQoPVn3HSDOZ/b9/JdkMHg== X-IronPort-AV: E=McAfee;i="6600,9927,11059"; a="21311252" X-IronPort-AV: E=Sophos;i="6.07,241,1708416000"; d="scan'208";a="21311252" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Apr 2024 01:52:33 -0700 X-CSE-ConnectionGUID: QlDMvrfbR4+RDn7PCv4t9A== X-CSE-MsgGUID: FPAD6XhCSMienCnGnbUeAQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,241,1708416000"; d="scan'208";a="26891476" Received: from inlubt0316.iind.intel.com ([10.191.20.213]) by orviesa007.jf.intel.com with ESMTP; 30 Apr 2024 01:52:26 -0700 From: lakshmi.sowjanya.d@intel.com To: tglx@linutronix.de, jstultz@google.com, giometti@enneenne.com, corbet@lwn.net, linux-kernel@vger.kernel.org Date: Tue, 30 Apr 2024 14:22:13 +0530 Message-Id: <20240430085225.18086-1-lakshmi.sowjanya.d@intel.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714467156; x=1746003156; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=TXs16JUTJJYiNwzKrUs3bjsFv/mqblL5veTLN9Ghv18=; b=R+E1MnzU948coCcAMLQXnC7Ft3zR7B5VguTOKyRK2fZB8TRpah9STso4 gpS+WjQ7SODQRsapDfDvat7QMZoiujJzxysrFcEpoc5L7zQdn7hCIf8ld zA/QoO5z/XzJtGeSIwLSioQ2je9Ms8NZB3W9gOwrIJ7Ps08yQtyqCmh1+ Pq0foDBqxMWNgIJiKemRLUFyB9DLTyMhO6yQDmsfQ47TIaCRMn1sS38bB N1Pfk16/kj7hyFb0dvg1FiVX2eF30t6Xva5TgqiQVUp0n5EpJ+MV6qlf8 6Sk2+uen3ymRWxfm8XHfSk1m+gaWAgSiyYhnRnhcMOeB8JUA4bCC0yYru w==; X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=none dis=none) header.from=intel.com X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=R+E1MnzU Subject: [Intel-wired-lan] [PATCH v7 00/12] Add support for Intel PPS Generator X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development <intel-wired-lan.osuosl.org> List-Unsubscribe: <https://lists.osuosl.org/mailman/options/intel-wired-lan>, <mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe> List-Archive: <http://lists.osuosl.org/pipermail/intel-wired-lan/> List-Post: <mailto:intel-wired-lan@osuosl.org> List-Help: <mailto:intel-wired-lan-request@osuosl.org?subject=help> List-Subscribe: <https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, <mailto:intel-wired-lan-request@osuosl.org?subject=subscribe> Cc: christopher.s.hall@intel.com, subramanian.mohan@intel.com, lakshmi.sowjanya.d@intel.com, linux-doc@vger.kernel.org, netdev@vger.kernel.org, pandith.n@intel.com, x86@kernel.org, eddie.dong@intel.com, linux-sound@vger.kernel.org, alexandre.torgue@foss.st.com, peter.hilber@opensynergy.com, joabreu@synopsys.com, intel-wired-lan@lists.osuosl.org, mcoquelin.stm32@gmail.com, thejesh.reddy.t.r@intel.com, perex@perex.cz, anthony.l.nguyen@intel.com, andriy.shevchenko@linux.intel.com, davem@davemloft.net Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" <intel-wired-lan-bounces@osuosl.org> |
Series |
Add support for Intel PPS Generator
|
expand
|
From: Lakshmi Sowjanya D <lakshmi.sowjanya.d@intel.com> The goal of the PPS (Pulse Per Second) hardware/software is to generate a signal from the system on a wire so that some third-party hardware can observe that signal and judge how close the system's time is to another system or piece of hardware. Existing methods (like parallel ports) require software to flip a bit at just the right time to create a PPS signal. Many things can prevent software from doing this precisely. This (Timed I/O) method is better because software only "arms" the hardware in advance and then depends on the hardware to "fire" and flip the signal at just the right time. To generate a PPS signal with this new hardware, the kernel wakes up twice a second, once for 1->0 edge and other for the 0->1 edge. It does this shortly (~10ms) before the actual change in the signal needs to be made. It computes the TSC value at which edge will happen, convert to a value hardware understands and program this value to Timed I/O hardware. The actual edge transition happens without any further action from the kernel. The result here is a signal coming out of the system that is roughly 1,000 times more accurate than the old methods. If the system is heavily loaded, the difference in accuracy is larger in old methods. Application Interface: The API to use Timed I/O is very simple. It is enabled and disabled by writing a '1' or '0' value to the sysfs enable attribute associated with the Timed I/O PPS device. Each Timed I/O pin is represented by a PPS device. When enabled, a pulse-per-second (PPS) synchronized with the system clock is continuously produced on the Timed I/O pin, otherwise it is pulled low. The Timed I/O signal on the motherboard is enabled in the BIOS setup. Intel Advanced Menu -> PCH IO Configuration -> Timed I/O <Enable> References: https://en.wikipedia.org/wiki/Pulse-per-second_signal https://drive.google.com/file/d/1vkBRRDuELmY8I3FlfOZaEBp-DxLW6t_V/view https://youtu.be/JLUTT-lrDqw Patch 1 adds base clock properties in clocksource structure Patch 2 updates tsc, art values in the base clock structure Patch 3 - 7 removes reference to convert_art_to_tsc function across drivers Patch 8 removes the convert art to tsc functions which are no longer used Patch 9 adds function to convert realtime to base clock Patch 10 adds the pps(pulse per second) generator tio driver to the pps subsystem. Patch 11 documentation and usage of the pps tio generator module. Patch 12 includes documentation for sysfs interface. Please help to review the changes. Thanks in advance, Sowjanya Changes from v2: - Split patch 1 to remove the functions in later stages. - Include required headers in pps_gen_tio. Changes from v3: - Corrections in Documentation. - Introducing non-RFC version of the patch series. Changes from v4: - Setting id in ice_ptp - Modified conversion logic in convert_base_to_cs. - Included the usage of the APIs in the commit message of 2nd patch. Changes from v5: - Change nsecs variable to use_nsecs. - Change order of 1&2 patches and modify the commit message. - Add sysfs abi file entry in MAINTAINERS file. - Add check to find if any event is missed and disable hardware accordingly. Changes from v6: - Split patch 1 into 1&2 patches. - Add check for overflow in convert_ns_to_cs(). - Refine commit messages. Lakshmi Sowjanya D (7): timekeeping: Add base clock properties in clocksource structure x86/tsc: Update tsc/art values in the base clock structure x86/tsc: Remove art to tsc conversion functions which are obsolete timekeeping: Add function to convert realtime to base clock pps: generators: Add PPS Generator TIO Driver Documentation: driver-api: pps: Add Intel Timed I/O PPS generator ABI: pps: Add ABI documentation for Intel TIO Thomas Gleixner (5): e1000e: remove convert_art_to_tsc() igc: remove convert_art_ns_to_tsc() stmmac: intel: remove convert_art_to_tsc() ALSA: hda: remove convert_art_to_tsc() ice/ptp: remove convert_art_to_tsc() .../ABI/testing/sysfs-platform-pps-tio | 7 + Documentation/driver-api/pps.rst | 22 ++ MAINTAINERS | 1 + arch/x86/include/asm/tsc.h | 3 - arch/x86/kernel/tsc.c | 92 ++----- drivers/net/ethernet/intel/e1000e/ptp.c | 3 +- drivers/net/ethernet/intel/ice/ice_ptp.c | 3 +- drivers/net/ethernet/intel/igc/igc_ptp.c | 6 +- .../net/ethernet/stmicro/stmmac/dwmac-intel.c | 3 +- drivers/pps/generators/Kconfig | 16 ++ drivers/pps/generators/Makefile | 1 + drivers/pps/generators/pps_gen_tio.c | 260 ++++++++++++++++++ include/linux/clocksource.h | 27 ++ include/linux/clocksource_ids.h | 1 + include/linux/timekeeping.h | 6 + kernel/time/timekeeping.c | 125 ++++++++- sound/pci/hda/hda_controller.c | 3 +- 17 files changed, 496 insertions(+), 83 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-platform-pps-tio create mode 100644 drivers/pps/generators/pps_gen_tio.c