]> www.infradead.org Git - users/jedix/linux-maple.git/commit
timekeeping: Provide infrastructure for converting to/from a base clock
authorLakshmi Sowjanya D <lakshmi.sowjanya.d@intel.com>
Mon, 13 May 2024 10:38:02 +0000 (16:08 +0530)
committerThomas Gleixner <tglx@linutronix.de>
Mon, 3 Jun 2024 09:18:50 +0000 (11:18 +0200)
commit6b2e29977518ec13ef3022f234ff8f3014c243da
tree4dc1b302f1fa5373015d0227d86291e37004ded6
parent7cbf3b13f00c8341afff1c48ad83d11995842c40
timekeeping: Provide infrastructure for converting to/from a base clock

Hardware time stamps like provided by PTP clock implementations are based
on a clock which feeds both the PCIe device and the system clock. For
further processing the underlying hardwarre clock timestamp must be
converted to the system clock.

Right now this requires drivers to invoke an architecture specific
conversion function, e.g. to convert the ART (Always Running Timer)
timestamp to a TSC timestamp.

As the system clock is aware of the underlying base clock, this can be
moved to the core code by providing a base clock property for the system
clock which contains the conversion factors and assigning a clocksource ID
to the base clock.

Add the required data structures and the conversion infrastructure in the
core code to prepare for converting X86 and the related PTP drivers over.

[ tglx: Added a missing READ_ONCE(). Massaged change log ]

Co-developed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Co-developed-by: Christopher S. Hall <christopher.s.hall@intel.com>
Signed-off-by: Christopher S. Hall <christopher.s.hall@intel.com>
Signed-off-by: Lakshmi Sowjanya D <lakshmi.sowjanya.d@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20240513103813.5666-2-lakshmi.sowjanya.d@intel.com
include/linux/clocksource.h
include/linux/timekeeping.h
kernel/time/timekeeping.c