kvmclock.h 891 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef KVMCLOCK_H
  2. #define KVMCLOCK_H
  3. #define MSR_KVM_WALL_CLOCK_NEW 0x4b564d00
  4. #define MSR_KVM_SYSTEM_TIME_NEW 0x4b564d01
  5. #define MAX_CPU 64
  6. #define PVCLOCK_TSC_STABLE_BIT (1 << 0)
  7. #define PVCLOCK_RAW_CYCLE_BIT (1 << 7) /* Get raw cycle */
  8. # define NSEC_PER_SEC 1000000000ULL
  9. typedef u64 cycle_t;
  10. struct pvclock_vcpu_time_info {
  11. u32 version;
  12. u32 pad0;
  13. u64 tsc_timestamp;
  14. u64 system_time;
  15. u32 tsc_to_system_mul;
  16. s8 tsc_shift;
  17. u8 flags;
  18. u8 pad[2];
  19. } __attribute__((__packed__)); /* 32 bytes */
  20. struct pvclock_wall_clock {
  21. u32 version;
  22. u32 sec;
  23. u32 nsec;
  24. } __attribute__((__packed__));
  25. struct timespec {
  26. long tv_sec;
  27. long tv_nsec;
  28. };
  29. void pvclock_set_flags(unsigned char flags);
  30. cycle_t kvm_clock_read();
  31. void kvm_get_wallclock(struct timespec *ts);
  32. void kvm_clock_init(void *data);
  33. void kvm_clock_clear(void *data);
  34. #endif