[RFC v2 0/2] ptp: Move non-NIC PHC drivers from netdev to clock/timekeeping maintainership

Wen Gu posted 2 patches 1 month, 1 week ago
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%)
[RFC v2 0/2] ptp: Move non-NIC PHC drivers from netdev to clock/timekeeping maintainership
Posted by Wen Gu 1 month, 1 week ago
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 linux-kernel@vger.kernel.org (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/0afe19db-9c7f-4228-9fc2-f7b34c4bc227@linux.alibaba.com/
[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/20251030121314.56729-1-guwen@linux.alibaba.com/
[8] https://lore.kernel.org/mhi/20250818-tsc_time_sync-v1-0-2747710693ba@oss.qualcomm.com/
[9] https://lore.kernel.org/netdev/20251127083610.6b66a728@kernel.org/

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%)

-- 
2.43.5
Re: [RFC v2 0/2] ptp: Move non-NIC PHC drivers from netdev to clock/timekeeping maintainership
Posted by Wen Gu 4 weeks, 1 day ago

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.

> # Request for comments
> 
> 1. Following the clocksource/timekeeping and POSIX timer areas, this RFC routes
> changes for drivers/ptp/emulated/ to linux-kernel@vger.kernel.org (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)?

> 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!
Re: [RFC v2 0/2] ptp: Move non-NIC PHC drivers from netdev to clock/timekeeping maintainership
Posted by David Woodhouse 1 month, 1 week ago
On Fri, 2026-02-27 at 16:19 +0800, Wen Gu wrote:
> 
> 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.

> # Request for comments
> 
> 1. Following the clocksource/timekeeping and POSIX timer areas, this RFC routes
> changes for drivers/ptp/emulated/ to linux-kernel@vger.kernel.org (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.

I'm happy to be involved too.
Re: [RFC v2 0/2] ptp: Move non-NIC PHC drivers from netdev to clock/timekeeping maintainership
Posted by Wen Gu 1 month, 1 week ago

On 2026/2/27 18:25, David Woodhouse wrote:
> On Fri, 2026-02-27 at 16:19 +0800, Wen Gu wrote:
>>
>> 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.
> 

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/c85c77bc-9a8c-4336-ab79-89a981c43e01@linux.dev/
[2] https://lore.kernel.org/mhi/20250818-tsc_time_sync-v1-0-2747710693ba@oss.qualcomm.com/

>> # Request for comments
>>
>> 1. Following the clocksource/timekeeping and POSIX timer areas, this RFC routes
>> changes for drivers/ptp/emulated/ to linux-kernel@vger.kernel.org (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.
> 
> 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.
Re: [RFC v2 0/2] ptp: Move non-NIC PHC drivers from netdev to clock/timekeeping maintainership
Posted by Wen Gu 3 weeks ago

On 2026/2/27 20:25, Wen Gu wrote:
> 
> 
> On 2026/2/27 18:25, David Woodhouse wrote:
>> On Fri, 2026-02-27 at 16:19 +0800, Wen Gu wrote:
>>>
>>> # Request for comments
>>>
>>> 1. Following the clocksource/timekeeping and POSIX timer areas, this RFC routes
>>> changes for drivers/ptp/emulated/ to linux-kernel@vger.kernel.org (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.
>>
>> 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!

> 
> Regards.
Re: [RFC v2 0/2] ptp: Move non-NIC PHC drivers from netdev to clock/timekeeping maintainership
Posted by Jakub Kicinski 1 month ago
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.
Re: [RFC v2 0/2] ptp: Move non-NIC PHC drivers from netdev to clock/timekeeping maintainership
Posted by Wen Gu 4 weeks, 1 day ago

On 2026/3/6 10:41, Jakub Kicinski wrote:
> 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.