Skip to contentSkip to conversation

ptp: Move non-NIC PHC drivers from netdev to clock/timekeeping maintainership

RFC In review Wen Gu 3 participants 9 messages Feb 27 – Mar 17

Subsystems (14)
lore
Share & tools
lore

Wen Gu

author
#0 lore raw

v2 cover ptp: Move non-NIC PHC drivers from netdev to clock/timekeeping maintainership

Hi all,

This RFC v2 is a follow-up to [1].

# Background

The PTP Hardware Clock (PHC) interface (/dev/ptpX and the standard PTP_* ioctls) was originally introduced for IEEE 1588 / network oriented clock drivers. Over time, it has also become a common userspace API for many non-NIC high-precision clock implementations (virtualization/platform/architecture provided clocks) [2-6], and more are expected to appear [7-8].

During the review of these incoming non IEEE 1588 based PHC drivers, concerns were raised that such "non-NIC" clocks may not be a good fit for the netdev maintainership model [9], where PTP/PHC drivers are currently maintained. This leaves an unclear upstream home and maintainership model for this class of drivers.

# Proposal

This RFC proposes moving PHC drivers that expose a high-precision clock to userspace via the existing PTP interface (/dev/ptpX + standard PTP_* ioctls), but are not tied to the traditional NIC/IEEE 1588 packet timestamping pipeline, out of the netdev maintainership scope and into a clock/timekeeping maintainership scope.

As discussed in [1], this series makes the separation explicit by splitting drivers/ptp/ into the following groups, to prepare for clearer ownership and future maintenance:

- drivers/ptp/ : PTP core infrastructure and userspace ABI
(ptp_clock.c, ptp_chardev.c, ptp_sysfs.c,
ptp_vclock.c, etc.) remain here.

- drivers/ptp/ieee1588/ : network / IEEE 1588 oriented PTP drivers.

- drivers/ptp/emulated/ : non IEEE 1588 PTP drivers. they are typically platform/architecture/virtualization/speical hardware provided high precision time sources.

Patch 1 performs the refactor: move drivers and split Kconfig/Makefiles accordingly, without intended functional changes.

Patch 2 updates MAINTAINERS to match the new layout and adds a dedicated entry for drivers/ptp/emulated/, moving review and ownership routing for this class of drivers away from the netdev maintainership.

No userspace ABI changes are intended, this is a refactor and maintenance metadata update only.

# Request for comments

1. Following the clocksource/timekeeping and POSIX timer areas, this RFC routes changes for drivers/ptp/emulated/ to [email protected] (rather than netdev). However, the preferred integration path is still unclear (e.g. which tree should take such changes, and who should collect/pull them for merging). We would really appreciate guidance from the time/clock maintainers, especially any input from Thomas Gleixner, on the preferred tree/workflow for these changes.

2. This RFC currently lists us as the maintainers for drivers/ptp/emulated/ as a fallback contact point. Ideally, we would prefer this area to be maintained by clock/time experts in the long run. Suggestions on more suitable maintainers are very welcome.

Thanks for any input.

Regards.

