[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231215220612.173603-2-peter.hilber@opensynergy.com>
Date: Fri, 15 Dec 2023 23:06:06 +0100
From: Peter Hilber <peter.hilber@...nsynergy.com>
To: linux-kernel@...r.kernel.org
Cc: Peter Hilber <peter.hilber@...nsynergy.com>,
"D, Lakshmi Sowjanya" <lakshmi.sowjanya.d@...el.com>,
Thomas Gleixner <tglx@...utronix.de>,
jstultz@...gle.com,
giometti@...eenne.com,
corbet@....net,
andriy.shevchenko@...ux.intel.com,
"Dong, Eddie" <eddie.dong@...el.com>,
"Hall, Christopher S" <christopher.s.hall@...el.com>,
Marc Zyngier <maz@...nel.org>,
linux-arm-kernel@...ts.infradead.org,
Sean Christopherson <seanjc@...gle.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>,
Wanpeng Li <wanpengli@...cent.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Richard Cochran <richardcochran@...il.com>,
kvm@...r.kernel.org,
netdev@...r.kernel.org,
Stephen Boyd <sboyd@...nel.org>
Subject: [RFC PATCH v2 1/7] 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 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/20230818012014.212155-1-peter.hilber@opensynergy.com/
Signed-off-by: Peter Hilber <peter.hilber@...nsynergy.com>
---
Notes:
v2:
- Refer to clocksource IDs as such in comments (Thomas Gleixner).
include/linux/timekeeping.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index fe1e467ba046..74dc7c8b036f 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -272,10 +272,15 @@ struct system_device_crosststamp {
* @cycles: System counter value
* @cs: Clocksource corresponding to system counter value. Used by
* timekeeping code to verify comparibility of two cycle values
+ * @cs_id: Clocksource ID corresponding to system counter value. To be
+ * used instead of cs in the future.
+ * The default ID, CSID_GENERIC, does not identify a specific
+ * clocksource.
*/
struct system_counterval_t {
u64 cycles;
struct clocksource *cs;
+ enum clocksource_ids cs_id;
};
/*
--
2.40.1
Powered by blists - more mailing lists