Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * Copyright (c) 2009, Microsoft Corporation. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify it |
| 6 | * under the terms and conditions of the GNU General Public License, |
| 7 | * version 2, as published by the Free Software Foundation. |
| 8 | * |
| 9 | * This program is distributed in the hope it will be useful, but WITHOUT |
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 12 | * more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License along with |
| 15 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
| 16 | * Place - Suite 330, Boston, MA 02111-1307 USA. |
| 17 | * |
| 18 | * Authors: |
| 19 | * Haiyang Zhang <haiyangz@microsoft.com> |
| 20 | * Hank Janssen <hjanssen@microsoft.com> |
| 21 | * |
| 22 | */ |
Greg Kroah-Hartman | 6658be6 | 2009-08-20 12:13:27 -0700 | [diff] [blame] | 23 | #ifndef __HV_API_H |
| 24 | #define __HV_API_H |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 25 | |
K. Y. Srinivasan | e3fe0bb | 2011-02-11 10:00:12 -0800 | [diff] [blame] | 26 | struct hv_guid { |
| 27 | unsigned char data[16]; |
| 28 | }; |
| 29 | |
| 30 | |
Greg Kroah-Hartman | 65452d1 | 2009-08-20 12:15:17 -0700 | [diff] [blame] | 31 | |
| 32 | /* Status codes for hypervisor operations. */ |
| 33 | |
| 34 | /* |
| 35 | * HV_STATUS_SUCCESS |
| 36 | * The specified hypercall succeeded |
| 37 | */ |
| 38 | #define HV_STATUS_SUCCESS ((u16)0x0000) |
| 39 | |
| 40 | /* |
| 41 | * HV_STATUS_INVALID_HYPERCALL_CODE |
| 42 | * The hypervisor does not support the operation because the specified |
| 43 | * hypercall code is not supported. |
| 44 | */ |
| 45 | #define HV_STATUS_INVALID_HYPERCALL_CODE ((u16)0x0002) |
| 46 | |
| 47 | /* |
| 48 | * HV_STATUS_INVALID_HYPERCALL_INPUT |
| 49 | * The hypervisor does not support the operation because the encoding for the |
| 50 | * hypercall input register is not supported. |
| 51 | */ |
| 52 | #define HV_STATUS_INVALID_HYPERCALL_INPUT ((u16)0x0003) |
| 53 | |
| 54 | /* |
| 55 | * HV_STATUS_INVALID_ALIGNMENT |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 56 | * The hypervisor could not perform the operation because a parameter has an |
Greg Kroah-Hartman | 65452d1 | 2009-08-20 12:15:17 -0700 | [diff] [blame] | 57 | * invalid alignment. |
| 58 | */ |
| 59 | #define HV_STATUS_INVALID_ALIGNMENT ((u16)0x0004) |
| 60 | |
| 61 | /* |
| 62 | * HV_STATUS_INVALID_PARAMETER |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 63 | * The hypervisor could not perform the operation because an invalid parameter |
Greg Kroah-Hartman | 65452d1 | 2009-08-20 12:15:17 -0700 | [diff] [blame] | 64 | * was specified. |
| 65 | */ |
| 66 | #define HV_STATUS_INVALID_PARAMETER ((u16)0x0005) |
| 67 | |
| 68 | /* |
| 69 | * HV_STATUS_ACCESS_DENIED |
| 70 | * Access to the specified object was denied. |
| 71 | */ |
| 72 | #define HV_STATUS_ACCESS_DENIED ((u16)0x0006) |
| 73 | |
| 74 | /* |
| 75 | * HV_STATUS_INVALID_PARTITION_STATE |
| 76 | * The hypervisor could not perform the operation because the partition is |
| 77 | * entering or in an invalid state. |
| 78 | */ |
| 79 | #define HV_STATUS_INVALID_PARTITION_STATE ((u16)0x0007) |
| 80 | |
| 81 | /* |
| 82 | * HV_STATUS_OPERATION_DENIED |
| 83 | * The operation is not allowed in the current state. |
| 84 | */ |
| 85 | #define HV_STATUS_OPERATION_DENIED ((u16)0x0008) |
| 86 | |
| 87 | /* |
| 88 | * HV_STATUS_UNKNOWN_PROPERTY |
| 89 | * The hypervisor does not recognize the specified partition property. |
| 90 | */ |
| 91 | #define HV_STATUS_UNKNOWN_PROPERTY ((u16)0x0009) |
| 92 | |
| 93 | /* |
| 94 | * HV_STATUS_PROPERTY_VALUE_OUT_OF_RANGE |
| 95 | * The specified value of a partition property is out of range or violates an |
| 96 | * invariant. |
| 97 | */ |
| 98 | #define HV_STATUS_PROPERTY_VALUE_OUT_OF_RANGE ((u16)0x000A) |
| 99 | |
| 100 | /* |
| 101 | * HV_STATUS_INSUFFICIENT_MEMORY |
| 102 | * There is not enough memory in the hypervisor pool to complete the operation. |
| 103 | */ |
| 104 | #define HV_STATUS_INSUFFICIENT_MEMORY ((u16)0x000B) |
| 105 | |
| 106 | /* |
| 107 | * HV_STATUS_PARTITION_TOO_DEEP |
| 108 | * The maximum partition depth has been exceeded for the partition hierarchy. |
| 109 | */ |
| 110 | #define HV_STATUS_PARTITION_TOO_DEEP ((u16)0x000C) |
| 111 | |
| 112 | /* |
| 113 | * HV_STATUS_INVALID_PARTITION_ID |
| 114 | * A partition with the specified partition Id does not exist. |
| 115 | */ |
| 116 | #define HV_STATUS_INVALID_PARTITION_ID ((u16)0x000D) |
| 117 | |
| 118 | /* |
| 119 | * HV_STATUS_INVALID_VP_INDEX |
| 120 | * The hypervisor could not perform the operation because the specified VP |
| 121 | * index is invalid. |
| 122 | */ |
| 123 | #define HV_STATUS_INVALID_VP_INDEX ((u16)0x000E) |
| 124 | |
| 125 | /* |
| 126 | * HV_STATUS_NOT_FOUND |
| 127 | * The iteration is complete; no addition items in the iteration could be |
| 128 | * found. |
| 129 | */ |
| 130 | #define HV_STATUS_NOT_FOUND ((u16)0x0010) |
| 131 | |
| 132 | /* |
| 133 | * HV_STATUS_INVALID_PORT_ID |
| 134 | * The hypervisor could not perform the operation because the specified port |
| 135 | * identifier is invalid. |
| 136 | */ |
| 137 | #define HV_STATUS_INVALID_PORT_ID ((u16)0x0011) |
| 138 | |
| 139 | /* |
| 140 | * HV_STATUS_INVALID_CONNECTION_ID |
| 141 | * The hypervisor could not perform the operation because the specified |
| 142 | * connection identifier is invalid. |
| 143 | */ |
| 144 | #define HV_STATUS_INVALID_CONNECTION_ID ((u16)0x0012) |
| 145 | |
| 146 | /* |
| 147 | * HV_STATUS_INSUFFICIENT_BUFFERS |
| 148 | * You did not supply enough message buffers to send a message. |
| 149 | */ |
| 150 | #define HV_STATUS_INSUFFICIENT_BUFFERS ((u16)0x0013) |
| 151 | |
| 152 | /* |
| 153 | * HV_STATUS_NOT_ACKNOWLEDGED |
| 154 | * The previous virtual interrupt has not been acknowledged. |
| 155 | */ |
| 156 | #define HV_STATUS_NOT_ACKNOWLEDGED ((u16)0x0014) |
| 157 | |
| 158 | /* |
| 159 | * HV_STATUS_INVALID_VP_STATE |
| 160 | * A virtual processor is not in the correct state for the performance of the |
| 161 | * indicated operation. |
| 162 | */ |
| 163 | #define HV_STATUS_INVALID_VP_STATE ((u16)0x0015) |
| 164 | |
| 165 | /* |
| 166 | * HV_STATUS_ACKNOWLEDGED |
| 167 | * The previous virtual interrupt has already been acknowledged. |
| 168 | */ |
| 169 | #define HV_STATUS_ACKNOWLEDGED ((u16)0x0016) |
| 170 | |
| 171 | /* |
| 172 | * HV_STATUS_INVALID_SAVE_RESTORE_STATE |
| 173 | * The indicated partition is not in a valid state for saving or restoring. |
| 174 | */ |
| 175 | #define HV_STATUS_INVALID_SAVE_RESTORE_STATE ((u16)0x0017) |
| 176 | |
| 177 | /* |
| 178 | * HV_STATUS_INVALID_SYNIC_STATE |
| 179 | * The hypervisor could not complete the operation because a required feature |
| 180 | * of the synthetic interrupt controller (SynIC) was disabled. |
| 181 | */ |
| 182 | #define HV_STATUS_INVALID_SYNIC_STATE ((u16)0x0018) |
| 183 | |
| 184 | /* |
| 185 | * HV_STATUS_OBJECT_IN_USE |
| 186 | * The hypervisor could not perform the operation because the object or value |
| 187 | * was either already in use or being used for a purpose that would not permit |
| 188 | * completing the operation. |
| 189 | */ |
| 190 | #define HV_STATUS_OBJECT_IN_USE ((u16)0x0019) |
| 191 | |
| 192 | /* |
| 193 | * HV_STATUS_INVALID_PROXIMITY_DOMAIN_INFO |
| 194 | * The proximity domain information is invalid. |
| 195 | */ |
| 196 | #define HV_STATUS_INVALID_PROXIMITY_DOMAIN_INFO ((u16)0x001A) |
| 197 | |
| 198 | /* |
| 199 | * HV_STATUS_NO_DATA |
| 200 | * An attempt to retrieve debugging data failed because none was available. |
| 201 | */ |
| 202 | #define HV_STATUS_NO_DATA ((u16)0x001B) |
| 203 | |
| 204 | /* |
| 205 | * HV_STATUS_INACTIVE |
| 206 | * The physical connection being used for debuggging has not recorded any |
| 207 | * receive activity since the last operation. |
| 208 | */ |
| 209 | #define HV_STATUS_INACTIVE ((u16)0x001C) |
| 210 | |
| 211 | /* |
| 212 | * HV_STATUS_NO_RESOURCES |
| 213 | * There are not enough resources to complete the operation. |
| 214 | */ |
| 215 | #define HV_STATUS_NO_RESOURCES ((u16)0x001D) |
| 216 | |
| 217 | /* |
| 218 | * HV_STATUS_FEATURE_UNAVAILABLE |
| 219 | * A hypervisor feature is not available to the user. |
| 220 | */ |
| 221 | #define HV_STATUS_FEATURE_UNAVAILABLE ((u16)0x001E) |
| 222 | |
| 223 | /* |
| 224 | * HV_STATUS_UNSUCCESSFUL |
| 225 | * {Operation Failed} The requested operation was unsuccessful. |
| 226 | */ |
| 227 | #define HV_STATUS_UNSUCCESSFUL ((u16)0x1001) |
| 228 | |
| 229 | /* |
| 230 | * HV_STATUS_INSUFFICIENT_BUFFER |
| 231 | * The specified buffer was too small to contain all of the requested data. |
| 232 | */ |
| 233 | #define HV_STATUS_INSUFFICIENT_BUFFER ((u16)0x1002) |
| 234 | |
| 235 | /* |
| 236 | * HV_STATUS_GPA_NOT_PRESENT |
| 237 | * The guest physical address is not currently associated with a system |
| 238 | * physical address. |
| 239 | */ |
| 240 | #define HV_STATUS_GPA_NOT_PRESENT ((u16)0x1003) |
| 241 | |
| 242 | /* |
| 243 | * HV_STATUS_GUEST_PAGE_FAULT |
| 244 | * The operation would have resulted in a page fault in the guest. |
| 245 | */ |
| 246 | #define HV_STATUS_GUEST_PAGE_FAULT ((u16)0x1004) |
| 247 | |
| 248 | /* |
| 249 | * HV_STATUS_RUNDOWN_DISABLED |
| 250 | * The operation cannot proceed as the rundown object was marked disabled. |
| 251 | */ |
| 252 | #define HV_STATUS_RUNDOWN_DISABLED ((u16)0x1005) |
| 253 | |
| 254 | /* |
| 255 | * HV_STATUS_KEY_ALREADY_EXISTS |
| 256 | * The entry cannot be added as another entry with the same key already exists. |
| 257 | */ |
| 258 | #define HV_STATUS_KEY_ALREADY_EXISTS ((u16)0x1006) |
| 259 | |
| 260 | /* |
| 261 | * HV_STATUS_GPA_INTERCEPT |
| 262 | * The operation resulted an intercept on a region of guest physical memory. |
| 263 | */ |
| 264 | #define HV_STATUS_GPA_INTERCEPT ((u16)0x1007) |
| 265 | |
| 266 | /* |
| 267 | * HV_STATUS_GUEST_GENERAL_PROTECTION_FAULT |
| 268 | * The operation would have resulted in a general protection fault in the |
| 269 | * guest. |
| 270 | */ |
| 271 | #define HV_STATUS_GUEST_GENERAL_PROTECTION_FAULT ((u16)0x1008) |
| 272 | |
| 273 | /* |
| 274 | * HV_STATUS_GUEST_STACK_FAULT |
| 275 | * The operation would have resulted in a stack fault in the guest. |
| 276 | */ |
| 277 | #define HV_STATUS_GUEST_STACK_FAULT ((u16)0x1009) |
| 278 | |
| 279 | /* |
| 280 | * HV_STATUS_GUEST_INVALID_OPCODE_FAULT |
| 281 | * The operation would have resulted in an invalid opcode fault in the guest. |
| 282 | */ |
| 283 | #define HV_STATUS_GUEST_INVALID_OPCODE_FAULT ((u16)0x100A) |
| 284 | |
| 285 | /* |
| 286 | * HV_STATUS_FINALIZE_INCOMPLETE |
| 287 | * The partition is not completely finalized. |
| 288 | */ |
| 289 | #define HV_STATUS_FINALIZE_INCOMPLETE ((u16)0x100B) |
| 290 | |
| 291 | /* |
| 292 | * HV_STATUS_GUEST_MACHINE_CHECK_ABORT |
| 293 | * The operation would have resulted in an machine check abort in the guest. |
| 294 | */ |
| 295 | #define HV_STATUS_GUEST_MACHINE_CHECK_ABORT ((u16)0x100C) |
| 296 | |
| 297 | /* |
| 298 | * HV_STATUS_ILLEGAL_OVERLAY_ACCESS |
| 299 | * An illegal access was attempted to an overlay page. |
| 300 | */ |
| 301 | #define HV_STATUS_ILLEGAL_OVERLAY_ACCESS ((u16)0x100D) |
| 302 | |
| 303 | /* |
| 304 | * HV_STATUS_INSUFFICIENT_SYSTEM_VA |
| 305 | * There is not enough system VA space available to satisfy the request, |
| 306 | */ |
| 307 | #define HV_STATUS_INSUFFICIENT_SYSTEM_VA ((u16)0x100E) |
| 308 | |
| 309 | /* |
| 310 | * HV_STATUS_VIRTUAL_ADDRESS_NOT_MAPPED |
| 311 | * The passed virtual address was not mapped in the hypervisor address space. |
| 312 | */ |
| 313 | #define HV_STATUS_VIRTUAL_ADDRESS_NOT_MAPPED ((u16)0x100F) |
| 314 | |
| 315 | /* |
| 316 | * HV_STATUS_NOT_IMPLEMENTED |
| 317 | * The requested operation is not implemented in this version of the |
| 318 | * hypervisor. |
| 319 | */ |
| 320 | #define HV_STATUS_NOT_IMPLEMENTED ((u16)0x1010) |
| 321 | |
| 322 | /* |
| 323 | * HV_STATUS_VMX_INSTRUCTION_FAILED |
André Goddard Rosa | bbc9a99 | 2009-11-14 13:09:06 -0200 | [diff] [blame] | 324 | * The requested VMX instruction failed to complete successfully. |
Greg Kroah-Hartman | 65452d1 | 2009-08-20 12:15:17 -0700 | [diff] [blame] | 325 | */ |
| 326 | #define HV_STATUS_VMX_INSTRUCTION_FAILED ((u16)0x1011) |
| 327 | |
| 328 | /* |
| 329 | * HV_STATUS_VMX_INSTRUCTION_FAILED_WITH_STATUS |
André Goddard Rosa | bbc9a99 | 2009-11-14 13:09:06 -0200 | [diff] [blame] | 330 | * The requested VMX instruction failed to complete successfully indicating |
Greg Kroah-Hartman | 65452d1 | 2009-08-20 12:15:17 -0700 | [diff] [blame] | 331 | * status. |
| 332 | */ |
| 333 | #define HV_STATUS_VMX_INSTRUCTION_FAILED_WITH_STATUS ((u16)0x1012) |
| 334 | |
| 335 | /* |
| 336 | * HV_STATUS_MSR_ACCESS_FAILED |
| 337 | * The requested access to the model specific register failed. |
| 338 | */ |
| 339 | #define HV_STATUS_MSR_ACCESS_FAILED ((u16)0x1013) |
| 340 | |
| 341 | /* |
| 342 | * HV_STATUS_CR_ACCESS_FAILED |
| 343 | * The requested access to the control register failed. |
| 344 | */ |
| 345 | #define HV_STATUS_CR_ACCESS_FAILED ((u16)0x1014) |
| 346 | |
| 347 | /* |
| 348 | * HV_STATUS_TIMEOUT |
| 349 | * The specified timeout expired before the operation completed. |
| 350 | */ |
| 351 | #define HV_STATUS_TIMEOUT ((u16)0x1016) |
| 352 | |
| 353 | /* |
| 354 | * HV_STATUS_MSR_INTERCEPT |
| 355 | * The requested access to the model specific register generated an intercept. |
| 356 | */ |
| 357 | #define HV_STATUS_MSR_INTERCEPT ((u16)0x1017) |
| 358 | |
| 359 | /* |
| 360 | * HV_STATUS_CPUID_INTERCEPT |
| 361 | * The CPUID instruction generated an intercept. |
| 362 | */ |
| 363 | #define HV_STATUS_CPUID_INTERCEPT ((u16)0x1018) |
| 364 | |
| 365 | /* |
| 366 | * HV_STATUS_REPEAT_INSTRUCTION |
| 367 | * The current instruction should be repeated and the instruction pointer not |
| 368 | * advanced. |
| 369 | */ |
| 370 | #define HV_STATUS_REPEAT_INSTRUCTION ((u16)0x1019) |
| 371 | |
| 372 | /* |
| 373 | * HV_STATUS_PAGE_PROTECTION_VIOLATION |
| 374 | * The current instruction should be repeated and the instruction pointer not |
| 375 | * advanced. |
| 376 | */ |
| 377 | #define HV_STATUS_PAGE_PROTECTION_VIOLATION ((u16)0x101A) |
| 378 | |
| 379 | /* |
| 380 | * HV_STATUS_PAGE_TABLE_INVALID |
| 381 | * The current instruction should be repeated and the instruction pointer not |
| 382 | * advanced. |
| 383 | */ |
| 384 | #define HV_STATUS_PAGE_TABLE_INVALID ((u16)0x101B) |
| 385 | |
| 386 | /* |
| 387 | * HV_STATUS_PAGE_NOT_PRESENT |
| 388 | * The current instruction should be repeated and the instruction pointer not |
| 389 | * advanced. |
| 390 | */ |
| 391 | #define HV_STATUS_PAGE_NOT_PRESENT ((u16)0x101C) |
| 392 | |
| 393 | /* |
| 394 | * HV_STATUS_IO_INTERCEPT |
| 395 | * The requested access to the I/O port generated an intercept. |
| 396 | */ |
| 397 | #define HV_STATUS_IO_INTERCEPT ((u16)0x101D) |
| 398 | |
| 399 | /* |
| 400 | * HV_STATUS_NOTHING_TO_DO |
| 401 | * There is nothing to do. |
| 402 | */ |
| 403 | #define HV_STATUS_NOTHING_TO_DO ((u16)0x101E) |
| 404 | |
| 405 | /* |
| 406 | * HV_STATUS_THREAD_TERMINATING |
| 407 | * The requested thread is terminating. |
| 408 | */ |
| 409 | #define HV_STATUS_THREAD_TERMINATING ((u16)0x101F) |
| 410 | |
| 411 | /* |
| 412 | * HV_STATUS_SECTION_ALREADY_CONSTRUCTED |
| 413 | * The specified section was already constructed. |
| 414 | */ |
| 415 | #define HV_STATUS_SECTION_ALREADY_CONSTRUCTED ((u16)0x1020) |
| 416 | |
| 417 | /* HV_STATUS_SECTION_NOT_ALREADY_CONSTRUCTED |
| 418 | * The specified section was not already constructed. |
| 419 | */ |
| 420 | #define HV_STATUS_SECTION_NOT_ALREADY_CONSTRUCTED ((u16)0x1021) |
| 421 | |
| 422 | /* |
| 423 | * HV_STATUS_PAGE_ALREADY_COMMITTED |
| 424 | * The specified virtual address was already backed by physical memory. |
| 425 | */ |
| 426 | #define HV_STATUS_PAGE_ALREADY_COMMITTED ((u16)0x1022) |
| 427 | |
| 428 | /* |
| 429 | * HV_STATUS_PAGE_NOT_ALREADY_COMMITTED |
| 430 | * The specified virtual address was not already backed by physical memory. |
| 431 | */ |
| 432 | #define HV_STATUS_PAGE_NOT_ALREADY_COMMITTED ((u16)0x1023) |
| 433 | |
| 434 | /* |
| 435 | * HV_STATUS_COMMITTED_PAGES_REMAIN |
| 436 | * Committed pages remain in the section. |
| 437 | */ |
| 438 | #define HV_STATUS_COMMITTED_PAGES_REMAIN ((u16)0x1024) |
| 439 | |
| 440 | /* |
| 441 | * HV_STATUS_NO_REMAINING_COMMITTED_PAGES |
| 442 | * No additional committed pages beyond the specified page exist in the |
| 443 | * section. |
| 444 | */ |
| 445 | #define HV_STATUS_NO_REMAINING_COMMITTED_PAGES ((u16)0x1025) |
| 446 | |
| 447 | /* |
| 448 | * HV_STATUS_INSUFFICIENT_COMPARTMENT_VA |
| 449 | * The VA space of the compartment is exhausted. |
| 450 | */ |
| 451 | #define HV_STATUS_INSUFFICIENT_COMPARTMENT_VA ((u16)0x1026) |
| 452 | |
| 453 | /* |
| 454 | * HV_STATUS_DEREF_SPA_LIST_FULL |
| 455 | * The SPA dereference list is full, and there are additional entries to be |
| 456 | * added to it. |
| 457 | */ |
| 458 | #define HV_STATUS_DEREF_SPA_LIST_FULL ((u16)0x1027) |
| 459 | |
| 460 | /* |
| 461 | * HV_STATUS_GPA_OUT_OF_RANGE |
| 462 | * The supplied GPA is out of range. |
| 463 | */ |
| 464 | #define HV_STATUS_GPA_OUT_OF_RANGE ((u16)0x1027) |
| 465 | |
| 466 | /* |
| 467 | * HV_STATUS_NONVOLATILE_XMM_STALE |
| 468 | * The XMM register that was being accessed is stale. |
| 469 | */ |
| 470 | #define HV_STATUS_NONVOLATILE_XMM_STALE ((u16)0x1028) |
| 471 | |
| 472 | /* HV_STATUS_UNSUPPORTED_PROCESSOR |
| 473 | * The hypervisor does not support the processors in this system. |
| 474 | */ |
| 475 | #define HV_STATUS_UNSUPPORTED_PROCESSOR ((u16)0x1029) |
| 476 | |
| 477 | /* |
| 478 | * HV_STATUS_INSUFFICIENT_CROM_SPACE |
| 479 | * Insufficient space existed for copying over the CROM contents. |
| 480 | */ |
| 481 | #define HV_STATUS_INSUFFICIENT_CROM_SPACE ((u16)0x2000) |
| 482 | |
| 483 | /* |
| 484 | * HV_STATUS_BAD_CROM_FORMAT |
| 485 | * The contents of the CROM failed validation attempts. |
| 486 | */ |
| 487 | #define HV_STATUS_BAD_CROM_FORMAT ((u16)0x2001) |
| 488 | |
| 489 | /* |
| 490 | * HV_STATUS_UNSUPPORTED_CROM_FORMAT |
| 491 | * The contents of the CROM contain contents the parser doesn't support. |
| 492 | */ |
| 493 | #define HV_STATUS_UNSUPPORTED_CROM_FORMAT ((u16)0x2002) |
| 494 | |
| 495 | /* |
| 496 | * HV_STATUS_UNSUPPORTED_CONTROLLER |
| 497 | * The register format of the OHCI controller specified for debugging is not |
| 498 | * supported. |
| 499 | */ |
| 500 | #define HV_STATUS_UNSUPPORTED_CONTROLLER ((u16)0x2003) |
| 501 | |
| 502 | /* |
| 503 | * HV_STATUS_CROM_TOO_LARGE |
| 504 | * The CROM contents were to large to copy over. |
| 505 | */ |
| 506 | #define HV_STATUS_CROM_TOO_LARGE ((u16)0x2004) |
| 507 | |
| 508 | /* |
| 509 | * HV_STATUS_CONTROLLER_IN_USE |
| 510 | * The OHCI controller specified for debugging cannot be used as it is already |
| 511 | * in use. |
| 512 | */ |
| 513 | #define HV_STATUS_CONTROLLER_IN_USE ((u16)0x2005) |
| 514 | |
| 515 | |
Greg Kroah-Hartman | 6658be6 | 2009-08-20 12:13:27 -0700 | [diff] [blame] | 516 | /* |
| 517 | * The below CPUID leaves are present if VersionAndFeatures.HypervisorPresent |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 518 | * is set by CPUID(HVCPUID_VERSION_FEATURES). |
Greg Kroah-Hartman | 6658be6 | 2009-08-20 12:13:27 -0700 | [diff] [blame] | 519 | */ |
| 520 | enum hv_cpuid_function { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 521 | HVCPUID_VERSION_FEATURES = 0x00000001, |
| 522 | HVCPUID_VENDOR_MAXFUNCTION = 0x40000000, |
| 523 | HVCPUID_INTERFACE = 0x40000001, |
Greg Kroah-Hartman | 6658be6 | 2009-08-20 12:13:27 -0700 | [diff] [blame] | 524 | |
| 525 | /* |
| 526 | * The remaining functions depend on the value of |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 527 | * HVCPUID_INTERFACE |
Greg Kroah-Hartman | 6658be6 | 2009-08-20 12:13:27 -0700 | [diff] [blame] | 528 | */ |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 529 | HVCPUID_VERSION = 0x40000002, |
| 530 | HVCPUID_FEATURES = 0x40000003, |
| 531 | HVCPUID_ENLIGHTENMENT_INFO = 0x40000004, |
| 532 | HVCPUID_IMPLEMENTATION_LIMITS = 0x40000005, |
Greg Kroah-Hartman | 6658be6 | 2009-08-20 12:13:27 -0700 | [diff] [blame] | 533 | }; |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 534 | |
| 535 | /* Define the virtual APIC registers */ |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 536 | #define HV_X64_MSR_EOI (0x40000070) |
| 537 | #define HV_X64_MSR_ICR (0x40000071) |
| 538 | #define HV_X64_MSR_TPR (0x40000072) |
| 539 | #define HV_X64_MSR_APIC_ASSIST_PAGE (0x40000073) |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 540 | |
| 541 | /* Define version of the synthetic interrupt controller. */ |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 542 | #define HV_SYNIC_VERSION (1) |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 543 | |
| 544 | /* Define synthetic interrupt controller model specific registers. */ |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 545 | #define HV_X64_MSR_SCONTROL (0x40000080) |
| 546 | #define HV_X64_MSR_SVERSION (0x40000081) |
| 547 | #define HV_X64_MSR_SIEFP (0x40000082) |
| 548 | #define HV_X64_MSR_SIMP (0x40000083) |
| 549 | #define HV_X64_MSR_EOM (0x40000084) |
| 550 | #define HV_X64_MSR_SINT0 (0x40000090) |
| 551 | #define HV_X64_MSR_SINT1 (0x40000091) |
| 552 | #define HV_X64_MSR_SINT2 (0x40000092) |
| 553 | #define HV_X64_MSR_SINT3 (0x40000093) |
| 554 | #define HV_X64_MSR_SINT4 (0x40000094) |
| 555 | #define HV_X64_MSR_SINT5 (0x40000095) |
| 556 | #define HV_X64_MSR_SINT6 (0x40000096) |
| 557 | #define HV_X64_MSR_SINT7 (0x40000097) |
| 558 | #define HV_X64_MSR_SINT8 (0x40000098) |
| 559 | #define HV_X64_MSR_SINT9 (0x40000099) |
| 560 | #define HV_X64_MSR_SINT10 (0x4000009A) |
| 561 | #define HV_X64_MSR_SINT11 (0x4000009B) |
| 562 | #define HV_X64_MSR_SINT12 (0x4000009C) |
| 563 | #define HV_X64_MSR_SINT13 (0x4000009D) |
| 564 | #define HV_X64_MSR_SINT14 (0x4000009E) |
| 565 | #define HV_X64_MSR_SINT15 (0x4000009F) |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 566 | |
| 567 | /* Define the expected SynIC version. */ |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 568 | #define HV_SYNIC_VERSION_1 (0x1) |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 569 | |
| 570 | /* Define synthetic interrupt controller message constants. */ |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 571 | #define HV_MESSAGE_SIZE (256) |
| 572 | #define HV_MESSAGE_PAYLOAD_BYTE_COUNT (240) |
| 573 | #define HV_MESSAGE_PAYLOAD_QWORD_COUNT (30) |
| 574 | #define HV_ANY_VP (0xFFFFFFFF) |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 575 | |
| 576 | /* Define synthetic interrupt controller flag constants. */ |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 577 | #define HV_EVENT_FLAGS_COUNT (256 * 8) |
| 578 | #define HV_EVENT_FLAGS_BYTE_COUNT (256) |
| 579 | #define HV_EVENT_FLAGS_DWORD_COUNT (256 / sizeof(u32)) |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 580 | |
| 581 | /* Define hypervisor message types. */ |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 582 | enum hv_message_type { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 583 | HVMSG_NONE = 0x00000000, |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 584 | |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 585 | /* Memory access messages. */ |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 586 | HVMSG_UNMAPPED_GPA = 0x80000000, |
| 587 | HVMSG_GPA_INTERCEPT = 0x80000001, |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 588 | |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 589 | /* Timer notification messages. */ |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 590 | HVMSG_TIMER_EXPIRED = 0x80000010, |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 591 | |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 592 | /* Error messages. */ |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 593 | HVMSG_INVALID_VP_REGISTER_VALUE = 0x80000020, |
| 594 | HVMSG_UNRECOVERABLE_EXCEPTION = 0x80000021, |
| 595 | HVMSG_UNSUPPORTED_FEATURE = 0x80000022, |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 596 | |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 597 | /* Trace buffer complete messages. */ |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 598 | HVMSG_EVENTLOG_BUFFERCOMPLETE = 0x80000040, |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 599 | |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 600 | /* Platform-specific processor intercept messages. */ |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 601 | HVMSG_X64_IOPORT_INTERCEPT = 0x80010000, |
| 602 | HVMSG_X64_MSR_INTERCEPT = 0x80010001, |
| 603 | HVMSG_X64_CPUID_INTERCEPT = 0x80010002, |
| 604 | HVMSG_X64_EXCEPTION_INTERCEPT = 0x80010003, |
| 605 | HVMSG_X64_APIC_EOI = 0x80010004, |
| 606 | HVMSG_X64_LEGACY_FP_ERROR = 0x80010005 |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 607 | }; |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 608 | |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 609 | /* Define the number of synthetic interrupt sources. */ |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 610 | #define HV_SYNIC_SINT_COUNT (16) |
| 611 | #define HV_SYNIC_STIMER_COUNT (4) |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 612 | |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 613 | /* Define invalid partition identifier. */ |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 614 | #define HV_PARTITION_ID_INVALID ((u64)0x0) |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 615 | |
| 616 | /* Define connection identifier type. */ |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 617 | union hv_connection_id { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 618 | u32 asu32; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 619 | struct { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 620 | u32 id:24; |
| 621 | u32 reserved:8; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 622 | } u; |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 623 | }; |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 624 | |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 625 | /* Define port identifier type. */ |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 626 | union hv_port_id { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 627 | u32 asu32; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 628 | struct { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 629 | u32 id:24; |
| 630 | u32 reserved:8; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 631 | } u ; |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 632 | }; |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 633 | |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 634 | /* Define port type. */ |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 635 | enum hv_port_type { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 636 | HVPORT_MSG = 1, |
| 637 | HVPORT_EVENT = 2, |
| 638 | HVPORT_MONITOR = 3 |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 639 | }; |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 640 | |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 641 | /* Define port information structure. */ |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 642 | struct hv_port_info { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 643 | enum hv_port_type port_type; |
| 644 | u32 padding; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 645 | union { |
| 646 | struct { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 647 | u32 target_sint; |
| 648 | u32 target_vp; |
| 649 | u64 rsvdz; |
| 650 | } message_port_info; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 651 | struct { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 652 | u32 target_sint; |
| 653 | u32 target_vp; |
| 654 | u16 base_flag_bumber; |
| 655 | u16 flag_count; |
| 656 | u32 rsvdz; |
| 657 | } event_port_info; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 658 | struct { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 659 | u64 monitor_address; |
| 660 | u64 rsvdz; |
| 661 | } monitor_port_info; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 662 | }; |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 663 | }; |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 664 | |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 665 | struct hv_connection_info { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 666 | enum hv_port_type port_type; |
| 667 | u32 padding; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 668 | union { |
| 669 | struct { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 670 | u64 rsvdz; |
| 671 | } message_connection_info; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 672 | struct { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 673 | u64 rsvdz; |
| 674 | } event_connection_info; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 675 | struct { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 676 | u64 monitor_address; |
| 677 | } monitor_connection_info; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 678 | }; |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 679 | }; |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 680 | |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 681 | /* Define synthetic interrupt controller message flags. */ |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 682 | union hv_message_flags { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 683 | u8 asu8; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 684 | struct { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 685 | u8 msg_pending:1; |
| 686 | u8 reserved:7; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 687 | }; |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 688 | }; |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 689 | |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 690 | /* Define synthetic interrupt controller message header. */ |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 691 | struct hv_message_header { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 692 | enum hv_message_type message_type; |
| 693 | u8 payload_size; |
| 694 | union hv_message_flags message_flags; |
| 695 | u8 reserved[2]; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 696 | union { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 697 | u64 sender; |
| 698 | union hv_port_id port; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 699 | }; |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 700 | }; |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 701 | |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 702 | /* Define timer message payload structure. */ |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 703 | struct hv_timer_message_payload { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 704 | u32 timer_index; |
| 705 | u32 reserved; |
| 706 | u64 expiration_time; /* When the timer expired */ |
| 707 | u64 delivery_time; /* When the message was delivered */ |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 708 | }; |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 709 | |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 710 | /* Define synthetic interrupt controller message format. */ |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 711 | struct hv_message { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 712 | struct hv_message_header header; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 713 | union { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 714 | u64 payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT]; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 715 | } u ; |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 716 | }; |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 717 | |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 718 | /* Define the number of message buffers associated with each port. */ |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 719 | #define HV_PORT_MESSAGE_BUFFER_COUNT (16) |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 720 | |
| 721 | /* Define the synthetic interrupt message page layout. */ |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 722 | struct hv_message_page { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 723 | struct hv_message sint_message[HV_SYNIC_SINT_COUNT]; |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 724 | }; |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 725 | |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 726 | /* Define the synthetic interrupt controller event flags format. */ |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 727 | union hv_synic_event_flags { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 728 | u8 flags8[HV_EVENT_FLAGS_BYTE_COUNT]; |
| 729 | u32 flags32[HV_EVENT_FLAGS_DWORD_COUNT]; |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 730 | }; |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 731 | |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 732 | /* Define the synthetic interrupt flags page layout. */ |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 733 | struct hv_synic_event_flags_page { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 734 | union hv_synic_event_flags sintevent_flags[HV_SYNIC_SINT_COUNT]; |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 735 | }; |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 736 | |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 737 | /* Define SynIC control register. */ |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 738 | union hv_synic_scontrol { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 739 | u64 as_uint64; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 740 | struct { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 741 | u64 enable:1; |
| 742 | u64 reserved:63; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 743 | }; |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 744 | }; |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 745 | |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 746 | /* Define synthetic interrupt source. */ |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 747 | union hv_synic_sint { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 748 | u64 as_uint64; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 749 | struct { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 750 | u64 vector:8; |
| 751 | u64 reserved1:8; |
| 752 | u64 masked:1; |
| 753 | u64 auto_eoi:1; |
| 754 | u64 reserved2:46; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 755 | }; |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 756 | }; |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 757 | |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 758 | /* Define the format of the SIMP register */ |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 759 | union hv_synic_simp { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 760 | u64 as_uint64; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 761 | struct { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 762 | u64 simp_enabled:1; |
| 763 | u64 preserved:11; |
| 764 | u64 base_simp_gpa:52; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 765 | }; |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 766 | }; |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 767 | |
| 768 | /* Define the format of the SIEFP register */ |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 769 | union hv_synic_siefp { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 770 | u64 as_uint64; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 771 | struct { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 772 | u64 siefp_enabled:1; |
| 773 | u64 preserved:11; |
| 774 | u64 base_siefp_gpa:52; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 775 | }; |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 776 | }; |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 777 | |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 778 | /* Definitions for the monitored notification facility */ |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 779 | union hv_monitor_trigger_group { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 780 | u64 as_uint64; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 781 | struct { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 782 | u32 pending; |
| 783 | u32 armed; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 784 | }; |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 785 | }; |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 786 | |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 787 | struct hv_monitor_parameter { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 788 | union hv_connection_id connectionid; |
| 789 | u16 flagnumber; |
| 790 | u16 rsvdz; |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 791 | }; |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 792 | |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 793 | union hv_monitor_trigger_state { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 794 | u32 asu32; |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 795 | |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 796 | struct { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 797 | u32 group_enable:4; |
| 798 | u32 rsvdz:28; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 799 | }; |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 800 | }; |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 801 | |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 802 | /* struct hv_monitor_page Layout */ |
Bill Pemberton | 454f18a | 2009-07-27 16:47:24 -0400 | [diff] [blame] | 803 | /* ------------------------------------------------------ */ |
| 804 | /* | 0 | TriggerState (4 bytes) | Rsvd1 (4 bytes) | */ |
| 805 | /* | 8 | TriggerGroup[0] | */ |
| 806 | /* | 10 | TriggerGroup[1] | */ |
| 807 | /* | 18 | TriggerGroup[2] | */ |
| 808 | /* | 20 | TriggerGroup[3] | */ |
| 809 | /* | 28 | Rsvd2[0] | */ |
| 810 | /* | 30 | Rsvd2[1] | */ |
| 811 | /* | 38 | Rsvd2[2] | */ |
| 812 | /* | 40 | NextCheckTime[0][0] | NextCheckTime[0][1] | */ |
| 813 | /* | ... | */ |
| 814 | /* | 240 | Latency[0][0..3] | */ |
| 815 | /* | 340 | Rsvz3[0] | */ |
| 816 | /* | 440 | Parameter[0][0] | */ |
| 817 | /* | 448 | Parameter[0][1] | */ |
| 818 | /* | ... | */ |
| 819 | /* | 840 | Rsvd4[0] | */ |
| 820 | /* ------------------------------------------------------ */ |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 821 | struct hv_monitor_page { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 822 | union hv_monitor_trigger_state trigger_state; |
| 823 | u32 rsvdz1; |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 824 | |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 825 | union hv_monitor_trigger_group trigger_group[4]; |
| 826 | u64 rsvdz2[3]; |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 827 | |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 828 | s32 next_checktime[4][32]; |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 829 | |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 830 | u16 latency[4][32]; |
| 831 | u64 rsvdz3[32]; |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 832 | |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 833 | struct hv_monitor_parameter parameter[4][32]; |
Hank Janssen | 565e7dc | 2009-07-13 15:15:47 -0700 | [diff] [blame] | 834 | |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 835 | u8 rsvdz4[1984]; |
Greg Kroah-Hartman | eacb1b4 | 2009-08-20 12:11:26 -0700 | [diff] [blame] | 836 | }; |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 837 | |
Greg Kroah-Hartman | 6658be6 | 2009-08-20 12:13:27 -0700 | [diff] [blame] | 838 | /* Declare the various hypercall operations. */ |
| 839 | enum hv_call_code { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 840 | HVCALL_POST_MESSAGE = 0x005c, |
| 841 | HVCALL_SIGNAL_EVENT = 0x005d, |
Greg Kroah-Hartman | 6658be6 | 2009-08-20 12:13:27 -0700 | [diff] [blame] | 842 | }; |
| 843 | |
Haiyang Zhang | d44890c | 2010-11-08 14:04:42 -0800 | [diff] [blame] | 844 | /* Definition of the hv_post_message hypercall input structure. */ |
Greg Kroah-Hartman | 6658be6 | 2009-08-20 12:13:27 -0700 | [diff] [blame] | 845 | struct hv_input_post_message { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 846 | union hv_connection_id connectionid; |
| 847 | u32 reserved; |
| 848 | enum hv_message_type message_type; |
| 849 | u32 payload_size; |
| 850 | u64 payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT]; |
Greg Kroah-Hartman | 6658be6 | 2009-08-20 12:13:27 -0700 | [diff] [blame] | 851 | }; |
| 852 | |
Haiyang Zhang | d44890c | 2010-11-08 14:04:42 -0800 | [diff] [blame] | 853 | /* Definition of the hv_signal_event hypercall input structure. */ |
Greg Kroah-Hartman | 6658be6 | 2009-08-20 12:13:27 -0700 | [diff] [blame] | 854 | struct hv_input_signal_event { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 855 | union hv_connection_id connectionid; |
| 856 | u16 flag_number; |
| 857 | u16 rsvdz; |
Greg Kroah-Hartman | 6658be6 | 2009-08-20 12:13:27 -0700 | [diff] [blame] | 858 | }; |
| 859 | |
| 860 | /* |
| 861 | * Versioning definitions used for guests reporting themselves to the |
| 862 | * hypervisor, and visa versa. |
| 863 | */ |
| 864 | |
| 865 | /* Version info reported by guest OS's */ |
| 866 | enum hv_guest_os_vendor { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 867 | HVGUESTOS_VENDOR_MICROSOFT = 0x0001 |
Greg Kroah-Hartman | 6658be6 | 2009-08-20 12:13:27 -0700 | [diff] [blame] | 868 | }; |
| 869 | |
| 870 | enum hv_guest_os_microsoft_ids { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 871 | HVGUESTOS_MICROSOFT_UNDEFINED = 0x00, |
| 872 | HVGUESTOS_MICROSOFT_MSDOS = 0x01, |
| 873 | HVGUESTOS_MICROSOFT_WINDOWS3X = 0x02, |
| 874 | HVGUESTOS_MICROSOFT_WINDOWS9X = 0x03, |
| 875 | HVGUESTOS_MICROSOFT_WINDOWSNT = 0x04, |
| 876 | HVGUESTOS_MICROSOFT_WINDOWSCE = 0x05 |
Greg Kroah-Hartman | 6658be6 | 2009-08-20 12:13:27 -0700 | [diff] [blame] | 877 | }; |
| 878 | |
| 879 | /* |
| 880 | * Declare the MSR used to identify the guest OS. |
| 881 | */ |
| 882 | #define HV_X64_MSR_GUEST_OS_ID 0x40000000 |
| 883 | |
| 884 | union hv_x64_msr_guest_os_id_contents { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 885 | u64 as_uint64; |
Greg Kroah-Hartman | 6658be6 | 2009-08-20 12:13:27 -0700 | [diff] [blame] | 886 | struct { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 887 | u64 build_number:16; |
| 888 | u64 service_version:8; /* Service Pack, etc. */ |
| 889 | u64 minor_version:8; |
| 890 | u64 major_version:8; |
| 891 | u64 os_id:8; /* enum hv_guest_os_microsoft_ids (if Vendor=MS) */ |
| 892 | u64 vendor_id:16; /* enum hv_guest_os_vendor */ |
Greg Kroah-Hartman | 6658be6 | 2009-08-20 12:13:27 -0700 | [diff] [blame] | 893 | }; |
| 894 | }; |
| 895 | |
| 896 | /* |
| 897 | * Declare the MSR used to setup pages used to communicate with the hypervisor. |
| 898 | */ |
| 899 | #define HV_X64_MSR_HYPERCALL 0x40000001 |
| 900 | |
| 901 | union hv_x64_msr_hypercall_contents { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 902 | u64 as_uint64; |
Greg Kroah-Hartman | 6658be6 | 2009-08-20 12:13:27 -0700 | [diff] [blame] | 903 | struct { |
Haiyang Zhang | f6feebe | 2010-11-08 14:04:39 -0800 | [diff] [blame] | 904 | u64 enable:1; |
| 905 | u64 reserved:11; |
| 906 | u64 guest_physical_address:52; |
Greg Kroah-Hartman | 6658be6 | 2009-08-20 12:13:27 -0700 | [diff] [blame] | 907 | }; |
| 908 | }; |
| 909 | |
Greg Kroah-Hartman | c786a84 | 2009-08-20 12:10:52 -0700 | [diff] [blame] | 910 | #endif |