.. | .. |
---|
1 | | -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ |
---|
2 | 2 | |
---|
3 | 3 | /* |
---|
4 | 4 | * This file contains definitions from Hyper-V Hypervisor Top-Level Functional |
---|
.. | .. |
---|
10 | 10 | #define _ASM_X86_HYPERV_TLFS_H |
---|
11 | 11 | |
---|
12 | 12 | #include <linux/types.h> |
---|
13 | | - |
---|
| 13 | +#include <asm/page.h> |
---|
14 | 14 | /* |
---|
15 | 15 | * The below CPUID leaves are present if VersionAndFeatures.HypervisorPresent |
---|
16 | 16 | * is set by CPUID(HvCpuIdFunctionVersionAndFeatures). |
---|
.. | .. |
---|
28 | 28 | #define HYPERV_CPUID_MAX 0x4000ffff |
---|
29 | 29 | |
---|
30 | 30 | /* |
---|
31 | | - * Feature identification. EAX indicates which features are available |
---|
32 | | - * to the partition based upon the current partition privileges. |
---|
33 | | - */ |
---|
34 | | - |
---|
35 | | -/* VP Runtime (HV_X64_MSR_VP_RUNTIME) available */ |
---|
36 | | -#define HV_X64_MSR_VP_RUNTIME_AVAILABLE (1 << 0) |
---|
37 | | -/* Partition Reference Counter (HV_X64_MSR_TIME_REF_COUNT) available*/ |
---|
38 | | -#define HV_MSR_TIME_REF_COUNT_AVAILABLE (1 << 1) |
---|
39 | | -/* Partition reference TSC MSR is available */ |
---|
40 | | -#define HV_MSR_REFERENCE_TSC_AVAILABLE (1 << 9) |
---|
41 | | - |
---|
42 | | -/* A partition's reference time stamp counter (TSC) page */ |
---|
43 | | -#define HV_X64_MSR_REFERENCE_TSC 0x40000021 |
---|
44 | | - |
---|
45 | | -/* |
---|
46 | | - * There is a single feature flag that signifies if the partition has access |
---|
47 | | - * to MSRs with local APIC and TSC frequencies. |
---|
48 | | - */ |
---|
49 | | -#define HV_X64_ACCESS_FREQUENCY_MSRS (1 << 11) |
---|
50 | | - |
---|
51 | | -/* AccessReenlightenmentControls privilege */ |
---|
52 | | -#define HV_X64_ACCESS_REENLIGHTENMENT BIT(13) |
---|
53 | | - |
---|
54 | | -/* |
---|
55 | | - * Basic SynIC MSRs (HV_X64_MSR_SCONTROL through HV_X64_MSR_EOM |
---|
56 | | - * and HV_X64_MSR_SINT0 through HV_X64_MSR_SINT15) available |
---|
57 | | - */ |
---|
58 | | -#define HV_X64_MSR_SYNIC_AVAILABLE (1 << 2) |
---|
59 | | -/* |
---|
60 | | - * Synthetic Timer MSRs (HV_X64_MSR_STIMER0_CONFIG through |
---|
61 | | - * HV_X64_MSR_STIMER3_COUNT) available |
---|
62 | | - */ |
---|
63 | | -#define HV_MSR_SYNTIMER_AVAILABLE (1 << 3) |
---|
64 | | -/* |
---|
65 | | - * APIC access MSRs (HV_X64_MSR_EOI, HV_X64_MSR_ICR and HV_X64_MSR_TPR) |
---|
66 | | - * are available |
---|
67 | | - */ |
---|
68 | | -#define HV_X64_MSR_APIC_ACCESS_AVAILABLE (1 << 4) |
---|
69 | | -/* Hypercall MSRs (HV_X64_MSR_GUEST_OS_ID and HV_X64_MSR_HYPERCALL) available*/ |
---|
70 | | -#define HV_X64_MSR_HYPERCALL_AVAILABLE (1 << 5) |
---|
71 | | -/* Access virtual processor index MSR (HV_X64_MSR_VP_INDEX) available*/ |
---|
72 | | -#define HV_X64_MSR_VP_INDEX_AVAILABLE (1 << 6) |
---|
73 | | -/* Virtual system reset MSR (HV_X64_MSR_RESET) is available*/ |
---|
74 | | -#define HV_X64_MSR_RESET_AVAILABLE (1 << 7) |
---|
75 | | - /* |
---|
76 | | - * Access statistics pages MSRs (HV_X64_MSR_STATS_PARTITION_RETAIL_PAGE, |
---|
77 | | - * HV_X64_MSR_STATS_PARTITION_INTERNAL_PAGE, HV_X64_MSR_STATS_VP_RETAIL_PAGE, |
---|
78 | | - * HV_X64_MSR_STATS_VP_INTERNAL_PAGE) available |
---|
79 | | - */ |
---|
80 | | -#define HV_X64_MSR_STAT_PAGES_AVAILABLE (1 << 8) |
---|
81 | | - |
---|
82 | | -/* Frequency MSRs available */ |
---|
83 | | -#define HV_FEATURE_FREQUENCY_MSRS_AVAILABLE (1 << 8) |
---|
84 | | - |
---|
85 | | -/* Crash MSR available */ |
---|
86 | | -#define HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE (1 << 10) |
---|
87 | | - |
---|
88 | | -/* stimer Direct Mode is available */ |
---|
89 | | -#define HV_STIMER_DIRECT_MODE_AVAILABLE (1 << 19) |
---|
90 | | - |
---|
91 | | -/* |
---|
92 | | - * Feature identification: EBX indicates which flags were specified at |
---|
93 | | - * partition creation. The format is the same as the partition creation |
---|
94 | | - * flag structure defined in section Partition Creation Flags. |
---|
95 | | - */ |
---|
96 | | -#define HV_X64_CREATE_PARTITIONS (1 << 0) |
---|
97 | | -#define HV_X64_ACCESS_PARTITION_ID (1 << 1) |
---|
98 | | -#define HV_X64_ACCESS_MEMORY_POOL (1 << 2) |
---|
99 | | -#define HV_X64_ADJUST_MESSAGE_BUFFERS (1 << 3) |
---|
100 | | -#define HV_X64_POST_MESSAGES (1 << 4) |
---|
101 | | -#define HV_X64_SIGNAL_EVENTS (1 << 5) |
---|
102 | | -#define HV_X64_CREATE_PORT (1 << 6) |
---|
103 | | -#define HV_X64_CONNECT_PORT (1 << 7) |
---|
104 | | -#define HV_X64_ACCESS_STATS (1 << 8) |
---|
105 | | -#define HV_X64_DEBUGGING (1 << 11) |
---|
106 | | -#define HV_X64_CPU_POWER_MANAGEMENT (1 << 12) |
---|
107 | | -#define HV_X64_CONFIGURE_PROFILER (1 << 13) |
---|
108 | | - |
---|
109 | | -/* |
---|
110 | | - * Feature identification. EDX indicates which miscellaneous features |
---|
111 | | - * are available to the partition. |
---|
| 31 | + * Group D Features. The bit assignments are custom to each architecture. |
---|
| 32 | + * On x86/x64 these are HYPERV_CPUID_FEATURES.EDX bits. |
---|
112 | 33 | */ |
---|
113 | 34 | /* The MWAIT instruction is available (per section MONITOR / MWAIT) */ |
---|
114 | | -#define HV_X64_MWAIT_AVAILABLE (1 << 0) |
---|
| 35 | +#define HV_X64_MWAIT_AVAILABLE BIT(0) |
---|
115 | 36 | /* Guest debugging support is available */ |
---|
116 | | -#define HV_X64_GUEST_DEBUGGING_AVAILABLE (1 << 1) |
---|
| 37 | +#define HV_X64_GUEST_DEBUGGING_AVAILABLE BIT(1) |
---|
117 | 38 | /* Performance Monitor support is available*/ |
---|
118 | | -#define HV_X64_PERF_MONITOR_AVAILABLE (1 << 2) |
---|
| 39 | +#define HV_X64_PERF_MONITOR_AVAILABLE BIT(2) |
---|
119 | 40 | /* Support for physical CPU dynamic partitioning events is available*/ |
---|
120 | | -#define HV_X64_CPU_DYNAMIC_PARTITIONING_AVAILABLE (1 << 3) |
---|
| 41 | +#define HV_X64_CPU_DYNAMIC_PARTITIONING_AVAILABLE BIT(3) |
---|
121 | 42 | /* |
---|
122 | 43 | * Support for passing hypercall input parameter block via XMM |
---|
123 | 44 | * registers is available |
---|
124 | 45 | */ |
---|
125 | | -#define HV_X64_HYPERCALL_PARAMS_XMM_AVAILABLE (1 << 4) |
---|
| 46 | +#define HV_X64_HYPERCALL_PARAMS_XMM_AVAILABLE BIT(4) |
---|
126 | 47 | /* Support for a virtual guest idle state is available */ |
---|
127 | | -#define HV_X64_GUEST_IDLE_STATE_AVAILABLE (1 << 5) |
---|
128 | | -/* Guest crash data handler available */ |
---|
129 | | -#define HV_X64_GUEST_CRASH_MSR_AVAILABLE (1 << 10) |
---|
| 48 | +#define HV_X64_GUEST_IDLE_STATE_AVAILABLE BIT(5) |
---|
| 49 | +/* Frequency MSRs available */ |
---|
| 50 | +#define HV_FEATURE_FREQUENCY_MSRS_AVAILABLE BIT(8) |
---|
| 51 | +/* Crash MSR available */ |
---|
| 52 | +#define HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE BIT(10) |
---|
| 53 | +/* Support for debug MSRs available */ |
---|
| 54 | +#define HV_FEATURE_DEBUG_MSRS_AVAILABLE BIT(11) |
---|
| 55 | +/* stimer Direct Mode is available */ |
---|
| 56 | +#define HV_STIMER_DIRECT_MODE_AVAILABLE BIT(19) |
---|
130 | 57 | |
---|
131 | 58 | /* |
---|
132 | 59 | * Implementation recommendations. Indicates which behaviors the hypervisor |
---|
133 | 60 | * recommends the OS implement for optimal performance. |
---|
| 61 | + * These are HYPERV_CPUID_ENLIGHTMENT_INFO.EAX bits. |
---|
134 | 62 | */ |
---|
135 | | - /* |
---|
136 | | - * Recommend using hypercall for address space switches rather |
---|
137 | | - * than MOV to CR3 instruction |
---|
138 | | - */ |
---|
139 | | -#define HV_X64_AS_SWITCH_RECOMMENDED (1 << 0) |
---|
| 63 | +/* |
---|
| 64 | + * Recommend using hypercall for address space switches rather |
---|
| 65 | + * than MOV to CR3 instruction |
---|
| 66 | + */ |
---|
| 67 | +#define HV_X64_AS_SWITCH_RECOMMENDED BIT(0) |
---|
140 | 68 | /* Recommend using hypercall for local TLB flushes rather |
---|
141 | 69 | * than INVLPG or MOV to CR3 instructions */ |
---|
142 | | -#define HV_X64_LOCAL_TLB_FLUSH_RECOMMENDED (1 << 1) |
---|
| 70 | +#define HV_X64_LOCAL_TLB_FLUSH_RECOMMENDED BIT(1) |
---|
143 | 71 | /* |
---|
144 | 72 | * Recommend using hypercall for remote TLB flushes rather |
---|
145 | 73 | * than inter-processor interrupts |
---|
146 | 74 | */ |
---|
147 | | -#define HV_X64_REMOTE_TLB_FLUSH_RECOMMENDED (1 << 2) |
---|
| 75 | +#define HV_X64_REMOTE_TLB_FLUSH_RECOMMENDED BIT(2) |
---|
148 | 76 | /* |
---|
149 | 77 | * Recommend using MSRs for accessing APIC registers |
---|
150 | 78 | * EOI, ICR and TPR rather than their memory-mapped counterparts |
---|
151 | 79 | */ |
---|
152 | | -#define HV_X64_APIC_ACCESS_RECOMMENDED (1 << 3) |
---|
| 80 | +#define HV_X64_APIC_ACCESS_RECOMMENDED BIT(3) |
---|
153 | 81 | /* Recommend using the hypervisor-provided MSR to initiate a system RESET */ |
---|
154 | | -#define HV_X64_SYSTEM_RESET_RECOMMENDED (1 << 4) |
---|
| 82 | +#define HV_X64_SYSTEM_RESET_RECOMMENDED BIT(4) |
---|
155 | 83 | /* |
---|
156 | 84 | * Recommend using relaxed timing for this partition. If used, |
---|
157 | 85 | * the VM should disable any watchdog timeouts that rely on the |
---|
158 | 86 | * timely delivery of external interrupts |
---|
159 | 87 | */ |
---|
160 | | -#define HV_X64_RELAXED_TIMING_RECOMMENDED (1 << 5) |
---|
| 88 | +#define HV_X64_RELAXED_TIMING_RECOMMENDED BIT(5) |
---|
161 | 89 | |
---|
162 | 90 | /* |
---|
163 | 91 | * Recommend not using Auto End-Of-Interrupt feature |
---|
164 | 92 | */ |
---|
165 | | -#define HV_DEPRECATING_AEOI_RECOMMENDED (1 << 9) |
---|
| 93 | +#define HV_DEPRECATING_AEOI_RECOMMENDED BIT(9) |
---|
166 | 94 | |
---|
167 | 95 | /* |
---|
168 | 96 | * Recommend using cluster IPI hypercalls. |
---|
169 | 97 | */ |
---|
170 | | -#define HV_X64_CLUSTER_IPI_RECOMMENDED (1 << 10) |
---|
| 98 | +#define HV_X64_CLUSTER_IPI_RECOMMENDED BIT(10) |
---|
171 | 99 | |
---|
172 | 100 | /* Recommend using the newer ExProcessorMasks interface */ |
---|
173 | | -#define HV_X64_EX_PROCESSOR_MASKS_RECOMMENDED (1 << 11) |
---|
| 101 | +#define HV_X64_EX_PROCESSOR_MASKS_RECOMMENDED BIT(11) |
---|
174 | 102 | |
---|
175 | 103 | /* Recommend using enlightened VMCS */ |
---|
176 | | -#define HV_X64_ENLIGHTENED_VMCS_RECOMMENDED (1 << 14) |
---|
| 104 | +#define HV_X64_ENLIGHTENED_VMCS_RECOMMENDED BIT(14) |
---|
177 | 105 | |
---|
178 | 106 | /* |
---|
179 | | - * Crash notification flags. |
---|
| 107 | + * Virtual processor will never share a physical core with another virtual |
---|
| 108 | + * processor, except for virtual processors that are reported as sibling SMT |
---|
| 109 | + * threads. |
---|
180 | 110 | */ |
---|
181 | | -#define HV_CRASH_CTL_CRASH_NOTIFY_MSG BIT_ULL(62) |
---|
182 | | -#define HV_CRASH_CTL_CRASH_NOTIFY BIT_ULL(63) |
---|
| 111 | +#define HV_X64_NO_NONARCH_CORESHARING BIT(18) |
---|
| 112 | + |
---|
| 113 | +/* Nested features. These are HYPERV_CPUID_NESTED_FEATURES.EAX bits. */ |
---|
| 114 | +#define HV_X64_NESTED_DIRECT_FLUSH BIT(17) |
---|
| 115 | +#define HV_X64_NESTED_GUEST_MAPPING_FLUSH BIT(18) |
---|
| 116 | +#define HV_X64_NESTED_MSR_BITMAP BIT(19) |
---|
| 117 | + |
---|
| 118 | +/* Hyper-V specific model specific registers (MSRs) */ |
---|
183 | 119 | |
---|
184 | 120 | /* MSR used to identify the guest OS. */ |
---|
185 | 121 | #define HV_X64_MSR_GUEST_OS_ID 0x40000000 |
---|
.. | .. |
---|
198 | 134 | |
---|
199 | 135 | /* MSR used to read the per-partition time reference counter */ |
---|
200 | 136 | #define HV_X64_MSR_TIME_REF_COUNT 0x40000020 |
---|
| 137 | + |
---|
| 138 | +/* A partition's reference time stamp counter (TSC) page */ |
---|
| 139 | +#define HV_X64_MSR_REFERENCE_TSC 0x40000021 |
---|
201 | 140 | |
---|
202 | 141 | /* MSR used to retrieve the TSC frequency */ |
---|
203 | 142 | #define HV_X64_MSR_TSC_FREQUENCY 0x40000022 |
---|
.. | .. |
---|
246 | 185 | #define HV_X64_MSR_STIMER3_CONFIG 0x400000B6 |
---|
247 | 186 | #define HV_X64_MSR_STIMER3_COUNT 0x400000B7 |
---|
248 | 187 | |
---|
| 188 | +/* Hyper-V guest idle MSR */ |
---|
| 189 | +#define HV_X64_MSR_GUEST_IDLE 0x400000F0 |
---|
| 190 | + |
---|
249 | 191 | /* Hyper-V guest crash notification MSR's */ |
---|
250 | 192 | #define HV_X64_MSR_CRASH_P0 0x40000100 |
---|
251 | 193 | #define HV_X64_MSR_CRASH_P1 0x40000101 |
---|
.. | .. |
---|
253 | 195 | #define HV_X64_MSR_CRASH_P3 0x40000103 |
---|
254 | 196 | #define HV_X64_MSR_CRASH_P4 0x40000104 |
---|
255 | 197 | #define HV_X64_MSR_CRASH_CTL 0x40000105 |
---|
256 | | -#define HV_X64_MSR_CRASH_CTL_NOTIFY (1ULL << 63) |
---|
257 | | -#define HV_X64_MSR_CRASH_PARAMS \ |
---|
258 | | - (1 + (HV_X64_MSR_CRASH_P4 - HV_X64_MSR_CRASH_P0)) |
---|
| 198 | + |
---|
| 199 | +/* TSC emulation after migration */ |
---|
| 200 | +#define HV_X64_MSR_REENLIGHTENMENT_CONTROL 0x40000106 |
---|
| 201 | +#define HV_X64_MSR_TSC_EMULATION_CONTROL 0x40000107 |
---|
| 202 | +#define HV_X64_MSR_TSC_EMULATION_STATUS 0x40000108 |
---|
| 203 | + |
---|
| 204 | +/* TSC invariant control */ |
---|
| 205 | +#define HV_X64_MSR_TSC_INVARIANT_CONTROL 0x40000118 |
---|
259 | 206 | |
---|
260 | 207 | /* |
---|
261 | 208 | * Declare the MSR used to setup pages used to communicate with the hypervisor. |
---|
.. | .. |
---|
266 | 213 | u64 enable:1; |
---|
267 | 214 | u64 reserved:11; |
---|
268 | 215 | u64 guest_physical_address:52; |
---|
269 | | - }; |
---|
| 216 | + } __packed; |
---|
270 | 217 | }; |
---|
271 | | - |
---|
272 | | -/* |
---|
273 | | - * TSC page layout. |
---|
274 | | - */ |
---|
275 | | -struct ms_hyperv_tsc_page { |
---|
276 | | - volatile u32 tsc_sequence; |
---|
277 | | - u32 reserved1; |
---|
278 | | - volatile u64 tsc_scale; |
---|
279 | | - volatile s64 tsc_offset; |
---|
280 | | - u64 reserved2[509]; |
---|
281 | | -}; |
---|
282 | | - |
---|
283 | | -/* |
---|
284 | | - * The guest OS needs to register the guest ID with the hypervisor. |
---|
285 | | - * The guest ID is a 64 bit entity and the structure of this ID is |
---|
286 | | - * specified in the Hyper-V specification: |
---|
287 | | - * |
---|
288 | | - * msdn.microsoft.com/en-us/library/windows/hardware/ff542653%28v=vs.85%29.aspx |
---|
289 | | - * |
---|
290 | | - * While the current guideline does not specify how Linux guest ID(s) |
---|
291 | | - * need to be generated, our plan is to publish the guidelines for |
---|
292 | | - * Linux and other guest operating systems that currently are hosted |
---|
293 | | - * on Hyper-V. The implementation here conforms to this yet |
---|
294 | | - * unpublished guidelines. |
---|
295 | | - * |
---|
296 | | - * |
---|
297 | | - * Bit(s) |
---|
298 | | - * 63 - Indicates if the OS is Open Source or not; 1 is Open Source |
---|
299 | | - * 62:56 - Os Type; Linux is 0x100 |
---|
300 | | - * 55:48 - Distro specific identification |
---|
301 | | - * 47:16 - Linux kernel version number |
---|
302 | | - * 15:0 - Distro specific identification |
---|
303 | | - * |
---|
304 | | - * |
---|
305 | | - */ |
---|
306 | | - |
---|
307 | | -#define HV_LINUX_VENDOR_ID 0x8100 |
---|
308 | | - |
---|
309 | | -/* TSC emulation after migration */ |
---|
310 | | -#define HV_X64_MSR_REENLIGHTENMENT_CONTROL 0x40000106 |
---|
311 | | - |
---|
312 | | -/* Nested features (CPUID 0x4000000A) EAX */ |
---|
313 | | -#define HV_X64_NESTED_GUEST_MAPPING_FLUSH BIT(18) |
---|
314 | | -#define HV_X64_NESTED_MSR_BITMAP BIT(19) |
---|
315 | 218 | |
---|
316 | 219 | struct hv_reenlightenment_control { |
---|
317 | 220 | __u64 vector:8; |
---|
.. | .. |
---|
319 | 222 | __u64 enabled:1; |
---|
320 | 223 | __u64 reserved2:15; |
---|
321 | 224 | __u64 target_vp:32; |
---|
322 | | -}; |
---|
323 | | - |
---|
324 | | -#define HV_X64_MSR_TSC_EMULATION_CONTROL 0x40000107 |
---|
325 | | -#define HV_X64_MSR_TSC_EMULATION_STATUS 0x40000108 |
---|
| 225 | +} __packed; |
---|
326 | 226 | |
---|
327 | 227 | struct hv_tsc_emulation_control { |
---|
328 | 228 | __u64 enabled:1; |
---|
329 | 229 | __u64 reserved:63; |
---|
330 | | -}; |
---|
| 230 | +} __packed; |
---|
331 | 231 | |
---|
332 | 232 | struct hv_tsc_emulation_status { |
---|
333 | 233 | __u64 inprogress:1; |
---|
334 | 234 | __u64 reserved:63; |
---|
335 | | -}; |
---|
| 235 | +} __packed; |
---|
336 | 236 | |
---|
337 | 237 | #define HV_X64_MSR_HYPERCALL_ENABLE 0x00000001 |
---|
338 | 238 | #define HV_X64_MSR_HYPERCALL_PAGE_ADDRESS_SHIFT 12 |
---|
339 | 239 | #define HV_X64_MSR_HYPERCALL_PAGE_ADDRESS_MASK \ |
---|
340 | 240 | (~((1ull << HV_X64_MSR_HYPERCALL_PAGE_ADDRESS_SHIFT) - 1)) |
---|
341 | 241 | |
---|
| 242 | +#define HV_X64_MSR_CRASH_PARAMS \ |
---|
| 243 | + (1 + (HV_X64_MSR_CRASH_P4 - HV_X64_MSR_CRASH_P0)) |
---|
| 244 | + |
---|
342 | 245 | #define HV_IPI_LOW_VECTOR 0x10 |
---|
343 | 246 | #define HV_IPI_HIGH_VECTOR 0xff |
---|
344 | | - |
---|
345 | | -/* Declare the various hypercall operations. */ |
---|
346 | | -#define HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE 0x0002 |
---|
347 | | -#define HVCALL_FLUSH_VIRTUAL_ADDRESS_LIST 0x0003 |
---|
348 | | -#define HVCALL_NOTIFY_LONG_SPIN_WAIT 0x0008 |
---|
349 | | -#define HVCALL_SEND_IPI 0x000b |
---|
350 | | -#define HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE_EX 0x0013 |
---|
351 | | -#define HVCALL_FLUSH_VIRTUAL_ADDRESS_LIST_EX 0x0014 |
---|
352 | | -#define HVCALL_SEND_IPI_EX 0x0015 |
---|
353 | | -#define HVCALL_POST_MESSAGE 0x005c |
---|
354 | | -#define HVCALL_SIGNAL_EVENT 0x005d |
---|
355 | | -#define HVCALL_FLUSH_GUEST_PHYSICAL_ADDRESS_SPACE 0x00af |
---|
356 | 247 | |
---|
357 | 248 | #define HV_X64_MSR_VP_ASSIST_PAGE_ENABLE 0x00000001 |
---|
358 | 249 | #define HV_X64_MSR_VP_ASSIST_PAGE_ADDRESS_SHIFT 12 |
---|
.. | .. |
---|
365 | 256 | #define HV_X64_MSR_TSC_REFERENCE_ENABLE 0x00000001 |
---|
366 | 257 | #define HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT 12 |
---|
367 | 258 | |
---|
368 | | -#define HV_PROCESSOR_POWER_STATE_C0 0 |
---|
369 | | -#define HV_PROCESSOR_POWER_STATE_C1 1 |
---|
370 | | -#define HV_PROCESSOR_POWER_STATE_C2 2 |
---|
371 | | -#define HV_PROCESSOR_POWER_STATE_C3 3 |
---|
372 | | - |
---|
373 | | -#define HV_FLUSH_ALL_PROCESSORS BIT(0) |
---|
374 | | -#define HV_FLUSH_ALL_VIRTUAL_ADDRESS_SPACES BIT(1) |
---|
375 | | -#define HV_FLUSH_NON_GLOBAL_MAPPINGS_ONLY BIT(2) |
---|
376 | | -#define HV_FLUSH_USE_EXTENDED_RANGE_FORMAT BIT(3) |
---|
377 | | - |
---|
378 | | -enum HV_GENERIC_SET_FORMAT { |
---|
379 | | - HV_GENERIC_SET_SPARSE_4K, |
---|
380 | | - HV_GENERIC_SET_ALL, |
---|
381 | | -}; |
---|
382 | | - |
---|
383 | | -#define HV_HYPERCALL_RESULT_MASK GENMASK_ULL(15, 0) |
---|
384 | | -#define HV_HYPERCALL_FAST_BIT BIT(16) |
---|
385 | | -#define HV_HYPERCALL_VARHEAD_OFFSET 17 |
---|
386 | | -#define HV_HYPERCALL_REP_COMP_OFFSET 32 |
---|
387 | | -#define HV_HYPERCALL_REP_COMP_MASK GENMASK_ULL(43, 32) |
---|
388 | | -#define HV_HYPERCALL_REP_START_OFFSET 48 |
---|
389 | | -#define HV_HYPERCALL_REP_START_MASK GENMASK_ULL(59, 48) |
---|
390 | | - |
---|
391 | | -/* hypercall status code */ |
---|
392 | | -#define HV_STATUS_SUCCESS 0 |
---|
393 | | -#define HV_STATUS_INVALID_HYPERCALL_CODE 2 |
---|
394 | | -#define HV_STATUS_INVALID_HYPERCALL_INPUT 3 |
---|
395 | | -#define HV_STATUS_INVALID_ALIGNMENT 4 |
---|
396 | | -#define HV_STATUS_INVALID_PARAMETER 5 |
---|
397 | | -#define HV_STATUS_INSUFFICIENT_MEMORY 11 |
---|
398 | | -#define HV_STATUS_INVALID_PORT_ID 17 |
---|
399 | | -#define HV_STATUS_INVALID_CONNECTION_ID 18 |
---|
400 | | -#define HV_STATUS_INSUFFICIENT_BUFFERS 19 |
---|
401 | | - |
---|
402 | | -typedef struct _HV_REFERENCE_TSC_PAGE { |
---|
403 | | - __u32 tsc_sequence; |
---|
404 | | - __u32 res1; |
---|
405 | | - __u64 tsc_scale; |
---|
406 | | - __s64 tsc_offset; |
---|
407 | | -} HV_REFERENCE_TSC_PAGE, *PHV_REFERENCE_TSC_PAGE; |
---|
408 | | - |
---|
409 | | -/* Define the number of synthetic interrupt sources. */ |
---|
410 | | -#define HV_SYNIC_SINT_COUNT (16) |
---|
411 | | -/* Define the expected SynIC version. */ |
---|
412 | | -#define HV_SYNIC_VERSION_1 (0x1) |
---|
413 | | -/* Valid SynIC vectors are 16-255. */ |
---|
414 | | -#define HV_SYNIC_FIRST_VALID_VECTOR (16) |
---|
415 | | - |
---|
416 | | -#define HV_SYNIC_CONTROL_ENABLE (1ULL << 0) |
---|
417 | | -#define HV_SYNIC_SIMP_ENABLE (1ULL << 0) |
---|
418 | | -#define HV_SYNIC_SIEFP_ENABLE (1ULL << 0) |
---|
419 | | -#define HV_SYNIC_SINT_MASKED (1ULL << 16) |
---|
420 | | -#define HV_SYNIC_SINT_AUTO_EOI (1ULL << 17) |
---|
421 | | -#define HV_SYNIC_SINT_VECTOR_MASK (0xFF) |
---|
422 | | - |
---|
423 | | -#define HV_SYNIC_STIMER_COUNT (4) |
---|
424 | | - |
---|
425 | | -/* Define synthetic interrupt controller message constants. */ |
---|
426 | | -#define HV_MESSAGE_SIZE (256) |
---|
427 | | -#define HV_MESSAGE_PAYLOAD_BYTE_COUNT (240) |
---|
428 | | -#define HV_MESSAGE_PAYLOAD_QWORD_COUNT (30) |
---|
429 | 259 | |
---|
430 | 260 | /* Define hypervisor message types. */ |
---|
431 | 261 | enum hv_message_type { |
---|
.. | .. |
---|
436 | 266 | HVMSG_GPA_INTERCEPT = 0x80000001, |
---|
437 | 267 | |
---|
438 | 268 | /* Timer notification messages. */ |
---|
439 | | - HVMSG_TIMER_EXPIRED = 0x80000010, |
---|
| 269 | + HVMSG_TIMER_EXPIRED = 0x80000010, |
---|
440 | 270 | |
---|
441 | 271 | /* Error messages. */ |
---|
442 | 272 | HVMSG_INVALID_VP_REGISTER_VALUE = 0x80000020, |
---|
443 | 273 | HVMSG_UNRECOVERABLE_EXCEPTION = 0x80000021, |
---|
444 | | - HVMSG_UNSUPPORTED_FEATURE = 0x80000022, |
---|
| 274 | + HVMSG_UNSUPPORTED_FEATURE = 0x80000022, |
---|
445 | 275 | |
---|
446 | 276 | /* Trace buffer complete messages. */ |
---|
447 | 277 | HVMSG_EVENTLOG_BUFFERCOMPLETE = 0x80000040, |
---|
448 | 278 | |
---|
449 | 279 | /* Platform-specific processor intercept messages. */ |
---|
450 | | - HVMSG_X64_IOPORT_INTERCEPT = 0x80010000, |
---|
| 280 | + HVMSG_X64_IOPORT_INTERCEPT = 0x80010000, |
---|
451 | 281 | HVMSG_X64_MSR_INTERCEPT = 0x80010001, |
---|
452 | | - HVMSG_X64_CPUID_INTERCEPT = 0x80010002, |
---|
| 282 | + HVMSG_X64_CPUID_INTERCEPT = 0x80010002, |
---|
453 | 283 | HVMSG_X64_EXCEPTION_INTERCEPT = 0x80010003, |
---|
454 | | - HVMSG_X64_APIC_EOI = 0x80010004, |
---|
455 | | - HVMSG_X64_LEGACY_FP_ERROR = 0x80010005 |
---|
| 284 | + HVMSG_X64_APIC_EOI = 0x80010004, |
---|
| 285 | + HVMSG_X64_LEGACY_FP_ERROR = 0x80010005 |
---|
456 | 286 | }; |
---|
457 | 287 | |
---|
458 | | -/* Define synthetic interrupt controller message flags. */ |
---|
459 | | -union hv_message_flags { |
---|
460 | | - __u8 asu8; |
---|
| 288 | +struct hv_nested_enlightenments_control { |
---|
461 | 289 | struct { |
---|
462 | | - __u8 msg_pending:1; |
---|
463 | | - __u8 reserved:7; |
---|
464 | | - }; |
---|
465 | | -}; |
---|
466 | | - |
---|
467 | | -/* Define port identifier type. */ |
---|
468 | | -union hv_port_id { |
---|
469 | | - __u32 asu32; |
---|
| 290 | + __u32 directhypercall:1; |
---|
| 291 | + __u32 reserved:31; |
---|
| 292 | + } features; |
---|
470 | 293 | struct { |
---|
471 | | - __u32 id:24; |
---|
472 | | - __u32 reserved:8; |
---|
473 | | - } u; |
---|
474 | | -}; |
---|
475 | | - |
---|
476 | | -/* Define synthetic interrupt controller message header. */ |
---|
477 | | -struct hv_message_header { |
---|
478 | | - __u32 message_type; |
---|
479 | | - __u8 payload_size; |
---|
480 | | - union hv_message_flags message_flags; |
---|
481 | | - __u8 reserved[2]; |
---|
482 | | - union { |
---|
483 | | - __u64 sender; |
---|
484 | | - union hv_port_id port; |
---|
485 | | - }; |
---|
486 | | -}; |
---|
487 | | - |
---|
488 | | -/* Define synthetic interrupt controller message format. */ |
---|
489 | | -struct hv_message { |
---|
490 | | - struct hv_message_header header; |
---|
491 | | - union { |
---|
492 | | - __u64 payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT]; |
---|
493 | | - } u; |
---|
494 | | -}; |
---|
495 | | - |
---|
496 | | -/* Define the synthetic interrupt message page layout. */ |
---|
497 | | -struct hv_message_page { |
---|
498 | | - struct hv_message sint_message[HV_SYNIC_SINT_COUNT]; |
---|
499 | | -}; |
---|
500 | | - |
---|
501 | | -/* Define timer message payload structure. */ |
---|
502 | | -struct hv_timer_message_payload { |
---|
503 | | - __u32 timer_index; |
---|
504 | | - __u32 reserved; |
---|
505 | | - __u64 expiration_time; /* When the timer expired */ |
---|
506 | | - __u64 delivery_time; /* When the message was delivered */ |
---|
507 | | -}; |
---|
| 294 | + __u32 reserved; |
---|
| 295 | + } hypercallControls; |
---|
| 296 | +} __packed; |
---|
508 | 297 | |
---|
509 | 298 | /* Define virtual processor assist page structure. */ |
---|
510 | 299 | struct hv_vp_assist_page { |
---|
511 | 300 | __u32 apic_assist; |
---|
512 | | - __u32 reserved; |
---|
513 | | - __u64 vtl_control[2]; |
---|
514 | | - __u64 nested_enlightenments_control[2]; |
---|
515 | | - __u32 enlighten_vmentry; |
---|
| 301 | + __u32 reserved1; |
---|
| 302 | + __u64 vtl_control[3]; |
---|
| 303 | + struct hv_nested_enlightenments_control nested_control; |
---|
| 304 | + __u8 enlighten_vmentry; |
---|
| 305 | + __u8 reserved2[7]; |
---|
516 | 306 | __u64 current_nested_vmcs; |
---|
517 | | -}; |
---|
| 307 | +} __packed; |
---|
518 | 308 | |
---|
519 | 309 | struct hv_enlightened_vmcs { |
---|
520 | 310 | u32 revision_id; |
---|
.. | .. |
---|
527 | 317 | u16 host_fs_selector; |
---|
528 | 318 | u16 host_gs_selector; |
---|
529 | 319 | u16 host_tr_selector; |
---|
| 320 | + |
---|
| 321 | + u16 padding16_1; |
---|
530 | 322 | |
---|
531 | 323 | u64 host_ia32_pat; |
---|
532 | 324 | u64 host_ia32_efer; |
---|
.. | .. |
---|
646 | 438 | u64 ept_pointer; |
---|
647 | 439 | |
---|
648 | 440 | u16 virtual_processor_id; |
---|
649 | | - u16 padding16[3]; |
---|
| 441 | + u16 padding16_2[3]; |
---|
650 | 442 | |
---|
651 | 443 | u64 padding64_2[5]; |
---|
652 | 444 | u64 guest_physical_address; |
---|
.. | .. |
---|
682 | 474 | u64 guest_rip; |
---|
683 | 475 | |
---|
684 | 476 | u32 hv_clean_fields; |
---|
685 | | - u32 hv_padding_32; |
---|
| 477 | + u32 padding32_1; |
---|
686 | 478 | u32 hv_synthetic_controls; |
---|
687 | 479 | struct { |
---|
688 | 480 | u32 nested_flush_hypercall:1; |
---|
689 | 481 | u32 msr_bitmap:1; |
---|
690 | 482 | u32 reserved:30; |
---|
691 | | - } hv_enlightenments_control; |
---|
| 483 | + } __packed hv_enlightenments_control; |
---|
692 | 484 | u32 hv_vp_id; |
---|
693 | | - |
---|
| 485 | + u32 padding32_2; |
---|
694 | 486 | u64 hv_vm_id; |
---|
695 | 487 | u64 partition_assist_page; |
---|
696 | 488 | u64 padding64_4[4]; |
---|
.. | .. |
---|
698 | 490 | u64 padding64_5[7]; |
---|
699 | 491 | u64 xss_exit_bitmap; |
---|
700 | 492 | u64 padding64_6[7]; |
---|
701 | | -}; |
---|
| 493 | +} __packed; |
---|
702 | 494 | |
---|
703 | 495 | #define HV_VMX_ENLIGHTENED_CLEAN_FIELD_NONE 0 |
---|
704 | 496 | #define HV_VMX_ENLIGHTENED_CLEAN_FIELD_IO_BITMAP BIT(0) |
---|
.. | .. |
---|
720 | 512 | |
---|
721 | 513 | #define HV_VMX_ENLIGHTENED_CLEAN_FIELD_ALL 0xFFFF |
---|
722 | 514 | |
---|
723 | | -#define HV_STIMER_ENABLE (1ULL << 0) |
---|
724 | | -#define HV_STIMER_PERIODIC (1ULL << 1) |
---|
725 | | -#define HV_STIMER_LAZY (1ULL << 2) |
---|
726 | | -#define HV_STIMER_AUTOENABLE (1ULL << 3) |
---|
727 | | -#define HV_STIMER_SINT(config) (__u8)(((config) >> 16) & 0x0F) |
---|
728 | | - |
---|
729 | | -struct hv_vpset { |
---|
730 | | - u64 format; |
---|
731 | | - u64 valid_bank_mask; |
---|
732 | | - u64 bank_contents[]; |
---|
| 515 | +struct hv_partition_assist_pg { |
---|
| 516 | + u32 tlb_lock_count; |
---|
733 | 517 | }; |
---|
734 | 518 | |
---|
735 | | -/* HvCallSendSyntheticClusterIpi hypercall */ |
---|
736 | | -struct hv_send_ipi { |
---|
737 | | - u32 vector; |
---|
738 | | - u32 reserved; |
---|
739 | | - u64 cpu_mask; |
---|
740 | | -}; |
---|
741 | 519 | |
---|
742 | | -/* HvCallSendSyntheticClusterIpiEx hypercall */ |
---|
743 | | -struct hv_send_ipi_ex { |
---|
744 | | - u32 vector; |
---|
745 | | - u32 reserved; |
---|
746 | | - struct hv_vpset vp_set; |
---|
747 | | -}; |
---|
748 | | - |
---|
749 | | -/* HvFlushGuestPhysicalAddressSpace hypercalls */ |
---|
750 | | -struct hv_guest_mapping_flush { |
---|
751 | | - u64 address_space; |
---|
752 | | - u64 flags; |
---|
753 | | -}; |
---|
754 | | - |
---|
755 | | -/* HvFlushVirtualAddressSpace, HvFlushVirtualAddressList hypercalls */ |
---|
756 | | -struct hv_tlb_flush { |
---|
757 | | - u64 address_space; |
---|
758 | | - u64 flags; |
---|
759 | | - u64 processor_mask; |
---|
760 | | - u64 gva_list[]; |
---|
761 | | -}; |
---|
762 | | - |
---|
763 | | -/* HvFlushVirtualAddressSpaceEx, HvFlushVirtualAddressListEx hypercalls */ |
---|
764 | | -struct hv_tlb_flush_ex { |
---|
765 | | - u64 address_space; |
---|
766 | | - u64 flags; |
---|
767 | | - struct hv_vpset hv_vp_set; |
---|
768 | | - u64 gva_list[]; |
---|
769 | | -}; |
---|
| 520 | +#include <asm-generic/hyperv-tlfs.h> |
---|
770 | 521 | |
---|
771 | 522 | #endif |
---|