@@ -179,6 +179,8 @@ extern u64 ktime_get_raw_fast_ns(void);
extern u64 ktime_get_boot_fast_ns(void);
extern u64 ktime_get_real_fast_ns(void);
+extern u64 ktime_get_offs_boot_ns(void);
+
/*
* timespec64/time64_t interfaces utilizing the ktime based ones
* for API completeness, these could be implemented more efficiently
@@ -565,6 +565,16 @@ u64 ktime_get_real_fast_ns(void)
}
EXPORT_SYMBOL_GPL(ktime_get_real_fast_ns);
+/**
+ * ktime_get_offs_boot_ns - boottime offset to monotonic.
+ * Return: boottime offset in nanoseconds.
+ */
+u64 ktime_get_offs_boot_ns(void)
+{
+ return ktime_to_ns(tk_core.timekeeper.offs_boot);
+}
+EXPORT_SYMBOL_GPL(ktime_get_offs_boot_ns);
+
/**
* ktime_get_fast_timestamps: - NMI safe timestamps
* @snapshot: Pointer to timestamp storage
Expose tk->offs_boot to be used in kvm virtual suspend injection. Signed-off-by: Hikaru Nishida <hikalium@chromium.org> --- Changes in v3: - Added this patch. include/linux/timekeeping.h | 2 ++ kernel/time/timekeeping.c | 10 ++++++++++ 2 files changed, 12 insertions(+)