aboutsummaryrefslogtreecommitdiffstats
path: root/include/uapi/linux/kvm.h
diff options
context:
space:
mode:
authorOliver Upton <oupton@google.com>2021-09-16 18:15:35 +0000
committerPaolo Bonzini <pbonzini@redhat.com>2021-10-18 14:43:44 -0400
commitc68dc1b577eabd5605c6c7c08f3e07ae18d30d5d (patch)
treee7d06e5afc7e9eda6259256c18da24fe42c9a327 /include/uapi/linux/kvm.h
parentKVM: x86: avoid warning with -Wbitwise-instead-of-logical (diff)
downloadlinux-dev-c68dc1b577eabd5605c6c7c08f3e07ae18d30d5d.tar.xz
linux-dev-c68dc1b577eabd5605c6c7c08f3e07ae18d30d5d.zip
KVM: x86: Report host tsc and realtime values in KVM_GET_CLOCK
Handling the migration of TSCs correctly is difficult, in part because Linux does not provide userspace with the ability to retrieve a (TSC, realtime) clock pair for a single instant in time. In lieu of a more convenient facility, KVM can report similar information in the kvm_clock structure. Provide userspace with a host TSC & realtime pair iff the realtime clock is based on the TSC. If userspace provides KVM_SET_CLOCK with a valid realtime value, advance the KVM clock by the amount of elapsed time. Do not step the KVM clock backwards, though, as it is a monotonic oscillator. Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Oliver Upton <oupton@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20210916181538.968978-5-oupton@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include/uapi/linux/kvm.h')
-rw-r--r--include/uapi/linux/kvm.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index 322b4b588d75..5ca5ffe16cb4 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -1231,11 +1231,16 @@ struct kvm_irqfd {
/* Do not use 1, KVM_CHECK_EXTENSION returned it before we had flags. */
#define KVM_CLOCK_TSC_STABLE 2
+#define KVM_CLOCK_REALTIME (1 << 2)
+#define KVM_CLOCK_HOST_TSC (1 << 3)
struct kvm_clock_data {
__u64 clock;
__u32 flags;
- __u32 pad[9];
+ __u32 pad0;
+ __u64 realtime;
+ __u64 host_tsc;
+ __u32 pad[4];
};
/* For KVM_CAP_SW_TLB */