kvm_para.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #ifndef _ASM_X86_KVM_PARA_H
  2. #define _ASM_X86_KVM_PARA_H
  3. #include <linux/types.h>
  4. #include <asm/hyperv.h>
  5. /* This CPUID returns the signature 'KVMKVMKVM' in ebx, ecx, and edx. It
  6. * should be used to determine that a VM is running under KVM.
  7. */
  8. #define KVM_CPUID_SIGNATURE 0x40000000
  9. /* This CPUID returns a feature bitmap in eax. Before enabling a particular
  10. * paravirtualization, the appropriate feature bit should be checked.
  11. */
  12. #define KVM_CPUID_FEATURES 0x40000001
  13. #define KVM_FEATURE_CLOCKSOURCE 0
  14. #define KVM_FEATURE_NOP_IO_DELAY 1
  15. #define KVM_FEATURE_MMU_OP 2
  16. /* This indicates that the new set of kvmclock msrs
  17. * are available. The use of 0x11 and 0x12 is deprecated
  18. */
  19. #define KVM_FEATURE_CLOCKSOURCE2 3
  20. #define KVM_FEATURE_STEAL_TIME 5
  21. #define KVM_FEATURE_PV_EOI 6
  22. /* The last 8 bits are used to indicate how to interpret the flags field
  23. * in pvclock structure. If no bits are set, all flags are ignored.
  24. */
  25. #define KVM_FEATURE_CLOCKSOURCE_STABLE_BIT 24
  26. #define MSR_KVM_WALL_CLOCK 0x11
  27. #define MSR_KVM_SYSTEM_TIME 0x12
  28. #define KVM_MSR_ENABLED 1
  29. /* Custom MSRs falls in the range 0x4b564d00-0x4b564dff */
  30. #define MSR_KVM_WALL_CLOCK_NEW 0x4b564d00
  31. #define MSR_KVM_SYSTEM_TIME_NEW 0x4b564d01
  32. #define MSR_KVM_STEAL_TIME 0x4b564d03
  33. #define MSR_KVM_PV_EOI_EN 0x4b564d04
  34. struct kvm_steal_time {
  35. __u64 steal;
  36. __u32 version;
  37. __u32 flags;
  38. __u32 pad[12];
  39. };
  40. #define KVM_STEAL_ALIGNMENT_BITS 5
  41. #define KVM_STEAL_VALID_BITS ((-1ULL << (KVM_STEAL_ALIGNMENT_BITS + 1)))
  42. #define KVM_STEAL_RESERVED_MASK (((1 << KVM_STEAL_ALIGNMENT_BITS) - 1 ) << 1)
  43. #define KVM_MAX_MMU_OP_BATCH 32
  44. /* Operations for KVM_HC_MMU_OP */
  45. #define KVM_MMU_OP_WRITE_PTE 1
  46. #define KVM_MMU_OP_FLUSH_TLB 2
  47. #define KVM_MMU_OP_RELEASE_PT 3
  48. /* Payload for KVM_HC_MMU_OP */
  49. struct kvm_mmu_op_header {
  50. __u32 op;
  51. __u32 pad;
  52. };
  53. struct kvm_mmu_op_write_pte {
  54. struct kvm_mmu_op_header header;
  55. __u64 pte_phys;
  56. __u64 pte_val;
  57. };
  58. struct kvm_mmu_op_flush_tlb {
  59. struct kvm_mmu_op_header header;
  60. };
  61. struct kvm_mmu_op_release_pt {
  62. struct kvm_mmu_op_header header;
  63. __u64 pt_phys;
  64. };
  65. #define KVM_PV_EOI_BIT 0
  66. #define KVM_PV_EOI_MASK (0x1 << KVM_PV_EOI_BIT)
  67. #define KVM_PV_EOI_ENABLED KVM_PV_EOI_MASK
  68. #define KVM_PV_EOI_DISABLED 0x0
  69. #endif /* _ASM_X86_KVM_PARA_H */