Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp197067lqp; Tue, 11 Jun 2024 20:54:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW+LfQ8XClNQ8N32MUWhkFzAf8rKGxtlrifbB8umsHwqAmHekCPeaTWOzBMAHe95nxhYgz12J1XMycfn2G8724zfKWsTqCl1+pOp1QBlA== X-Google-Smtp-Source: AGHT+IF9iRIC3mEbnPLGX7iJF456XgFqLKSwfLyE9tqycsKUg4W4L9N7j3N4O4lvHyFg3Z7PhdR1 X-Received: by 2002:a05:6a20:1581:b0:1b6:1ed4:e91e with SMTP id adf61e73a8af0-1b8a9bd50d9mr896446637.28.1718164454067; Tue, 11 Jun 2024 20:54:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718164454; cv=pass; d=google.com; s=arc-20160816; b=dni0AzgvqxhmyCByFZFE2gd6zXIb9rJL6Nh0u5Y4apY/NbcGMlIcGWdBf+w1TX0oPd WaI893kkEpTQVKynWrOECxfyMAjxjhizm7nmstdZ304qJazbXyq92+qLH8ejlIkNqtRE aHxdopuw2wIN2do9KHP0etzhzFnvrYsvYGYvx9p5Y41P8XysGXM2KntRCQe5eHFKIHUe 4BButXmqRmHPLjjXUSk8A8eMH/fIIy70CuJghXSRwYhA0YfKjj+ygmINaud9O+qjRzzE zaPnPMyANg1XYKD5ub53mDM2Aj4bTdK9RyjS9lYLy0hWR1zfwG0MlSZDi0AQqf+9fAnZ /vNg== ARC-Message-Signature: i=2; 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:message-id:date:subject:cc:to :from:dkim-signature; bh=YbrTO+KVZuBZOJCQ9Y9aNbcLlI+ilrxCEBtSG46wCnU=; fh=p4Pp/0nJNGwp82oEyWH0XiTPtlV16aDZ4lUo1BZ5wtg=; b=0Q12gWtaKp2wpjviH+ae4QCFEe5gLKnaGmbWBEICthELvw/kDGhOyREcxsq+Ixwx8q lXLmI6599ASs2p7Usfi3d66ngjpKNRV+K9gGybHChhUAUZo4cuajy/2FSBCBn0Be77tP H3H7WBDiooPaPS6j8AZxqYHcR1jT4DhySbTcYNJ77EMFHMX2qrf01hElwvN9GA6oVbDK p1Y4qCJnjWifo59lrfa4+czllM7qPdLsbMgjSE1z1jLGvXESvx5fo5gvRI+/eH1dLZXz aiCQ3XjEvA19wV6D7OMgy2sdFpc/c6OWQqVc+VTnQhlrxR7ESETa/WnTrX+8pRtVvuni 31ew==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PgopbII7; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-210892-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210892-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c4a7662546si608764a91.165.2024.06.11.20.54.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 20:54:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-210892-linux.lists.archive=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=PgopbII7; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-210892-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210892-linux.lists.archive=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 978012862C1 for ; Wed, 12 Jun 2024 03:54:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F0F30208A4; Wed, 12 Jun 2024 03:54:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="PgopbII7" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (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 0C656171C4; Wed, 12 Jun 2024 03:54:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.9 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718164447; cv=none; b=fKJkH8YA0ZkOJ+mlsJPNjNaG3WUvfKnaXslnudX93Q4Zam/d3VUT4PQ/W4PNTeFXz05EZs5bTaifPIBxD3X7Sj3C9slDBCaq3w544W/7Slr9Y3GXi0tQ/WUQ993R1RbKV1AstG5spE1vvXN0Fy8E+tg5sALj2gfrpOhJWiLiPXU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718164447; c=relaxed/simple; bh=uqrIClmGMFcFul1lrpFR1LsBQa8RW8p3+YKpsa24SYo=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=GIb9vSAy3CqlM33g2tQWE4mgt/4r3FxqoI8zeGicDVj5W1iAiPJy2uSK6M3BLsK/51+qmPvRNeFMqeg+Z84BFCd1fo12NQFENdHkaxew9wc7N5T6u1OESCI4I/OA24/uxwpRf+jw9BimgQBmyMTBNcI4ya70nJ80hhn8nJUVbik= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=PgopbII7; arc=none smtp.client-ip=198.175.65.9 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=1718164445; x=1749700445; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=uqrIClmGMFcFul1lrpFR1LsBQa8RW8p3+YKpsa24SYo=; b=PgopbII7pMAdPyLEBnXCYYHSUW6f/TBUbPebt11vAnwvH4MHfqp3A+c+ kZd/9R9J9NuvMjJffUb9JBoA4ZOxmP6A1vbewYw1kNYG7wF6Iz1/QslUk +kFPn/GR5b4FPa1RX0EyMTemUUfJlxKxaAeZQJa4HD1SruONwkpHRL+30 F4FtqvnY7FY6CwD2wy8KglepXEfar32Mby65n1Qp3hyI6mEFr9caTxoPh 4s6c2JXqT0afKoWjhyqxF/V8inWc1kJLSgIMME8pKQrSm9Zk7UtYuNGXz cZ5mYNCv12aDiIhUwMgg2Bo+bFM0gfElwM9uL+2LNxF26W0CtS4tHv5Mb A==; X-CSE-ConnectionGUID: UgnkcvPvRcy/SHGsT7UBRg== X-CSE-MsgGUID: Rh2kNj5TTner1UkdyJZWDQ== X-IronPort-AV: E=McAfee;i="6600,9927,11100"; a="37433722" X-IronPort-AV: E=Sophos;i="6.08,232,1712646000"; d="scan'208";a="37433722" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2024 20:54:04 -0700 X-CSE-ConnectionGUID: nGZVKc52R9S+9+3DFvxQLA== X-CSE-MsgGUID: ku/+nzujRB6ticoE4gE00g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,232,1712646000"; d="scan'208";a="39758566" Received: from inlubt0316.iind.intel.com ([10.191.20.213]) by fmviesa009.fm.intel.com with ESMTP; 11 Jun 2024 20:54:00 -0700 From: lakshmi.sowjanya.d@intel.com To: tglx@linutronix.de, giometti@enneenne.com, corbet@lwn.net, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: gregkh@linuxfoundation.org, andriy.shevchenko@linux.intel.com, eddie.dong@intel.com, christopher.s.hall@intel.com, pandith.n@intel.com, subramanian.mohan@intel.com, thejesh.reddy.t.r@intel.com, lakshmi.sowjanya.d@intel.com Subject: [PATCH v10 0/3] Add support for Intel PPS Generator Date: Wed, 12 Jun 2024 09:23:56 +0530 Message-Id: <20240612035359.7307-1-lakshmi.sowjanya.d@intel.com> X-Mailer: git-send-email 2.35.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Lakshmi Sowjanya D 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 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 the pps(pulse per second) generator tio driver to the pps subsystem. Patch 2 documentation and usage of the pps tio generator module. Patch 3 includes documentation for sysfs interface. These patches are based on the timers/core branch: [1] https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/?h=timers/core These changes are dependent on patches that are merged in [1]. 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. Changes from v7: - Split the if condition and return error if current time exceeds expire time. - Update kernel version and month in ABI file. Changes from v8: - Add function to enable Timed I/O. - Changed the updating of tio->enabled to a centralized place in disable and enable functions. Changes from v9: - use tio->enabled instead of reading ctrl register. - change error code in enable_store to -ENODEV. Lakshmi Sowjanya D (3): 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 .../ABI/testing/sysfs-platform-pps-tio | 7 + Documentation/driver-api/pps.rst | 24 ++ MAINTAINERS | 1 + drivers/pps/generators/Kconfig | 16 ++ drivers/pps/generators/Makefile | 1 + drivers/pps/generators/pps_gen_tio.c | 264 ++++++++++++++++++ 6 files changed, 313 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-platform-pps-tio create mode 100644 drivers/pps/generators/pps_gen_tio.c -- 2.35.3