typedef struct vcpu_time_info {
/*
* Updates to the following values are preceded and followed by an
* increment of 'version'. The guest can therefore detect updates by
* looking for changes to 'version'. If the least-significant bit of
* the version number is set then an update is in progress and the guest
* must wait to read a consistent set of values.
* The correct way to interact with the version number is similar to
* Linux's seqlock: see the implementations of read_seqbegin/read_seqretry.
*/
uint32_t version;
uint32_t pad0;
uint64_t tsc_timestamp; /* TSC at last update of time vals. */
uint64_t system_time; /* Time, in nanosecs, since boot. */
/*
* Current system time:
* system_time + ((tsc - tsc_timestamp) << tsc_shift) * tsc_to_system_mul
* CPU frequency (Hz):
* ((10^9 << 32) / tsc_to_system_mul) >> tsc_shift
*/
uint32_t tsc_to_system_mul;
int8_t tsc_shift;
int8_t pad1[3];
} vcpu_time_info_t; /* 32 bytes */
- version
- Used to ensure the guest gets consistent time updates.
- tsc_timestamp
- Cycle counter timestamp of last time value;
could be used to expolate in between updates, for instance.
- system_time
- Time since boot (nanoseconds).
- tsc_to_system_mul
- Cycle counter to nanoseconds multiplier
(used in extrapolating current time).
- tsc_shift
- Cycle counter to nanoseconds shift (used in
extrapolating current time).