Re: [PATCH v3 0/2] ptp: split non-host-disciplined PHC drivers into a dedicated subdirectory

From: David Woodhouse

Date: Tue Jun 30 2026 - 07:38:21 EST


On Tue, 2026-06-30 at 11:15 +0800, Wen Gu wrote:
> # Proposal
>
> This series makes the separation explicit by reorganizing the drivers/ptp/
> layout into the following groups:
>
>   - drivers/ptp/          : PTP core infrastructure and host-disciplined
>                             PHC drivers.
>
>   - drivers/ptp/emulated/ : non-host-disciplined PHC drivers that expose
>                             precision time from hypervisors, platforms,
>                             or firmware. These clocks are read-only and
>                             not adjusted by the host.

I was thinking we'd move them to drivers/phc, and simplify them as we do.

Most of them are just a lot of PTP driver boilerplate, wrapping around
one central function like

static int vmclock_get_crosststamp(struct vmclock_state *st,
struct ptp_system_timestamp *sts,
struct system_counterval_t *system_counter,
struct timespec64 *tspec)

...which is called with different permutations of arguments depending
on the actual PTP call.

I was thinking of reducing the duplication and having the PHC drivers
provide *only* that central function. Let the common PHC code provide
the interface to PTP (as well as to core timekeeping, for setting the
clock at boot, for timekeeping_set_reference() in the vmclock case, and
perhaps even for a PPS-like discipline from other clocks).

Here's a *very* hastily thrown together proof of concept; utterly
untested and AI-produced, and I've only given it the bare minimum of
oversight thus far (I have been meaning to do this for weeks but other
things have taken precedence so far)...

https://git.infradead.org/?p=linux-phc.git;a=shortlog;h=refs/heads/next

Attachment: smime.p7s
Description: S/MIME cryptographic signature