pvclock-abi.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef _ASM_X86_PVCLOCK_ABI_H
  2. #define _ASM_X86_PVCLOCK_ABI_H
  3. #ifndef __ASSEMBLY__
  4. /*
  5. * These structs MUST NOT be changed.
  6. * They are the ABI between hypervisor and guest OS.
  7. * Both Xen and KVM are using this.
  8. *
  9. * pvclock_vcpu_time_info holds the system time and the tsc timestamp
  10. * of the last update. So the guest can use the tsc delta to get a
  11. * more precise system time. There is one per virtual cpu.
  12. *
  13. * pvclock_wall_clock references the point in time when the system
  14. * time was zero (usually boot time), thus the guest calculates the
  15. * current wall clock by adding the system time.
  16. *
  17. * Protocol for the "version" fields is: hypervisor raises it (making
  18. * it uneven) before it starts updating the fields and raises it again
  19. * (making it even) when it is done. Thus the guest can make sure the
  20. * time values it got are consistent by checking the version before
  21. * and after reading them.
  22. */
  23. struct pvclock_vcpu_time_info {
  24. u32 version;
  25. u32 pad0;
  26. u64 tsc_timestamp;
  27. u64 system_time;
  28. u32 tsc_to_system_mul;
  29. s8 tsc_shift;
  30. u8 flags;
  31. u8 pad[2];
  32. } __attribute__((__packed__)); /* 32 bytes */
  33. struct pvclock_wall_clock {
  34. u32 version;
  35. u32 sec;
  36. u32 nsec;
  37. } __attribute__((__packed__));
  38. #define PVCLOCK_TSC_STABLE_BIT (1 << 0)
  39. #endif /* __ASSEMBLY__ */
  40. #endif /* _ASM_X86_PVCLOCK_ABI_H */