[tip: timers/ptp] ptp: ptp_vmclock: Convert to ktime_get_snapshot_id()

From: tip-bot2 for Thomas Gleixner

Date: Tue Jun 02 2026 - 06:00:11 EST


The following commit has been merged into the timers/ptp branch of tip:

Commit-ID: d3dae55436460830abb99e0519a093469ad08416
Gitweb: https://git.kernel.org/tip/d3dae55436460830abb99e0519a093469ad08416
Author: Thomas Gleixner <tglx@xxxxxxxxxx>
AuthorDate: Fri, 29 May 2026 22:00:16 +02:00
Committer: Thomas Gleixner <tglx@xxxxxxxxxx>
CommitterDate: Tue, 02 Jun 2026 11:39:58 +02:00

ptp: ptp_vmclock: Convert to ktime_get_snapshot_id()

ktime_get_snapshot() is replaced by ktime_get_snapshot_id() which allows to
request a particular CLOCK ID to be captured along with the clocksource
counter.

Convert vmclock over and use the new system_time_snapshot::systime field,
which holds the system timestamp selected by the CLOCK ID argument.

No functional change intended.

Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxx>
Tested-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
Tested-by: Arthur Kiyanovski <akiyano@xxxxxxxxxx>
Reviewed-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
Reviewed-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
Reviewed-by: Jacob Keller <jacob.e.keller@xxxxxxxxx>
Link: https://patch.msgid.link/20260529195557.281425262@xxxxxxxxxx
---
drivers/ptp/ptp_vmclock.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/ptp/ptp_vmclock.c b/drivers/ptp/ptp_vmclock.c
index 8b630eb..0f12b54 100644
--- a/drivers/ptp/ptp_vmclock.c
+++ b/drivers/ptp/ptp_vmclock.c
@@ -132,7 +132,7 @@ static int vmclock_get_crosststamp(struct vmclock_state *st,
* will be derived from the *same* counter value.
*
* If the system isn't using the same counter, then the value
- * from ktime_get_snapshot() will still be used as pre_ts, and
+ * from ktime_get_snapshot_id() will still be used as pre_ts, and
* ptp_read_system_postts() is called to populate postts after
* calling get_cycles().
*
@@ -140,7 +140,7 @@ static int vmclock_get_crosststamp(struct vmclock_state *st,
* the seq_count loop.
*/
if (sts) {
- ktime_get_snapshot(&systime_snapshot);
+ ktime_get_snapshot_id(CLOCK_REALTIME, &systime_snapshot);
if (systime_snapshot.cs_id == st->cs_id) {
cycle = systime_snapshot.cycles;
} else {
@@ -181,7 +181,7 @@ static int vmclock_get_crosststamp(struct vmclock_state *st,
}

if (sts) {
- sts->pre_ts = ktime_to_timespec64(systime_snapshot.real);
+ sts->pre_ts = ktime_to_timespec64(systime_snapshot.systime);
if (systime_snapshot.cs_id == st->cs_id)
sts->post_ts = sts->pre_ts;
}
@@ -272,7 +272,7 @@ static int ptp_vmclock_getcrosststamp(struct ptp_clock_info *ptp,
if (ret == -ENODEV) {
struct system_time_snapshot systime_snapshot;

- ktime_get_snapshot(&systime_snapshot);
+ ktime_get_snapshot_id(CLOCK_REALTIME, &systime_snapshot);

if (systime_snapshot.cs_id == CSID_X86_TSC ||
systime_snapshot.cs_id == CSID_X86_KVM_CLK) {