[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211020210348.RFC.v3.1.Ic2211981441d0504581923b8770809f0750a4d0d@changeid>
Date: Wed, 20 Oct 2021 21:04:26 +0900
From: Hikaru Nishida <hikalium@...omium.org>
To: linux-kernel@...r.kernel.org, dme@....org, tglx@...utronix.de,
mlevitsk@...hat.com, linux@...ck-us.net, pbonzini@...hat.com,
vkuznets@...hat.com, maz@...nel.org, will@...nel.org
Cc: suleiman@...gle.com, senozhatsky@...gle.com,
kvmarm@...ts.cs.columbia.edu, linux-arm-kernel@...ts.infradead.org,
Hikaru Nishida <hikalium@...omium.org>,
Arnd Bergmann <arnd@...db.de>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Ingo Molnar <mingo@...nel.org>,
John Stultz <john.stultz@...aro.org>,
Linus Walleij <linus.walleij@...aro.org>,
Stephen Boyd <sboyd@...nel.org>
Subject: [RFC PATCH v3 1/5] timekeeping: Expose tk->offs_boot via ktime_get_offs_boot_ns
Expose tk->offs_boot to be used in kvm virtual suspend injection.
Signed-off-by: Hikaru Nishida <hikalium@...omium.org>
---
Changes in v3:
- Added this patch.
include/linux/timekeeping.h | 2 ++
kernel/time/timekeeping.c | 10 ++++++++++
2 files changed, 12 insertions(+)
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index 78a98bdff76d..f7be69c81dab 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -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
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index b348749a9fc6..e77580d9f8c1 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -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
--
2.33.0.1079.g6e70778dc9-goog
Powered by blists - more mailing lists