[1] https://lore.kernel.org/all/[email protected]/
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a0e136d436ded817c0aade72efdefa56a00b4e5e
[3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7d10001e20e46ad6ad95622164686bc2cbfc9802
[4] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2d7de7a3010d713fb89b7ba99e6fdc14475ad106
[5] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3716a49a81ba19dda7202633a68b28564ba95eb5
[6] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9a17125a18f9ae1e1233a8e2d919059445b9d6fd
[7] https://lore.kernel.org/netdev/[email protected]/
[8] https://lore.kernel.org/mhi/[email protected]/
[9] https://lore.kernel.org/netdev/[email protected]/

Wen Gu (2):
ptp: split clock drivers into two subdirectories
MAINTAINERS: update PTP maintainer entries after directory split

 MAINTAINERS                                  |  39 ++-
 drivers/ptp/Kconfig                          | 255 ++-----------------
 drivers/ptp/Makefile                         |  27 +-
 drivers/ptp/emulated/Kconfig                 |  81 ++++++
 drivers/ptp/emulated/Makefile                |  12 +
 drivers/ptp/{ => emulated}/ptp_kvm_arm.c     |   0
 drivers/ptp/{ => emulated}/ptp_kvm_common.c  |   0
 drivers/ptp/{ => emulated}/ptp_kvm_x86.c     |   0
 drivers/ptp/{ => emulated}/ptp_ocp.c         |   0
 drivers/ptp/{ => emulated}/ptp_s390.c        |   0
 drivers/ptp/{ => emulated}/ptp_vmclock.c     |   0
 drivers/ptp/{ => emulated}/ptp_vmw.c         |   0
 drivers/ptp/ieee1588/Kconfig                 | 159 ++++++++++++
 drivers/ptp/ieee1588/Makefile                |  15 ++
 drivers/ptp/{ => ieee1588}/ptp_clockmatrix.c |   0
 drivers/ptp/{ => ieee1588}/ptp_clockmatrix.h |   0
 drivers/ptp/{ => ieee1588}/ptp_dfl_tod.c     |   0
 drivers/ptp/{ => ieee1588}/ptp_dte.c         |   0
 drivers/ptp/{ => ieee1588}/ptp_fc3.c         |   0
 drivers/ptp/{ => ieee1588}/ptp_fc3.h         |   0
 drivers/ptp/{ => ieee1588}/ptp_idt82p33.c    |   0
 drivers/ptp/{ => ieee1588}/ptp_idt82p33.h    |   0
 drivers/ptp/{ => ieee1588}/ptp_ines.c        |   0
 drivers/ptp/{ => ieee1588}/ptp_mock.c        |   0
 drivers/ptp/{ => ieee1588}/ptp_netc.c        |   0
 drivers/ptp/{ => ieee1588}/ptp_pch.c         |   0
 drivers/ptp/{ => ieee1588}/ptp_qoriq.c       |   0
 27 files changed, 322 insertions(+), 266 deletions(-)
 create mode 100644 drivers/ptp/emulated/Kconfig
 create mode 100644 drivers/ptp/emulated/Makefile
 rename drivers/ptp/{ => emulated}/ptp_kvm_arm.c (100%)
 rename drivers/ptp/{ => emulated}/ptp_kvm_common.c (100%)
 rename drivers/ptp/{ => emulated}/ptp_kvm_x86.c (100%)
 rename drivers/ptp/{ => emulated}/ptp_ocp.c (100%)
 rename drivers/ptp/{ => emulated}/ptp_s390.c (100%)
 rename drivers/ptp/{ => emulated}/ptp_vmclock.c (100%)
 rename drivers/ptp/{ => emulated}/ptp_vmw.c (100%)
 create mode 100644 drivers/ptp/ieee1588/Kconfig
 create mode 100644 drivers/ptp/ieee1588/Makefile
 rename drivers/ptp/{ => ieee1588}/ptp_clockmatrix.c (100%)
 rename drivers/ptp/{ => ieee1588}/ptp_clockmatrix.h (100%)
 rename drivers/ptp/{ => ieee1588}/ptp_dfl_tod.c (100%)
 rename drivers/ptp/{ => ieee1588}/ptp_dte.c (100%)
 rename drivers/ptp/{ => ieee1588}/ptp_fc3.c (100%)
 rename drivers/ptp/{ => ieee1588}/ptp_fc3.h (100%)
 rename drivers/ptp/{ => ieee1588}/ptp_idt82p33.c (100%)
 rename drivers/ptp/{ => ieee1588}/ptp_idt82p33.h (100%)
 rename drivers/ptp/{ => ieee1588}/ptp_ines.c (100%)
 rename drivers/ptp/{ => ieee1588}/ptp_mock.c (100%)
 rename drivers/ptp/{ => ieee1588}/ptp_netc.c (100%)
 rename drivers/ptp/{ => ieee1588}/ptp_pch.c (100%)
 rename drivers/ptp/{ => ieee1588}/ptp_qoriq.c (100%)
Signature · 1 line
2.43.5
author
#1 lore raw

RFC v2 1/2 ptp: split clock drivers into two subdirectories

The PTP subsystem has grown beyond the original IEEE 1588/NIC use case and today contains both network-oriented PHC drivers and various emulated/virtual clock implementations.

Prepare for clearer ownership and future maintenance by refactoring drivers/ptp/ to make the split explicit. Keep the PTP core infrastructure in drivers/ptp/ and move the drivers into two new subdirectories:

- drivers/ptp/ieee1588/ : network/IEEE 1588 oriented drivers
- drivers/ptp/emulated/ : emulated/virtual/non-NIC implementations

Move the corresponding Kconfig entries into the new directories and include them from drivers/ptp/Kconfig. Update the top-level drivers/ptp/Makefile to build the core as before and recurse into the two subdirectories.

No functional changes are intended; this is a refactor only.

---
 drivers/ptp/Kconfig                          | 255 ++-----------------
 drivers/ptp/Makefile                         |  27 +-
 drivers/ptp/emulated/Kconfig                 |  81 ++++++
 drivers/ptp/emulated/Makefile                |  12 +
 drivers/ptp/{ => emulated}/ptp_kvm_arm.c     |   0
 drivers/ptp/{ => emulated}/ptp_kvm_common.c  |   0
 drivers/ptp/{ => emulated}/ptp_kvm_x86.c     |   0
 drivers/ptp/{ => emulated}/ptp_ocp.c         |   0
 drivers/ptp/{ => emulated}/ptp_s390.c        |   0
 drivers/ptp/{ => emulated}/ptp_vmclock.c     |   0
 drivers/ptp/{ => emulated}/ptp_vmw.c         |   0
 drivers/ptp/ieee1588/Kconfig                 | 159 ++++++++++++
 drivers/ptp/ieee1588/Makefile                |  15 ++
 drivers/ptp/{ => ieee1588}/ptp_clockmatrix.c |   0
 drivers/ptp/{ => ieee1588}/ptp_clockmatrix.h |   0
 drivers/ptp/{ => ieee1588}/ptp_dfl_tod.c     |   0
 drivers/ptp/{ => ieee1588}/ptp_dte.c         |   0
 drivers/ptp/{ => ieee1588}/ptp_fc3.c         |   0
 drivers/ptp/{ => ieee1588}/ptp_fc3.h         |   0
 drivers/ptp/{ => ieee1588}/ptp_idt82p33.c    |   0
 drivers/ptp/{ => ieee1588}/ptp_idt82p33.h    |   0
 drivers/ptp/{ => ieee1588}/ptp_ines.c        |   0
 drivers/ptp/{ => ieee1588}/ptp_mock.c        |   0
 drivers/ptp/{ => ieee1588}/ptp_netc.c        |   0
 drivers/ptp/{ => ieee1588}/ptp_pch.c         |   0
 drivers/ptp/{ => ieee1588}/ptp_qoriq.c       |   0
 26 files changed, 296 insertions(+), 253 deletions(-)
 create mode 100644 drivers/ptp/emulated/Kconfig
 create mode 100644 drivers/ptp/emulated/Makefile
 rename drivers/ptp/{ => emulated}/ptp_kvm_arm.c (100%)
 rename drivers/ptp/{ => emulated}/ptp_kvm_common.c (100%)
 rename drivers/ptp/{ => emulated}/ptp_kvm_x86.c (100%)
 rename drivers/ptp/{ => emulated}/ptp_ocp.c (100%)
 rename drivers/ptp/{ => emulated}/ptp_s390.c (100%)
 rename drivers/ptp/{ => emulated}/ptp_vmclock.c (100%)
 rename drivers/ptp/{ => emulated}/ptp_vmw.c (100%)
 create mode 100644 drivers/ptp/ieee1588/Kconfig
 create mode 100644 drivers/ptp/ieee1588/Makefile
 rename drivers/ptp/{ => ieee1588}/ptp_clockmatrix.c (100%)
 rename drivers/ptp/{ => ieee1588}/ptp_clockmatrix.h (100%)
 rename drivers/ptp/{ => ieee1588}/ptp_dfl_tod.c (100%)
 rename drivers/ptp/{ => ieee1588}/ptp_dte.c (100%)
 rename drivers/ptp/{ => ieee1588}/ptp_fc3.c (100%)
 rename drivers/ptp/{ => ieee1588}/ptp_fc3.h (100%)
 rename drivers/ptp/{ => ieee1588}/ptp_idt82p33.c (100%)
 rename drivers/ptp/{ => ieee1588}/ptp_idt82p33.h (100%)
 rename drivers/ptp/{ => ieee1588}/ptp_ines.c (100%)
 rename drivers/ptp/{ => ieee1588}/ptp_mock.c (100%)
 rename drivers/ptp/{ => ieee1588}/ptp_netc.c (100%)
 rename drivers/ptp/{ => ieee1588}/ptp_pch.c (100%)
 rename drivers/ptp/{ => ieee1588}/ptp_qoriq.c (100%)
drivers/ptp/Kconfig +22 -233
index b93640ca08b7..abcb6ca7dfb8 100644
@@ -12,17 +12,27 @@ config PTP_1588_CLOCK
 	select PPS
 	select NET_PTP_CLASSIFY
 	help
-	  The IEEE 1588 standard defines a method to precisely
-	  synchronize distributed clocks over Ethernet networks. The
-	  standard defines a Precision Time Protocol (PTP), which can
-	  be used to achieve synchronization within a few dozen
-	  microseconds. In addition, with the help of special hardware
-	  time stamping units, it can be possible to achieve
-	  synchronization to within a few hundred nanoseconds.
+	  Enable the core infrastructure for PTP (Precision Time Protocol)
+	  clock devices
 
-	  This driver adds support for PTP clocks as character
-	  devices. If you want to use a PTP clock, then you should
-	  also enable at least one clock driver as well.
+	  The core provides the common user space interfaces for PTP
+	  clocks, including the character device (/dev/ptpX), sysfs
+	  attributes and ioctl operations.
+
+	  This infrastructure was originally introduced for hardware
+	  clocks on network devices implementing IEEE 1588 to
+	  synchronize distributed clocks over Ethernet networks. With
+	  special hardware time stamping units, synchronization within
+	  a few dozen microseconds, and in some cases a few hundred
+	  nanoseconds, can be achieved.
+
+	  Over time it has evolved into a generic clock device framework
+	  and is also used by other high precision clocks exposed by
+	  platforms, hypervisors or special hardware, even when those
+	  clocks are not synchronized via IEEE 1588 over a network.
+
+	  If you want to use any PTP clock device, enable this option and
+	  at least one clock driver.
 
 	  To compile this driver as a module, choose M here: the module
 	  will be called ptp.
@@ -39,228 +49,7 @@ config PTP_1588_CLOCK_OPTIONAL
 	  If PTP support is disabled, this dependency will still be
 	  met, and drivers refer to dummy helpers.
 
-config PTP_1588_CLOCK_DTE
-	tristate "Broadcom DTE as PTP clock"
-	depends on PTP_1588_CLOCK
-	depends on NET && HAS_IOMEM
-	depends on ARCH_BCM_MOBILE || (ARCH_BCM_IPROC && !(ARCH_BCM_NSP || ARCH_BCM_5301X)) || COMPILE_TEST
-	default y if ARCH_BCM_MOBILE || ARCH_BCM_IPROC
-	help
-	  This driver adds support for using the Digital timing engine
-	  (DTE) in the Broadcom SoC's as a PTP clock.
-
-	  The clock can be used in both wired and wireless networks
-	  for PTP purposes.
-
-	  To compile this driver as a module, choose M here: the module
-	  will be called ptp_dte.
-
-config PTP_1588_CLOCK_QORIQ
-	tristate "Freescale QorIQ 1588 timer as PTP clock"
-	depends on GIANFAR || FSL_DPAA_ETH || FSL_DPAA2_ETH || FSL_ENETC || FSL_ENETC_VF || COMPILE_TEST
-	depends on PTP_1588_CLOCK
-	default y if GIANFAR || FSL_DPAA_ETH || FSL_DPAA2_ETH || FSL_ENETC || FSL_ENETC_VF
-	help
-	  This driver adds support for using the Freescale QorIQ 1588
-	  timer as a PTP clock. This clock is only useful if your PTP
-	  programs are getting hardware time stamps on the PTP Ethernet
-	  packets using the SO_TIMESTAMPING API.
-
-	  To compile this driver as a module, choose M here: the module
-	  will be called ptp_qoriq.
-
-comment "Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks."
-	depends on PHYLIB=n || NETWORK_PHY_TIMESTAMPING=n
-
-config DP83640_PHY
-	tristate "Driver for the National Semiconductor DP83640 PHYTER"
-	depends on NETWORK_PHY_TIMESTAMPING
-	depends on PHYLIB
-	depends on PTP_1588_CLOCK
-	select CRC32
-	help
-	  Supports the DP83640 PHYTER with IEEE 1588 features.
-
-	  This driver adds support for using the DP83640 as a PTP
-	  clock. This clock is only useful if your PTP programs are
-	  getting hardware time stamps on the PTP Ethernet packets
-	  using the SO_TIMESTAMPING API.
-
-	  In order for this to work, your MAC driver must also
-	  implement the skb_tx_timestamp() function.
-
-config PTP_1588_CLOCK_INES
-	tristate "ZHAW InES PTP time stamping IP core"
-	depends on NETWORK_PHY_TIMESTAMPING
-	depends on HAS_IOMEM
-	depends on PHYLIB
-	depends on PTP_1588_CLOCK
-	help
-	  This driver adds support for using the ZHAW InES 1588 IP
-	  core.  This clock is only useful if the MII bus of your MAC
-	  is wired up to the core.
-
-config PTP_1588_CLOCK_PCH
-	tristate "Intel PCH EG20T as PTP clock"
-	depends on MIPS_GENERIC || X86_32 || COMPILE_TEST
-	depends on HAS_IOMEM && PCI
-	depends on NET
-	depends on PTP_1588_CLOCK
-	help
-	  This driver adds support for using the PCH EG20T as a PTP
-	  clock. The hardware supports time stamping of PTP packets
-	  when using the end-to-end delay (E2E) mechanism. The peer
-	  delay mechanism (P2P) is not supported.
-
-	  This clock is only useful if your PTP programs are getting
-	  hardware time stamps on the PTP Ethernet packets using the
-	  SO_TIMESTAMPING API.
-
-	  To compile this driver as a module, choose M here: the module
-	  will be called ptp_pch.
-
-config PTP_1588_CLOCK_KVM
-	tristate "KVM virtual PTP clock"
-	depends on PTP_1588_CLOCK
-	depends on (KVM_GUEST && X86) || (HAVE_ARM_SMCCC_DISCOVERY && ARM_ARCH_TIMER)
-	default y
-	help
-	  This driver adds support for using kvm infrastructure as a PTP
-	  clock. This clock is only useful if you are using KVM guests.
-
-	  To compile this driver as a module, choose M here: the module
-	  will be called ptp_kvm.
-
-config PTP_1588_CLOCK_VMCLOCK
-	tristate "Virtual machine PTP clock"
-	depends on X86_TSC || ARM_ARCH_TIMER
-	depends on PTP_1588_CLOCK && ARCH_SUPPORTS_INT128
-	default PTP_1588_CLOCK_KVM
-	help
-	  This driver adds support for using a virtual precision clock
-	  advertised by the hypervisor. This clock is only useful in virtual
-	  machines where such a device is present.
-
-	  Unlike the KVM virtual PTP clock, the VMCLOCK device offers support
-	  for reliable timekeeping even across live migration. So this driver
-	  is enabled by default whenever the KVM PTP clock is.
-
-	  To compile this driver as a module, choose M here: the module
-	  will be called ptp_vmclock.
-
-config PTP_1588_CLOCK_IDT82P33
-	tristate "IDT 82P33xxx PTP clock"
-	depends on PTP_1588_CLOCK && I2C
-	default n
-	help
-	  This driver adds support for using the IDT 82P33xxx as a PTP
-	  clock. This clock is only useful if your time stamping MAC
-	  is connected to the IDT chip.
-
-	  To compile this driver as a module, choose M here: the module
-	  will be called ptp_idt82p33.
-
-config PTP_1588_CLOCK_IDTCM
-	tristate "IDT CLOCKMATRIX as PTP clock"
-	depends on PTP_1588_CLOCK && I2C
-	default n
-	help
-	  This driver adds support for using IDT CLOCKMATRIX(TM) as a PTP
-	  clock. This clock is only useful if your time stamping MAC
-	  is connected to the IDT chip.
-
-	  To compile this driver as a module, choose M here: the module
-	  will be called ptp_clockmatrix.
-
-config PTP_1588_CLOCK_FC3W
-	tristate "RENESAS FemtoClock3 Wireless as PTP clock"
-	depends on PTP_1588_CLOCK && I2C
-	default n
-	help
-	  This driver adds support for using Renesas FemtoClock3 Wireless
-	  as a PTP clock. This clock is only useful if your time stamping
-	  MAC is connected to the RENESAS chip.
-
-	  To compile this driver as a module, choose M here: the module
-	  will be called ptp_fc3.
-
-config PTP_1588_CLOCK_MOCK
-	tristate "Mock-up PTP clock"
-	depends on PTP_1588_CLOCK
-	help
-	  This driver offers a set of PTP clock manipulation operations over
-	  the system monotonic time. It can be used by virtual network device
-	  drivers to emulate PTP capabilities.
-
-	  To compile this driver as a module, choose M here: the module
-	  will be called ptp_mock.
-
-config PTP_1588_CLOCK_VMW
-	tristate "VMware virtual PTP clock"
-	depends on ACPI && HYPERVISOR_GUEST && X86
-	depends on PTP_1588_CLOCK
-	help
-	  This driver adds support for using VMware virtual precision
-	  clock device as a PTP clock. This is only useful in virtual
-	  machines running on VMware virtual infrastructure.
-
-	  To compile this driver as a module, choose M here: the module
-	  will be called ptp_vmw.
-
-config PTP_1588_CLOCK_OCP
-	tristate "OpenCompute TimeCard as PTP clock"
-	depends on PTP_1588_CLOCK
-	depends on HAS_IOMEM && PCI
-	depends on I2C && MTD
-	depends on SERIAL_8250
-	depends on !S390
-	depends on COMMON_CLK
-	select NET_DEVLINK
-	select CRC16
-	select DPLL
-	help
-	  This driver adds support for an OpenCompute time card.
-
-	  The OpenCompute time card is an atomic clock along with
-	  a GPS receiver that provides a Grandmaster clock source
-	  for a PTP enabled network.
-
-	  More information is available at http://www.timingcard.com/
-
-config PTP_DFL_TOD
-	tristate "FPGA DFL ToD Driver"
-	depends on FPGA_DFL
-	depends on PTP_1588_CLOCK
-	help
-	  The DFL (Device Feature List) device driver for the Intel ToD
-	  (Time-of-Day) device in FPGA card. The ToD IP within the FPGA
-	  is exposed as PTP Hardware Clock (PHC) device to the Linux PTP
-	  stack to synchronize the system clock to its ToD information
-	  using phc2sys utility of the Linux PTP stack.
-
-	  To compile this driver as a module, choose M here: the module
-	  will be called ptp_dfl_tod.
-
-config PTP_S390
-	tristate "S390 PTP driver"
-	depends on PTP_1588_CLOCK
-	depends on S390
-	help
-	  This driver adds support for S390 time steering via the PtP
-	  interface. This works by adding a in-kernel clock delta value,
-	  which is always added to time values used in the kernel. The PtP
-	  driver provides the raw clock value without the delta to
-	  userspace. That way userspace programs like chrony could steer
-	  the kernel clock.
-
-config PTP_NETC_V4_TIMER
-	tristate "NXP NETC V4 Timer PTP Driver"
-	depends on PTP_1588_CLOCK
-	depends on PCI_MSI
-	help
-	  This driver adds support for using the NXP NETC V4 Timer as a PTP
-	  clock, the clock is used by ENETC V4 or NETC V4 Switch for PTP time
-	  synchronization. It also supports periodic output signal (e.g. PPS)
-	  and external trigger timestamping.
+source "drivers/ptp/ieee1588/Kconfig"
+source "drivers/ptp/emulated/Kconfig"
 
 endmenu
drivers/ptp/Makefile +7 -20
index bdc47e284f14..740443a8d419 100644
@@ -1,24 +1,11 @@
 # SPDX-License-Identifier: GPL-2.0
 #
-# Makefile for PTP 1588 clock support.
+# Makefile for PTP clock support.
 #
 
-ptp-y					:= ptp_clock.o ptp_chardev.o ptp_sysfs.o ptp_vclock.o
-ptp_kvm-$(CONFIG_X86)			:= ptp_kvm_x86.o ptp_kvm_common.o
-ptp_kvm-$(CONFIG_HAVE_ARM_SMCCC)	:= ptp_kvm_arm.o ptp_kvm_common.o
-obj-$(CONFIG_PTP_1588_CLOCK)		+= ptp.o
-obj-$(CONFIG_PTP_1588_CLOCK_DTE)	+= ptp_dte.o
-obj-$(CONFIG_PTP_1588_CLOCK_INES)	+= ptp_ines.o
-obj-$(CONFIG_PTP_1588_CLOCK_PCH)	+= ptp_pch.o
-obj-$(CONFIG_PTP_1588_CLOCK_KVM)	+= ptp_kvm.o
-obj-$(CONFIG_PTP_1588_CLOCK_VMCLOCK)	+= ptp_vmclock.o
-obj-$(CONFIG_PTP_1588_CLOCK_QORIQ)	+= ptp_qoriq.o
-obj-$(CONFIG_PTP_1588_CLOCK_IDTCM)	+= ptp_clockmatrix.o
-obj-$(CONFIG_PTP_1588_CLOCK_FC3W)	+= ptp_fc3.o
-obj-$(CONFIG_PTP_1588_CLOCK_IDT82P33)	+= ptp_idt82p33.o
-obj-$(CONFIG_PTP_1588_CLOCK_MOCK)	+= ptp_mock.o
-obj-$(CONFIG_PTP_1588_CLOCK_VMW)	+= ptp_vmw.o
-obj-$(CONFIG_PTP_1588_CLOCK_OCP)	+= ptp_ocp.o
-obj-$(CONFIG_PTP_DFL_TOD)		+= ptp_dfl_tod.o
-obj-$(CONFIG_PTP_S390)			+= ptp_s390.o
-obj-$(CONFIG_PTP_NETC_V4_TIMER)		+= ptp_netc.o
+subdir-ccflags-y += -I$(srctree)/drivers/ptp
+
+ptp-y				:= ptp_clock.o ptp_chardev.o ptp_sysfs.o ptp_vclock.o
+obj-$(CONFIG_PTP_1588_CLOCK)	+= ptp.o
+obj-$(CONFIG_PTP_1588_CLOCK)	+= emulated/
+obj-$(CONFIG_PTP_1588_CLOCK)	+= ieee1588/
drivers/ptp/emulated/Kconfig new file +81 -0

81 lines not on this page · raw message

drivers/ptp/emulated/Makefile new file +12 -0
new file mode 100644
index 000000000000..33c64cb1ab83
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for emulated PTP clocks.
+#
+
+ptp_kvm-$(CONFIG_X86)			:= ptp_kvm_x86.o ptp_kvm_common.o
+ptp_kvm-$(CONFIG_HAVE_ARM_SMCCC)	:= ptp_kvm_arm.o ptp_kvm_common.o
+obj-$(CONFIG_PTP_1588_CLOCK_KVM)	+= ptp_kvm.o
+obj-$(CONFIG_PTP_1588_CLOCK_VMCLOCK)	+= ptp_vmclock.o
+obj-$(CONFIG_PTP_1588_CLOCK_VMW)	+= ptp_vmw.o
+obj-$(CONFIG_PTP_1588_CLOCK_OCP)	+= ptp_ocp.o
+obj-$(CONFIG_PTP_S390)			+= ptp_s390.o
drivers/ptp/emulated/ptp_kvm_arm.c renamed from drivers/ptp/ptp_kvm_arm.c +0 -0
similarity index 100%
rename from drivers/ptp/ptp_kvm_arm.c
rename to drivers/ptp/emulated/ptp_kvm_arm.c
drivers/ptp/emulated/ptp_kvm_common.c renamed from drivers/ptp/ptp_kvm_common.c +0 -0
similarity index 100%
rename from drivers/ptp/ptp_kvm_common.c
rename to drivers/ptp/emulated/ptp_kvm_common.c
drivers/ptp/emulated/ptp_kvm_x86.c renamed from drivers/ptp/ptp_kvm_x86.c +0 -0
similarity index 100%
rename from drivers/ptp/ptp_kvm_x86.c
rename to drivers/ptp/emulated/ptp_kvm_x86.c
drivers/ptp/emulated/ptp_ocp.c renamed from drivers/ptp/ptp_ocp.c +0 -0
similarity index 100%
rename from drivers/ptp/ptp_ocp.c
rename to drivers/ptp/emulated/ptp_ocp.c
drivers/ptp/emulated/ptp_s390.c renamed from drivers/ptp/ptp_s390.c +0 -0
similarity index 100%
rename from drivers/ptp/ptp_s390.c
rename to drivers/ptp/emulated/ptp_s390.c
drivers/ptp/emulated/ptp_vmclock.c renamed from drivers/ptp/ptp_vmclock.c +0 -0
similarity index 100%
rename from drivers/ptp/ptp_vmclock.c
rename to drivers/ptp/emulated/ptp_vmclock.c
drivers/ptp/emulated/ptp_vmw.c renamed from drivers/ptp/ptp_vmw.c +0 -0
similarity index 100%
rename from drivers/ptp/ptp_vmw.c
rename to drivers/ptp/emulated/ptp_vmw.c
drivers/ptp/ieee1588/Kconfig new file +159 -0

159 lines not on this page · raw message

drivers/ptp/ieee1588/Makefile new file +15 -0
new file mode 100644
index 000000000000..995ae90aa43c
@@ -0,0 +1,15 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for IEEE 1588 network-oriented PTP clocks.
+#
+
+obj-$(CONFIG_PTP_1588_CLOCK_DTE)	+= ptp_dte.o
+obj-$(CONFIG_PTP_1588_CLOCK_INES)	+= ptp_ines.o
+obj-$(CONFIG_PTP_1588_CLOCK_PCH)	+= ptp_pch.o
+obj-$(CONFIG_PTP_1588_CLOCK_QORIQ)	+= ptp_qoriq.o
+obj-$(CONFIG_PTP_1588_CLOCK_IDTCM)	+= ptp_clockmatrix.o
+obj-$(CONFIG_PTP_1588_CLOCK_FC3W)	+= ptp_fc3.o
+obj-$(CONFIG_PTP_1588_CLOCK_IDT82P33)	+= ptp_idt82p33.o
+obj-$(CONFIG_PTP_1588_CLOCK_MOCK)	+= ptp_mock.o
+obj-$(CONFIG_PTP_DFL_TOD)		+= ptp_dfl_tod.o
+obj-$(CONFIG_PTP_NETC_V4_TIMER)		+= ptp_netc.o
drivers/ptp/ieee1588/ptp_clockmatrix.c renamed from drivers/ptp/ptp_clockmatrix.c +0 -0
similarity index 100%
rename from drivers/ptp/ptp_clockmatrix.c
rename to drivers/ptp/ieee1588/ptp_clockmatrix.c
drivers/ptp/ieee1588/ptp_clockmatrix.h renamed from drivers/ptp/ptp_clockmatrix.h +0 -0
similarity index 100%
rename from drivers/ptp/ptp_clockmatrix.h
rename to drivers/ptp/ieee1588/ptp_clockmatrix.h
drivers/ptp/ieee1588/ptp_dfl_tod.c renamed from drivers/ptp/ptp_dfl_tod.c +0 -0
similarity index 100%
rename from drivers/ptp/ptp_dfl_tod.c
rename to drivers/ptp/ieee1588/ptp_dfl_tod.c
drivers/ptp/ieee1588/ptp_dte.c renamed from drivers/ptp/ptp_dte.c +0 -0
similarity index 100%
rename from drivers/ptp/ptp_dte.c
rename to drivers/ptp/ieee1588/ptp_dte.c
drivers/ptp/ieee1588/ptp_fc3.c renamed from drivers/ptp/ptp_fc3.c +0 -0
similarity index 100%
rename from drivers/ptp/ptp_fc3.c
rename to drivers/ptp/ieee1588/ptp_fc3.c
drivers/ptp/ieee1588/ptp_fc3.h renamed from drivers/ptp/ptp_fc3.h +0 -0
similarity index 100%
rename from drivers/ptp/ptp_fc3.h
rename to drivers/ptp/ieee1588/ptp_fc3.h
drivers/ptp/ieee1588/ptp_idt82p33.c renamed from drivers/ptp/ptp_idt82p33.c +0 -0
similarity index 100%
rename from drivers/ptp/ptp_idt82p33.c
rename to drivers/ptp/ieee1588/ptp_idt82p33.c
drivers/ptp/ieee1588/ptp_idt82p33.h renamed from drivers/ptp/ptp_idt82p33.h +0 -0
similarity index 100%
rename from drivers/ptp/ptp_idt82p33.h
rename to drivers/ptp/ieee1588/ptp_idt82p33.h
drivers/ptp/ieee1588/ptp_ines.c renamed from drivers/ptp/ptp_ines.c +0 -0
similarity index 100%
rename from drivers/ptp/ptp_ines.c
rename to drivers/ptp/ieee1588/ptp_ines.c
drivers/ptp/ieee1588/ptp_mock.c renamed from drivers/ptp/ptp_mock.c +0 -0
similarity index 100%
rename from drivers/ptp/ptp_mock.c
rename to drivers/ptp/ieee1588/ptp_mock.c
drivers/ptp/ieee1588/ptp_netc.c renamed from drivers/ptp/ptp_netc.c +0 -0
similarity index 100%
rename from drivers/ptp/ptp_netc.c
rename to drivers/ptp/ieee1588/ptp_netc.c
drivers/ptp/ieee1588/ptp_pch.c renamed from drivers/ptp/ptp_pch.c +0 -0
similarity index 100%
rename from drivers/ptp/ptp_pch.c
rename to drivers/ptp/ieee1588/ptp_pch.c
drivers/ptp/ieee1588/ptp_qoriq.c renamed from drivers/ptp/ptp_qoriq.c +0 -0
similarity index 100%
rename from drivers/ptp/ptp_qoriq.c
rename to drivers/ptp/ieee1588/ptp_qoriq.c
Signature · 1 line
2.43.5
author
#2 lore raw

RFC v2 2/2 MAINTAINERS: update PTP maintainer entries after directory split

In reply to Wen Gu

Update MAINTAINERS to match the new drivers/ptp/ directory layout after splitting emulated and IEEE 1588 network-oriented drivers into subdirectories.

Adjust file patterns and per-driver entries to point to their new locations, and add a dedicated MAINTAINERS entry for the emulated PTP clock drivers.

---
 MAINTAINERS | 39 ++++++++++++++++++++++++++-------------
 1 file changed, 26 insertions(+), 13 deletions(-)
MAINTAINERS +26 -13
index b8d8a5c41597..c87715fc8d1f 100644
@@ -10253,7 +10253,7 @@ F:	Documentation/devicetree/bindings/ptp/fsl,ptp.yaml
 F:	drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp*
 F:	drivers/net/ethernet/freescale/dpaa2/dprtc*
 F:	drivers/net/ethernet/freescale/enetc/enetc_ptp.c
-F:	drivers/ptp/ptp_qoriq.c
+F:	drivers/ptp/ieee1588/ptp_qoriq.c
 F:	include/linux/fsl/ptp_qoriq.h
 
 FREESCALE QUAD SPI DRIVER
@@ -13134,7 +13134,7 @@ INTEL PTP DFL ToD DRIVER
 L:	[email protected]
 L:	[email protected]
 S:	Orphan
-F:	drivers/ptp/ptp_dfl_tod.c
+F:	drivers/ptp/ieee1588/ptp_dfl_tod.c
 
 INTEL QUADRATURE ENCODER PERIPHERAL DRIVER
 M:	Ilpo Järvinen <[email protected]>
@@ -18321,7 +18321,10 @@ F:	Documentation/devicetree/bindings/net/
 F:	Documentation/networking/net_cachelines/net_device.rst
 F:	drivers/connector/
 F:	drivers/net/
-F:	drivers/ptp/
+F:	drivers/ptp/Kconfig
+F:	drivers/ptp/Makefile
+F:	drivers/ptp/ieee1588/
+F:	drivers/ptp/ptp*
 F:	drivers/s390/net/
 F:	include/dt-bindings/net/
 F:	include/linux/cn_proc.h
@@ -19104,7 +19107,7 @@ L:	[email protected]
 L:	[email protected]
 S:	Maintained
 F:	Documentation/devicetree/bindings/ptp/nxp,ptp-netc.yaml
-F:	drivers/ptp/ptp_netc.c
+F:	drivers/ptp/ieee1588/ptp_netc.c
 
 NXP PF5300/PF5301/PF5302 PMIC REGULATOR DEVICE DRIVER
 M:	Woodrow Douglass <[email protected]>
@@ -19815,9 +19818,9 @@ F:	include/dt-bindings/
 OPENCOMPUTE PTP CLOCK DRIVER
 M:	Jonathan Lemon <[email protected]>
 M:	Vadim Fedorenko <[email protected]>
-L:	[email protected]
+L:	[email protected]
 S:	Maintained
-F:	drivers/ptp/ptp_ocp.c
+F:	drivers/ptp/emulated/ptp_ocp.c
 
 OPENCORES I2C BUS DRIVER
 M:	Peter Korsgaard <[email protected]>
@@ -21255,15 +21258,25 @@ W:	http://linuxptp.sourceforge.net/
 F:	Documentation/ABI/testing/sysfs-ptp
 F:	Documentation/driver-api/ptp.rst
 F:	drivers/net/phy/dp83640*
-F:	drivers/ptp/*
+F:	drivers/ptp/Kconfig
+F:	drivers/ptp/Makefile
+F:	drivers/ptp/ieee1588/
+F:	drivers/ptp/ptp*
 F:	include/linux/ptp_cl*
 K:	(?:\b|_)ptp(?:\b|_)
 
+PTP EMULATED CLOCK SUPPORT
+M:	Wen Gu <[email protected]>
+M:	Xuan Zhuo <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	drivers/ptp/emulated/
+
 PTP MOCKUP CLOCK SUPPORT
 M:	Vladimir Oltean <[email protected]>
 L:	[email protected]
 S:	Maintained
-F:	drivers/ptp/ptp_mock.c
+F:	drivers/ptp/ieee1588/ptp_mock.c
 F:	include/linux/ptp_mock.h
 
 PTP VIRTUAL CLOCK SUPPORT
@@ -21275,10 +21288,10 @@ F:	net/ethtool/phc_vclocks.c
 
 PTP VMCLOCK SUPPORT
 M:	David Woodhouse <[email protected]>
-L:	[email protected]
+L:	[email protected]
 S:	Maintained
 F:	Documentation/devicetree/bindings/ptp/amazon,vmclock.yaml
-F:	drivers/ptp/ptp_vmclock.c
+F:	drivers/ptp/emulated/ptp_vmclock.c
 F:	include/uapi/linux/vmclock-abi.h
 
 PTRACE SUPPORT
@@ -23328,7 +23341,7 @@ S390 PTP DRIVER
 M:	Sven Schnelle <[email protected]>
 L:	[email protected]
 S:	Supported
-F:	drivers/ptp/ptp_s390.c
+F:	drivers/ptp/emulated/ptp_s390.c
 
 S390 SCM DRIVER
 M:	Vineeth Vijayan <[email protected]>
@@ -28217,9 +28230,9 @@ M:	Nick Shi <[email protected]>
 R:	Ajay Kaher <[email protected]>
 R:	Alexey Makhalov <[email protected]>
 R:	Broadcom internal kernel review list <[email protected]>
-L:	[email protected]
+L:	[email protected]
 S:	Supported
-F:	drivers/ptp/ptp_vmw.c
+F:	drivers/ptp/emulated/ptp_vmw.c
 
 VMWARE VMCI DRIVER
 M:	Bryan Tan <[email protected]>
Signature · 1 line
2.43.5
maintainer
#3 lore raw
In reply to Wen Gu
Quoted 10 lines · Wen Gu

Patch 1 performs the refactor: move drivers and split Kconfig/Makefiles accordingly, without intended functional changes.

Patch 2 updates MAINTAINERS to match the new layout and adds a dedicated entry for drivers/ptp/emulated/, moving review and ownership routing for this class of drivers away from the netdev maintainership.

No userspace ABI changes are intended, this is a refactor and maintenance metadata update only.

While no ABI changes are intended in *this* patch series, we do need some.

These 'emulated' clocks mostly exist not to emulate IEEE1588 per se, but as a way to provide a precision real time clock to systems (especially virtual guests).

We have already discussed the need to expose clock error bounds, and to expose paired timestamps against the actual hardware counter (TSC, arch counter, timebase, etc.).

Another key difference is that we'll generally want to be able to derive UTC from these clocks, and feed them directly into the kernel's CLOCK_REALTIME.

I don't have strong views on whether we extend the /dev/ptpX userspace ABI, or start to treat these 'emulated' clocks as a class of device in their own right and just shim them to /dev/ptpX for compatibility.

Quoted 9 lines

# Request for comments

1. Following the clocksource/timekeeping and POSIX timer areas, this RFC routes changes for drivers/ptp/emulated/ to [email protected] (rather than netdev). However, the preferred integration path is still unclear (e.g. which tree should take such changes, and who should collect/pull them for merging). We would really appreciate guidance from the time/clock maintainers, especially any input from Thomas Gleixner, on the preferred tree/workflow for these changes.

Quoted 4 lines

2. This RFC currently lists us as the maintainers for drivers/ptp/emulated/ as a fallback contact point. Ideally, we would prefer this area to be maintained by clock/time experts in the long run. Suggestions on more suitable maintainers are very welcome.

I'm happy to be involved too.

author
#4 lore raw
Quoted 23 lines · David Woodhouse
Quoted 10 lines · Wen Gu

Patch 1 performs the refactor: move drivers and split Kconfig/Makefiles accordingly, without intended functional changes.

Patch 2 updates MAINTAINERS to match the new layout and adds a dedicated entry for drivers/ptp/emulated/, moving review and ownership routing for this class of drivers away from the netdev maintainership.

No userspace ABI changes are intended, this is a refactor and maintenance metadata update only.

While no ABI changes are intended in *this* patch series, we do need some.

These 'emulated' clocks mostly exist not to emulate IEEE1588 per se, but as a way to provide a precision real time clock to systems (especially virtual guests).

We have already discussed the need to expose clock error bounds, and to expose paired timestamps against the actual hardware counter (TSC, arch counter, timebase, etc.).

Quoted 8 lines

Another key difference is that we'll generally want to be able to derive UTC from these clocks, and feed them directly into the kernel's CLOCK_REALTIME.

I don't have strong views on whether we extend the /dev/ptpX userspace ABI, or start to treat these 'emulated' clocks as a class of device in their own right and just shim them to /dev/ptpX for compatibility.

As mentioned in RFC v1, the use cases for drivers in the emulated PHC category are expected to be quite diverse, and not limited to the virtualization/guest time sync use case. For example, existing drivers such as ptp_ocp [1] and upcoming ones such as mhi_phc [2] are not related to virtualization use cases.

The main motivation for this RFC is to find a clear in-tree home, upstreaming path, and review/maintainership model for PHC/PTP drivers that use the existing PTP userspace interface, but are not based on the IEEE 1588/network packet timestamping pipeline, both for those already in the tree and for future additions.

For virtualization-specific extensions (e.g. additional capabilities or ABI changes), I agree they are valuable, but I think they are outside the scope of this RFC series.

[1] https://lore.kernel.org/netdev/[email protected]/
[2] https://lore.kernel.org/mhi/[email protected]/

Quoted 9 lines
Quoted 9 lines

# Request for comments

1. Following the clocksource/timekeeping and POSIX timer areas, this RFC routes changes for drivers/ptp/emulated/ to [email protected] (rather than netdev). However, the preferred integration path is still unclear (e.g. which tree should take such changes, and who should collect/pull them for merging). We would really appreciate guidance from the time/clock maintainers, especially any input from Thomas Gleixner, on the preferred tree/workflow for these changes.

Quoted 6 lines
Quoted 4 lines

2. This RFC currently lists us as the maintainers for drivers/ptp/emulated/ as a fallback contact point. Ideally, we would prefer this area to be maintained by clock/time experts in the long run. Suggestions on more suitable maintainers are very welcome.

I'm happy to be involved too.

Thanks, David. It would be great to have you involved. Would you be willing to be listed in MAINTAINERS for drivers/ptp/emulated/?

Regards.

maintainer
#5 lore raw
Quoted 4 lines · On Fri, 27 Feb 2026 20:25:11 +0800 Wen Gu wrote:

As mentioned in RFC v1, the use cases for drivers in the emulated PHC category are expected to be quite diverse, and not limited to the virtualization/guest time sync use case. For example, existing drivers such as ptp_ocp [1] and upcoming ones such as mhi_phc [2] are not related to virtualization use cases.

ptp_ocp is a real PCIe device with an atomic clock. mhi_phc is some qualcomm fw-defined thing, so more closely mapping what you're doing. ptp_ocp should probably stay under netdev, we maintain DPLL drivers, too. Main thing we/I don't want to deal with is all the corporate NIH virtualization excreta.

author
#6 lore raw
Quoted 11 lines · Jakub Kicinski
Quoted 4 lines · On Fri, 27 Feb 2026 20:25:11 +0800 Wen Gu wrote:

As mentioned in RFC v1, the use cases for drivers in the emulated PHC category are expected to be quite diverse, and not limited to the virtualization/guest time sync use case. For example, existing drivers such as ptp_ocp [1] and upcoming ones such as mhi_phc [2] are not related to virtualization use cases.

ptp_ocp is a real PCIe device with an atomic clock. mhi_phc is some qualcomm fw-defined thing, so more closely mapping what you're doing. ptp_ocp should probably stay under netdev, we maintain DPLL drivers, too. Main thing we/I don't want to deal with is all the corporate NIH virtualization excreta.

OK. ptp_ocp will be kept under netdev in the next version.

author
#8 lore raw
In reply to Wen Gu

On 2026/2/27 16:19, Wen Gu wrote:

To get more clock/timekeeping-side input on this RFC (in particular, the two open questions below), I’m CC’ing a few additional maintainers from the clock/time area.

Quoted 8 lines

# Request for comments

1. Following the clocksource/timekeeping and POSIX timer areas, this RFC routes changes for drivers/ptp/emulated/ to [email protected] (rather than netdev). However, the preferred integration path is still unclear (e.g. which tree should take such changes, and who should collect/pull them for merging). We would really appreciate guidance from the time/clock maintainers, especially any input from Thomas Gleixner, on the preferred tree/workflow for these changes.

As a concrete option for (1): would it be acceptable to merge changes for drivers/ptp/emulated/ via tip.git (timers/core branch)?

Quoted 4 lines

2. This RFC currently lists us as the maintainers for drivers/ptp/emulated/ as a fallback contact point. Ideally, we would prefer this area to be maintained by clock/time experts in the long run. Suggestions on more suitable maintainers are very welcome.

We’d appreciate guidance from the clock/timekeeping maintainers on the preferred workflow and long-term maintainership for this class of clock drivers.

Thanks!

author
#7 lore raw
In reply to Wen Gu
Quoted 19 lines · Wen Gu
Quoted 16 lines · David Woodhouse
Quoted 14 lines · Wen Gu

# Request for comments

1. Following the clocksource/timekeeping and POSIX timer areas, this RFC routes changes for drivers/ptp/emulated/ to [email protected] (rather than netdev). However, the preferred integration path is still unclear (e.g. which tree should take such changes, and who should collect/pull them for merging). We would really appreciate guidance from the time/clock maintainers, especially any input from Thomas Gleixner, on the preferred tree/workflow for these changes.

2. This RFC currently lists us as the maintainers for drivers/ptp/emulated/ as a fallback contact point. Ideally, we would prefer this area to be maintained by clock/time experts in the long run. Suggestions on more suitable maintainers are very welcome.

Quoted 4 lines
Quoted 1 line

I'm happy to be involved too.

Thanks, David. It would be great to have you involved. Would you be willing to be listed in MAINTAINERS for drivers/ptp/emulated/?

Hi David,

Just following up in case this got lost in the thread.

You mentioned earlier that you'd be happy to be involved, so I wanted to check whether you'd be comfortable being listed as a co-maintainer.

Thanks!

Quoted 2 lines

Regards.