cpuid.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /******************************************************************************
  2. * arch-x86/cpuid.h
  3. *
  4. * CPUID interface to Xen.
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7. * of this software and associated documentation files (the "Software"), to
  8. * deal in the Software without restriction, including without limitation the
  9. * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  10. * sell copies of the Software, and to permit persons to whom the Software is
  11. * furnished to do so, subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice shall be included in
  14. * all copies or substantial portions of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  21. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  22. * DEALINGS IN THE SOFTWARE.
  23. *
  24. * Copyright (c) 2007 Citrix Systems, Inc.
  25. *
  26. * Authors:
  27. * Keir Fraser <[email protected]>
  28. */
  29. #ifndef __XEN_PUBLIC_ARCH_X86_CPUID_H__
  30. #define __XEN_PUBLIC_ARCH_X86_CPUID_H__
  31. /*
  32. * For compatibility with other hypervisor interfaces, the Xen cpuid leaves
  33. * can be found at the first otherwise unused 0x100 aligned boundary starting
  34. * from 0x40000000.
  35. *
  36. * e.g If viridian extensions are enabled for an HVM domain, the Xen cpuid
  37. * leaves will start at 0x40000100
  38. */
  39. #define XEN_CPUID_FIRST_LEAF 0x40000000
  40. #define XEN_CPUID_LEAF(i) (XEN_CPUID_FIRST_LEAF + (i))
  41. /*
  42. * Leaf 1 (0x40000x00)
  43. * EAX: Largest Xen-information leaf. All leaves up to an including @EAX
  44. * are supported by the Xen host.
  45. * EBX-EDX: "XenVMMXenVMM" signature, allowing positive identification
  46. * of a Xen host.
  47. */
  48. #define XEN_CPUID_SIGNATURE_EBX 0x566e6558 /* "XenV" */
  49. #define XEN_CPUID_SIGNATURE_ECX 0x65584d4d /* "MMXe" */
  50. #define XEN_CPUID_SIGNATURE_EDX 0x4d4d566e /* "nVMM" */
  51. /*
  52. * Leaf 2 (0x40000x01)
  53. * EAX[31:16]: Xen major version.
  54. * EAX[15: 0]: Xen minor version.
  55. * EBX-EDX: Reserved (currently all zeroes).
  56. */
  57. /*
  58. * Leaf 3 (0x40000x02)
  59. * EAX: Number of hypercall transfer pages. This register is always guaranteed
  60. * to specify one hypercall page.
  61. * EBX: Base address of Xen-specific MSRs.
  62. * ECX: Features 1. Unused bits are set to zero.
  63. * EDX: Features 2. Unused bits are set to zero.
  64. */
  65. /* Does the host support MMU_PT_UPDATE_PRESERVE_AD for this guest? */
  66. #define _XEN_CPUID_FEAT1_MMU_PT_UPDATE_PRESERVE_AD 0
  67. #define XEN_CPUID_FEAT1_MMU_PT_UPDATE_PRESERVE_AD (1u<<0)
  68. /*
  69. * Leaf 4 (0x40000x03)
  70. * Sub-leaf 0: EAX: bit 0: emulated tsc
  71. * bit 1: host tsc is known to be reliable
  72. * bit 2: RDTSCP instruction available
  73. * EBX: tsc_mode: 0=default (emulate if necessary), 1=emulate,
  74. * 2=no emulation, 3=no emulation + TSC_AUX support
  75. * ECX: guest tsc frequency in kHz
  76. * EDX: guest tsc incarnation (migration count)
  77. * Sub-leaf 1: EAX: tsc offset low part
  78. * EBX: tsc offset high part
  79. * ECX: multiplicator for tsc->ns conversion
  80. * EDX: shift amount for tsc->ns conversion
  81. * Sub-leaf 2: EAX: host tsc frequency in kHz
  82. */
  83. /*
  84. * Leaf 5 (0x40000x04)
  85. * HVM-specific features
  86. * Sub-leaf 0: EAX: Features
  87. * Sub-leaf 0: EBX: vcpu id (iff EAX has XEN_HVM_CPUID_VCPU_ID_PRESENT flag)
  88. */
  89. #define XEN_HVM_CPUID_APIC_ACCESS_VIRT (1u << 0) /* Virtualized APIC registers */
  90. #define XEN_HVM_CPUID_X2APIC_VIRT (1u << 1) /* Virtualized x2APIC accesses */
  91. /* Memory mapped from other domains has valid IOMMU entries */
  92. #define XEN_HVM_CPUID_IOMMU_MAPPINGS (1u << 2)
  93. #define XEN_HVM_CPUID_VCPU_ID_PRESENT (1u << 3) /* vcpu id is present in EBX */
  94. #define XEN_HVM_CPUID_DOMID_PRESENT (1u << 4) /* domid is present in ECX */
  95. /*
  96. * Bits 55:49 from the IO-APIC RTE and bits 11:5 from the MSI address can be
  97. * used to store high bits for the Destination ID. This expands the Destination
  98. * ID field from 8 to 15 bits, allowing to target APIC IDs up 32768.
  99. */
  100. #define XEN_HVM_CPUID_EXT_DEST_ID (1u << 5)
  101. /* Per-vCPU event channel upcalls */
  102. #define XEN_HVM_CPUID_UPCALL_VECTOR (1u << 6)
  103. /*
  104. * Leaf 6 (0x40000x05)
  105. * PV-specific parameters
  106. * Sub-leaf 0: EAX: max available sub-leaf
  107. * Sub-leaf 0: EBX: bits 0-7: max machine address width
  108. */
  109. /* Max. address width in bits taking memory hotplug into account. */
  110. #define XEN_CPUID_MACHINE_ADDRESS_WIDTH_MASK (0xffu << 0)
  111. #define XEN_CPUID_MAX_NUM_LEAVES 5
  112. #endif /* __XEN_PUBLIC_ARCH_X86_CPUID_H__ */