hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/include/linux/timekeeping.h
....@@ -159,12 +159,12 @@
159159 return ktime_to_ns(ktime_get_real());
160160 }
161161
162
-static inline u64 ktime_get_boot_ns(void)
162
+static inline u64 ktime_get_boottime_ns(void)
163163 {
164164 return ktime_to_ns(ktime_get_boottime());
165165 }
166166
167
-static inline u64 ktime_get_tai_ns(void)
167
+static inline u64 ktime_get_clocktai_ns(void)
168168 {
169169 return ktime_to_ns(ktime_get_clocktai());
170170 }
....@@ -223,8 +223,20 @@
223223 extern void timekeeping_inject_sleeptime64(const struct timespec64 *delta);
224224
225225 /*
226
+ * struct ktime_timestanps - Simultaneous mono/boot/real timestamps
227
+ * @mono: Monotonic timestamp
228
+ * @boot: Boottime timestamp
229
+ * @real: Realtime timestamp
230
+ */
231
+struct ktime_timestamps {
232
+ u64 mono;
233
+ u64 boot;
234
+ u64 real;
235
+};
236
+
237
+/**
226238 * struct system_time_snapshot - simultaneous raw/real time capture with
227
- * counter value
239
+ * counter value
228240 * @cycles: Clocksource counter value to produce the system times
229241 * @real: Realtime system time
230242 * @raw: Monotonic raw system time
....@@ -239,9 +251,9 @@
239251 u8 cs_was_changed_seq;
240252 };
241253
242
-/*
254
+/**
243255 * struct system_device_crosststamp - system/device cross-timestamp
244
- * (syncronized capture)
256
+ * (synchronized capture)
245257 * @device: Device time
246258 * @sys_realtime: Realtime simultaneous with device time
247259 * @sys_monoraw: Monotonic raw simultaneous with device time
....@@ -252,12 +264,12 @@
252264 ktime_t sys_monoraw;
253265 };
254266
255
-/*
267
+/**
256268 * struct system_counterval_t - system counter value with the pointer to the
257
- * corresponding clocksource
269
+ * corresponding clocksource
258270 * @cycles: System counter value
259271 * @cs: Clocksource corresponding to system counter value. Used by
260
- * timekeeping code to verify comparibility of two cycle values
272
+ * timekeeping code to verify comparibility of two cycle values
261273 */
262274 struct system_counterval_t {
263275 u64 cycles;
....@@ -280,6 +292,9 @@
280292 */
281293 extern void ktime_get_snapshot(struct system_time_snapshot *systime_snapshot);
282294
295
+/* NMI safe mono/boot/realtime timestamps */
296
+extern void ktime_get_fast_timestamps(struct ktime_timestamps *snap);
297
+
283298 /*
284299 * Persistent clock related interfaces
285300 */
....@@ -289,31 +304,5 @@
289304 void read_persistent_wall_and_boot_offset(struct timespec64 *wall_clock,
290305 struct timespec64 *boot_offset);
291306 extern int update_persistent_clock64(struct timespec64 now);
292
-
293
-/*
294
- * deprecated aliases, don't use in new code
295
- */
296
-#define getnstimeofday64(ts) ktime_get_real_ts64(ts)
297
-#define get_monotonic_boottime64(ts) ktime_get_boottime_ts64(ts)
298
-#define getrawmonotonic64(ts) ktime_get_raw_ts64(ts)
299
-#define timekeeping_clocktai64(ts) ktime_get_clocktai_ts64(ts)
300
-
301
-static inline struct timespec64 current_kernel_time64(void)
302
-{
303
- struct timespec64 ts;
304
-
305
- ktime_get_coarse_real_ts64(&ts);
306
-
307
- return ts;
308
-}
309
-
310
-static inline struct timespec64 get_monotonic_coarse64(void)
311
-{
312
- struct timespec64 ts;
313
-
314
- ktime_get_coarse_ts64(&ts);
315
-
316
- return ts;
317
-}
318307
319308 #endif