summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@kernel.org>2026-02-24 19:36:45 +0300
committerPeter Zijlstra <peterz@infradead.org>2026-02-27 18:40:08 +0300
commit89f951a1e8ad781e7ac70eccddab0e0c270485f9 (patch)
treeaf97b4337cb404c048dcc2f908b698a7eed7d61e /include/linux
parentcd38bdb8e696a1a1eb12fc6662a6e420977aacfd (diff)
downloadlinux-89f951a1e8ad781e7ac70eccddab0e0c270485f9.tar.xz
clockevents: Provide support for clocksource coupled comparators
Some clockevent devices are coupled to the system clocksource by implementing a less than or equal comparator which compares the programmed absolute expiry time against the underlying time counter. The timekeeping core provides a function to convert and absolute CLOCK_MONOTONIC based expiry time to a absolute clock cycles time which can be directly fed into the comparator. That spares two time reads in the next event progamming path, one to convert the absolute nanoseconds time to a delta value and the other to convert the delta value back to a absolute time value suitable for the comparator. Provide a new clocksource callback which takes the absolute cycle value and wire it up in clockevents_program_event(). Similar to clocksources allow architectures to inline the rearm operation. Signed-off-by: Thomas Gleixner <tglx@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://patch.msgid.link/20260224163430.010425428@kernel.org
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/clockchips.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index 5e8f7819f6a6..92d90220c0d4 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -43,8 +43,9 @@ enum clock_event_state {
/*
* Clock event features
*/
-# define CLOCK_EVT_FEAT_PERIODIC 0x000001
-# define CLOCK_EVT_FEAT_ONESHOT 0x000002
+# define CLOCK_EVT_FEAT_PERIODIC 0x000001
+# define CLOCK_EVT_FEAT_ONESHOT 0x000002
+# define CLOCK_EVT_FEAT_CLOCKSOURCE_COUPLED 0x000004
/*
* x86(64) specific (mis)features:
@@ -100,6 +101,7 @@ struct clock_event_device {
void (*event_handler)(struct clock_event_device *);
int (*set_next_event)(unsigned long evt, struct clock_event_device *);
int (*set_next_ktime)(ktime_t expires, struct clock_event_device *);
+ void (*set_next_coupled)(u64 cycles, struct clock_event_device *);
ktime_t next_event;
u64 max_delta_ns;
u64 min_delta_ns;
@@ -107,6 +109,7 @@ struct clock_event_device {
u32 shift;
enum clock_event_state state_use_accessors;
unsigned int features;
+ enum clocksource_ids cs_id;
unsigned long retries;
int (*set_state_periodic)(struct clock_event_device *);