Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASM_X86_PVCLOCK_ABI_H
0003 #define _ASM_X86_PVCLOCK_ABI_H
0004 #ifndef __ASSEMBLY__
0005 
0006 /*
0007  * These structs MUST NOT be changed.
0008  * They are the ABI between hypervisor and guest OS.
0009  * Both Xen and KVM are using this.
0010  *
0011  * pvclock_vcpu_time_info holds the system time and the tsc timestamp
0012  * of the last update. So the guest can use the tsc delta to get a
0013  * more precise system time.  There is one per virtual cpu.
0014  *
0015  * pvclock_wall_clock references the point in time when the system
0016  * time was zero (usually boot time), thus the guest calculates the
0017  * current wall clock by adding the system time.
0018  *
0019  * Protocol for the "version" fields is: hypervisor raises it (making
0020  * it uneven) before it starts updating the fields and raises it again
0021  * (making it even) when it is done.  Thus the guest can make sure the
0022  * time values it got are consistent by checking the version before
0023  * and after reading them.
0024  */
0025 
0026 struct pvclock_vcpu_time_info {
0027     u32   version;
0028     u32   pad0;
0029     u64   tsc_timestamp;
0030     u64   system_time;
0031     u32   tsc_to_system_mul;
0032     s8    tsc_shift;
0033     u8    flags;
0034     u8    pad[2];
0035 } __attribute__((__packed__)); /* 32 bytes */
0036 
0037 struct pvclock_wall_clock {
0038     u32   version;
0039     u32   sec;
0040     u32   nsec;
0041 } __attribute__((__packed__));
0042 
0043 #define PVCLOCK_TSC_STABLE_BIT  (1 << 0)
0044 #define PVCLOCK_GUEST_STOPPED   (1 << 1)
0045 /* PVCLOCK_COUNTS_FROM_ZERO broke ABI and can't be used anymore. */
0046 #define PVCLOCK_COUNTS_FROM_ZERO (1 << 2)
0047 #endif /* __ASSEMBLY__ */
0048 #endif /* _ASM_X86_PVCLOCK_ABI_H */