Skip to content

Commit 93630d6

Browse files
timekeeping: Add clocksource ID to struct system_counterval_t
Clocksource pointers can be problematic to obtain for drivers which are not clocksource drivers themselves. In particular, the RFC virtio_rtc driver [1] would require a new helper function to obtain a pointer to the ARM Generic Timer clocksource. The ptp_kvm driver also required a similar workaround. Add a clocksource ID member to struct system_counterval_t, which in the future shall identify the clocksource, and which shall replace the struct clocksource * member. By this, get_device_system_crosststamp() callers (such as virtio_rtc and ptp_kvm) will be able to supply easily accessible clocksource ids instead of clocksource pointers. [1] https://lore.kernel.org/lkml/20231218073849.35294-1-peter.hilber@opensynergy.com/ Signed-off-by: Peter Hilber <peter.hilber@opensynergy.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20240201010453.2212371-3-peter.hilber@opensynergy.com
1 parent c55cbfc commit 93630d6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

include/linux/timekeeping.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,15 @@ struct system_device_crosststamp {
273273
* @cycles: System counter value
274274
* @cs: Clocksource corresponding to system counter value. Used by
275275
* timekeeping code to verify comparibility of two cycle values
276+
* @cs_id: Clocksource ID corresponding to system counter value. To be
277+
* used instead of cs in the future.
278+
* The default ID, CSID_GENERIC, does not identify a specific
279+
* clocksource.
276280
*/
277281
struct system_counterval_t {
278282
u64 cycles;
279283
struct clocksource *cs;
284+
enum clocksource_ids cs_id;
280285
};
281286

282287
/*

0 commit comments

Comments
 (0)