]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
KVM: arm64: Use ktime_get_snapshot_id() to snapshot CLOCK_REALTIME
authorThomas Gleixner <tglx@kernel.org>
Fri, 29 May 2026 20:00:12 +0000 (22:00 +0200)
committerThomas Gleixner <tglx@kernel.org>
Thu, 4 Jun 2026 09:04:16 +0000 (11:04 +0200)
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 the usage in kvm_get_ptp_time() 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@kernel.org>
Tested-by: Arthur Kiyanovski <akiyano@amazon.com>
Reviewed-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Acked-by: Marc Zyngier <maz@kernel.org>
Link: https://patch.msgid.link/20260529195557.225399927@kernel.org
arch/arm64/kvm/hypercalls.c

index 58c5fe7d757274d9079606fcc378485980c6c0f8..b11b8821c9fbc63c2913a053051535cdd1de6c09 100644 (file)
@@ -28,7 +28,7 @@ static void kvm_ptp_get_time(struct kvm_vcpu *vcpu, u64 *val)
         * system time and counter value must captured at the same
         * time to keep consistency and precision.
         */
-       ktime_get_snapshot(&systime_snapshot);
+       ktime_get_snapshot_id(CLOCK_REALTIME, &systime_snapshot);
 
        /*
         * This is only valid if the current clocksource is the
@@ -61,8 +61,8 @@ static void kvm_ptp_get_time(struct kvm_vcpu *vcpu, u64 *val)
         * in the future (about 292 years from 1970, and at that stage
         * nobody will give a damn about it).
         */
-       val[0] = upper_32_bits(systime_snapshot.real);
-       val[1] = lower_32_bits(systime_snapshot.real);
+       val[0] = upper_32_bits(systime_snapshot.systime);
+       val[1] = lower_32_bits(systime_snapshot.systime);
        val[2] = upper_32_bits(cycles);
        val[3] = lower_32_bits(cycles);
 }