1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Type definitions for the Microsoft hypervisor. 4 */ 5 #ifndef _HV_HVHDK_H 6 #define _HV_HVHDK_H 7 8 #include <linux/build_bug.h> 9 10 #include "hvhdk_mini.h" 11 #include "hvgdk.h" 12 13 /* Bits for dirty mask of hv_vp_register_page */ 14 #define HV_X64_REGISTER_CLASS_GENERAL 0 15 #define HV_X64_REGISTER_CLASS_IP 1 16 #define HV_X64_REGISTER_CLASS_XMM 2 17 #define HV_X64_REGISTER_CLASS_SEGMENT 3 18 #define HV_X64_REGISTER_CLASS_FLAGS 4 19 20 #define HV_VP_REGISTER_PAGE_VERSION_1 1u 21 22 struct hv_vp_register_page { 23 u16 version; 24 u8 isvalid; 25 u8 rsvdz; 26 u32 dirty; 27 union { 28 struct { 29 /* General purpose registers 30 * (HV_X64_REGISTER_CLASS_GENERAL) 31 */ 32 union { 33 struct { 34 u64 rax; 35 u64 rcx; 36 u64 rdx; 37 u64 rbx; 38 u64 rsp; 39 u64 rbp; 40 u64 rsi; 41 u64 rdi; 42 u64 r8; 43 u64 r9; 44 u64 r10; 45 u64 r11; 46 u64 r12; 47 u64 r13; 48 u64 r14; 49 u64 r15; 50 } __packed; 51 52 u64 gp_registers[16]; 53 }; 54 /* Instruction pointer (HV_X64_REGISTER_CLASS_IP) */ 55 u64 rip; 56 /* Flags (HV_X64_REGISTER_CLASS_FLAGS) */ 57 u64 rflags; 58 } __packed; 59 60 u64 registers[18]; 61 }; 62 /* Volatile XMM registers (HV_X64_REGISTER_CLASS_XMM) */ 63 union { 64 struct { 65 struct hv_u128 xmm0; 66 struct hv_u128 xmm1; 67 struct hv_u128 xmm2; 68 struct hv_u128 xmm3; 69 struct hv_u128 xmm4; 70 struct hv_u128 xmm5; 71 } __packed; 72 73 struct hv_u128 xmm_registers[6]; 74 }; 75 /* Segment registers (HV_X64_REGISTER_CLASS_SEGMENT) */ 76 union { 77 struct { 78 struct hv_x64_segment_register es; 79 struct hv_x64_segment_register cs; 80 struct hv_x64_segment_register ss; 81 struct hv_x64_segment_register ds; 82 struct hv_x64_segment_register fs; 83 struct hv_x64_segment_register gs; 84 } __packed; 85 86 struct hv_x64_segment_register segment_registers[6]; 87 }; 88 /* Misc. control registers (cannot be set via this interface) */ 89 u64 cr0; 90 u64 cr3; 91 u64 cr4; 92 u64 cr8; 93 u64 efer; 94 u64 dr7; 95 union hv_x64_pending_interruption_register pending_interruption; 96 union hv_x64_interrupt_state_register interrupt_state; 97 u64 instruction_emulation_hints; 98 } __packed; 99 100 #define HV_PARTITION_PROCESSOR_FEATURES_BANKS 2 101 102 union hv_partition_processor_features { 103 u64 as_uint64[HV_PARTITION_PROCESSOR_FEATURES_BANKS]; 104 struct { 105 u64 sse3_support : 1; 106 u64 lahf_sahf_support : 1; 107 u64 ssse3_support : 1; 108 u64 sse4_1_support : 1; 109 u64 sse4_2_support : 1; 110 u64 sse4a_support : 1; 111 u64 xop_support : 1; 112 u64 pop_cnt_support : 1; 113 u64 cmpxchg16b_support : 1; 114 u64 altmovcr8_support : 1; 115 u64 lzcnt_support : 1; 116 u64 mis_align_sse_support : 1; 117 u64 mmx_ext_support : 1; 118 u64 amd3dnow_support : 1; 119 u64 extended_amd3dnow_support : 1; 120 u64 page_1gb_support : 1; 121 u64 aes_support : 1; 122 u64 pclmulqdq_support : 1; 123 u64 pcid_support : 1; 124 u64 fma4_support : 1; 125 u64 f16c_support : 1; 126 u64 rd_rand_support : 1; 127 u64 rd_wr_fs_gs_support : 1; 128 u64 smep_support : 1; 129 u64 enhanced_fast_string_support : 1; 130 u64 bmi1_support : 1; 131 u64 bmi2_support : 1; 132 u64 hle_support_deprecated : 1; 133 u64 rtm_support_deprecated : 1; 134 u64 movbe_support : 1; 135 u64 npiep1_support : 1; 136 u64 dep_x87_fpu_save_support : 1; 137 u64 rd_seed_support : 1; 138 u64 adx_support : 1; 139 u64 intel_prefetch_support : 1; 140 u64 smap_support : 1; 141 u64 hle_support : 1; 142 u64 rtm_support : 1; 143 u64 rdtscp_support : 1; 144 u64 clflushopt_support : 1; 145 u64 clwb_support : 1; 146 u64 sha_support : 1; 147 u64 x87_pointers_saved_support : 1; 148 u64 invpcid_support : 1; 149 u64 ibrs_support : 1; 150 u64 stibp_support : 1; 151 u64 ibpb_support: 1; 152 u64 unrestricted_guest_support : 1; 153 u64 mdd_support : 1; 154 u64 fast_short_rep_mov_support : 1; 155 u64 l1dcache_flush_support : 1; 156 u64 rdcl_no_support : 1; 157 u64 ibrs_all_support : 1; 158 u64 skip_l1df_support : 1; 159 u64 ssb_no_support : 1; 160 u64 rsb_a_no_support : 1; 161 u64 virt_spec_ctrl_support : 1; 162 u64 rd_pid_support : 1; 163 u64 umip_support : 1; 164 u64 mbs_no_support : 1; 165 u64 mb_clear_support : 1; 166 u64 taa_no_support : 1; 167 u64 tsx_ctrl_support : 1; 168 /* 169 * N.B. The final processor feature bit in bank 0 is reserved to 170 * simplify potential downlevel backports. 171 */ 172 u64 reserved_bank0 : 1; 173 174 /* N.B. Begin bank 1 processor features. */ 175 u64 acount_mcount_support : 1; 176 u64 tsc_invariant_support : 1; 177 u64 cl_zero_support : 1; 178 u64 rdpru_support : 1; 179 u64 la57_support : 1; 180 u64 mbec_support : 1; 181 u64 nested_virt_support : 1; 182 u64 psfd_support : 1; 183 u64 cet_ss_support : 1; 184 u64 cet_ibt_support : 1; 185 u64 vmx_exception_inject_support : 1; 186 u64 enqcmd_support : 1; 187 u64 umwait_tpause_support : 1; 188 u64 movdiri_support : 1; 189 u64 movdir64b_support : 1; 190 u64 cldemote_support : 1; 191 u64 serialize_support : 1; 192 u64 tsc_deadline_tmr_support : 1; 193 u64 tsc_adjust_support : 1; 194 u64 fzlrep_movsb : 1; 195 u64 fsrep_stosb : 1; 196 u64 fsrep_cmpsb : 1; 197 u64 reserved_bank1 : 42; 198 } __packed; 199 }; 200 201 union hv_partition_processor_xsave_features { 202 struct { 203 u64 xsave_support : 1; 204 u64 xsaveopt_support : 1; 205 u64 avx_support : 1; 206 u64 reserved1 : 61; 207 } __packed; 208 u64 as_uint64; 209 }; 210 211 struct hv_partition_creation_properties { 212 union hv_partition_processor_features disabled_processor_features; 213 union hv_partition_processor_xsave_features 214 disabled_processor_xsave_features; 215 } __packed; 216 217 #define HV_PARTITION_SYNTHETIC_PROCESSOR_FEATURES_BANKS 1 218 219 union hv_partition_synthetic_processor_features { 220 u64 as_uint64[HV_PARTITION_SYNTHETIC_PROCESSOR_FEATURES_BANKS]; 221 222 struct { 223 u64 hypervisor_present : 1; 224 /* Support for HV#1: (CPUID leaves 0x40000000 - 0x40000006)*/ 225 u64 hv1 : 1; 226 u64 access_vp_run_time_reg : 1; /* HV_X64_MSR_VP_RUNTIME */ 227 u64 access_partition_reference_counter : 1; /* HV_X64_MSR_TIME_REF_COUNT */ 228 u64 access_synic_regs : 1; /* SINT-related registers */ 229 /* 230 * Access to HV_X64_MSR_STIMER0_CONFIG through 231 * HV_X64_MSR_STIMER3_COUNT. 232 */ 233 u64 access_synthetic_timer_regs : 1; 234 u64 access_intr_ctrl_regs : 1; /* APIC MSRs and VP assist page*/ 235 /* HV_X64_MSR_GUEST_OS_ID and HV_X64_MSR_HYPERCALL */ 236 u64 access_hypercall_regs : 1; 237 u64 access_vp_index : 1; 238 u64 access_partition_reference_tsc : 1; 239 u64 access_guest_idle_reg : 1; 240 u64 access_frequency_regs : 1; 241 u64 reserved_z12 : 1; 242 u64 reserved_z13 : 1; 243 u64 reserved_z14 : 1; 244 u64 enable_extended_gva_ranges_for_flush_virtual_address_list : 1; 245 u64 reserved_z16 : 1; 246 u64 reserved_z17 : 1; 247 /* Use fast hypercall output. Corresponds to privilege. */ 248 u64 fast_hypercall_output : 1; 249 u64 reserved_z19 : 1; 250 u64 start_virtual_processor : 1; /* Can start VPs */ 251 u64 reserved_z21 : 1; 252 /* Synthetic timers in direct mode. */ 253 u64 direct_synthetic_timers : 1; 254 u64 reserved_z23 : 1; 255 u64 extended_processor_masks : 1; 256 257 /* Enable various hypercalls */ 258 u64 tb_flush_hypercalls : 1; 259 u64 synthetic_cluster_ipi : 1; 260 u64 notify_long_spin_wait : 1; 261 u64 query_numa_distance : 1; 262 u64 signal_events : 1; 263 u64 retarget_device_interrupt : 1; 264 u64 restore_time : 1; 265 266 /* EnlightenedVmcs nested enlightenment is supported. */ 267 u64 enlightened_vmcs : 1; 268 u64 reserved : 31; 269 } __packed; 270 }; 271 272 #define HV_MAKE_COMPATIBILITY_VERSION(major_, minor_) \ 273 ((u32)((major_) << 8 | (minor_))) 274 275 #define HV_COMPATIBILITY_21_H2 HV_MAKE_COMPATIBILITY_VERSION(0X6, 0X9) 276 277 union hv_partition_isolation_properties { 278 u64 as_uint64; 279 struct { 280 u64 isolation_type: 5; 281 u64 isolation_host_type : 2; 282 u64 rsvd_z: 5; 283 u64 shared_gpa_boundary_page_number: 52; 284 } __packed; 285 }; 286 287 /* 288 * Various isolation types supported by MSHV. 289 */ 290 #define HV_PARTITION_ISOLATION_TYPE_NONE 0 291 #define HV_PARTITION_ISOLATION_TYPE_SNP 2 292 #define HV_PARTITION_ISOLATION_TYPE_TDX 3 293 294 /* 295 * Various host isolation types supported by MSHV. 296 */ 297 #define HV_PARTITION_ISOLATION_HOST_TYPE_NONE 0x0 298 #define HV_PARTITION_ISOLATION_HOST_TYPE_HARDWARE 0x1 299 #define HV_PARTITION_ISOLATION_HOST_TYPE_RESERVED 0x2 300 301 /* Note: Exo partition is enabled by default */ 302 #define HV_PARTITION_CREATION_FLAG_EXO_PARTITION BIT(8) 303 #define HV_PARTITION_CREATION_FLAG_LAPIC_ENABLED BIT(13) 304 #define HV_PARTITION_CREATION_FLAG_INTERCEPT_MESSAGE_PAGE_ENABLED BIT(19) 305 #define HV_PARTITION_CREATION_FLAG_X2APIC_CAPABLE BIT(22) 306 307 struct hv_input_create_partition { 308 u64 flags; 309 struct hv_proximity_domain_info proximity_domain_info; 310 u32 compatibility_version; 311 u32 padding; 312 struct hv_partition_creation_properties partition_creation_properties; 313 union hv_partition_isolation_properties isolation_properties; 314 } __packed; 315 316 struct hv_output_create_partition { 317 u64 partition_id; 318 } __packed; 319 320 struct hv_input_initialize_partition { 321 u64 partition_id; 322 } __packed; 323 324 struct hv_input_finalize_partition { 325 u64 partition_id; 326 } __packed; 327 328 struct hv_input_delete_partition { 329 u64 partition_id; 330 } __packed; 331 332 struct hv_input_get_partition_property { 333 u64 partition_id; 334 u32 property_code; /* enum hv_partition_property_code */ 335 u32 padding; 336 } __packed; 337 338 struct hv_output_get_partition_property { 339 u64 property_value; 340 } __packed; 341 342 struct hv_input_set_partition_property { 343 u64 partition_id; 344 u32 property_code; /* enum hv_partition_property_code */ 345 u32 padding; 346 u64 property_value; 347 } __packed; 348 349 enum hv_vp_state_page_type { 350 HV_VP_STATE_PAGE_REGISTERS = 0, 351 HV_VP_STATE_PAGE_INTERCEPT_MESSAGE = 1, 352 HV_VP_STATE_PAGE_COUNT 353 }; 354 355 struct hv_input_map_vp_state_page { 356 u64 partition_id; 357 u32 vp_index; 358 u32 type; /* enum hv_vp_state_page_type */ 359 } __packed; 360 361 struct hv_output_map_vp_state_page { 362 u64 map_location; /* GPA page number */ 363 } __packed; 364 365 struct hv_input_unmap_vp_state_page { 366 u64 partition_id; 367 u32 vp_index; 368 u32 type; /* enum hv_vp_state_page_type */ 369 } __packed; 370 371 struct hv_opaque_intercept_message { 372 u32 vp_index; 373 } __packed; 374 375 enum hv_port_type { 376 HV_PORT_TYPE_MESSAGE = 1, 377 HV_PORT_TYPE_EVENT = 2, 378 HV_PORT_TYPE_MONITOR = 3, 379 HV_PORT_TYPE_DOORBELL = 4 /* Root Partition only */ 380 }; 381 382 struct hv_port_info { 383 u32 port_type; /* enum hv_port_type */ 384 u32 padding; 385 union { 386 struct { 387 u32 target_sint; 388 u32 target_vp; 389 u64 rsvdz; 390 } message_port_info; 391 struct { 392 u32 target_sint; 393 u32 target_vp; 394 u16 base_flag_number; 395 u16 flag_count; 396 u32 rsvdz; 397 } event_port_info; 398 struct { 399 u64 monitor_address; 400 u64 rsvdz; 401 } monitor_port_info; 402 struct { 403 u32 target_sint; 404 u32 target_vp; 405 u64 rsvdz; 406 } doorbell_port_info; 407 }; 408 } __packed; 409 410 struct hv_connection_info { 411 u32 port_type; 412 u32 padding; 413 union { 414 struct { 415 u64 rsvdz; 416 } message_connection_info; 417 struct { 418 u64 rsvdz; 419 } event_connection_info; 420 struct { 421 u64 monitor_address; 422 } monitor_connection_info; 423 struct { 424 u64 gpa; 425 u64 trigger_value; 426 u64 flags; 427 } doorbell_connection_info; 428 }; 429 } __packed; 430 431 /* Define synthetic interrupt controller flag constants. */ 432 #define HV_EVENT_FLAGS_COUNT (256 * 8) 433 #define HV_EVENT_FLAGS_BYTE_COUNT (256) 434 #define HV_EVENT_FLAGS32_COUNT (256 / sizeof(u32)) 435 436 /* linux side we create long version of flags to use long bit ops on flags */ 437 #define HV_EVENT_FLAGS_UL_COUNT (256 / sizeof(ulong)) 438 439 /* Define the synthetic interrupt controller event flags format. */ 440 union hv_synic_event_flags { 441 unsigned char flags8[HV_EVENT_FLAGS_BYTE_COUNT]; 442 u32 flags32[HV_EVENT_FLAGS32_COUNT]; 443 ulong flags[HV_EVENT_FLAGS_UL_COUNT]; /* linux only */ 444 }; 445 446 struct hv_synic_event_flags_page { 447 volatile union hv_synic_event_flags event_flags[HV_SYNIC_SINT_COUNT]; 448 }; 449 450 #define HV_SYNIC_EVENT_RING_MESSAGE_COUNT 63 451 452 struct hv_synic_event_ring { 453 u8 signal_masked; 454 u8 ring_full; 455 u16 reserved_z; 456 u32 data[HV_SYNIC_EVENT_RING_MESSAGE_COUNT]; 457 } __packed; 458 459 struct hv_synic_event_ring_page { 460 struct hv_synic_event_ring sint_event_ring[HV_SYNIC_SINT_COUNT]; 461 }; 462 463 /* Define SynIC control register. */ 464 union hv_synic_scontrol { 465 u64 as_uint64; 466 struct { 467 u64 enable : 1; 468 u64 reserved : 63; 469 } __packed; 470 }; 471 472 /* Define the format of the SIEFP register */ 473 union hv_synic_siefp { 474 u64 as_uint64; 475 struct { 476 u64 siefp_enabled : 1; 477 u64 preserved : 11; 478 u64 base_siefp_gpa : 52; 479 } __packed; 480 }; 481 482 union hv_synic_sirbp { 483 u64 as_uint64; 484 struct { 485 u64 sirbp_enabled : 1; 486 u64 preserved : 11; 487 u64 base_sirbp_gpa : 52; 488 } __packed; 489 }; 490 491 union hv_interrupt_control { 492 u64 as_uint64; 493 struct { 494 u32 interrupt_type; /* enum hv_interrupt_type */ 495 u32 level_triggered : 1; 496 u32 logical_dest_mode : 1; 497 u32 rsvd : 30; 498 } __packed; 499 }; 500 501 struct hv_stimer_state { 502 struct { 503 u32 undelivered_msg_pending : 1; 504 u32 reserved : 31; 505 } __packed flags; 506 u32 resvd; 507 u64 config; 508 u64 count; 509 u64 adjustment; 510 u64 undelivered_exp_time; 511 } __packed; 512 513 struct hv_synthetic_timers_state { 514 struct hv_stimer_state timers[HV_SYNIC_STIMER_COUNT]; 515 u64 reserved[5]; 516 } __packed; 517 518 union hv_input_delete_vp { 519 u64 as_uint64[2]; 520 struct { 521 u64 partition_id; 522 u32 vp_index; 523 u8 reserved[4]; 524 } __packed; 525 } __packed; 526 527 struct hv_input_assert_virtual_interrupt { 528 u64 partition_id; 529 union hv_interrupt_control control; 530 u64 dest_addr; /* cpu's apic id */ 531 u32 vector; 532 u8 target_vtl; 533 u8 rsvd_z0; 534 u16 rsvd_z1; 535 } __packed; 536 537 struct hv_input_create_port { 538 u64 port_partition_id; 539 union hv_port_id port_id; 540 u8 port_vtl; 541 u8 min_connection_vtl; 542 u16 padding; 543 u64 connection_partition_id; 544 struct hv_port_info port_info; 545 struct hv_proximity_domain_info proximity_domain_info; 546 } __packed; 547 548 union hv_input_delete_port { 549 u64 as_uint64[2]; 550 struct { 551 u64 port_partition_id; 552 union hv_port_id port_id; 553 u32 reserved; 554 }; 555 } __packed; 556 557 struct hv_input_connect_port { 558 u64 connection_partition_id; 559 union hv_connection_id connection_id; 560 u8 connection_vtl; 561 u8 rsvdz0; 562 u16 rsvdz1; 563 u64 port_partition_id; 564 union hv_port_id port_id; 565 u32 reserved2; 566 struct hv_connection_info connection_info; 567 struct hv_proximity_domain_info proximity_domain_info; 568 } __packed; 569 570 union hv_input_disconnect_port { 571 u64 as_uint64[2]; 572 struct { 573 u64 connection_partition_id; 574 union hv_connection_id connection_id; 575 u32 is_doorbell: 1; 576 u32 reserved: 31; 577 } __packed; 578 } __packed; 579 580 union hv_input_notify_port_ring_empty { 581 u64 as_uint64; 582 struct { 583 u32 sint_index; 584 u32 reserved; 585 }; 586 } __packed; 587 588 struct hv_vp_state_data_xsave { 589 u64 flags; 590 union hv_x64_xsave_xfem_register states; 591 } __packed; 592 593 /* 594 * For getting and setting VP state, there are two options based on the state type: 595 * 596 * 1.) Data that is accessed by PFNs in the input hypercall page. This is used 597 * for state which may not fit into the hypercall pages. 598 * 2.) Data that is accessed directly in the input\output hypercall pages. 599 * This is used for state that will always fit into the hypercall pages. 600 * 601 * In the future this could be dynamic based on the size if needed. 602 * 603 * Note these hypercalls have an 8-byte aligned variable header size as per the tlfs 604 */ 605 606 #define HV_GET_SET_VP_STATE_TYPE_PFN BIT(31) 607 608 enum hv_get_set_vp_state_type { 609 /* HvGetSetVpStateLocalInterruptControllerState - APIC/GIC state */ 610 HV_GET_SET_VP_STATE_LAPIC_STATE = 0 | HV_GET_SET_VP_STATE_TYPE_PFN, 611 HV_GET_SET_VP_STATE_XSAVE = 1 | HV_GET_SET_VP_STATE_TYPE_PFN, 612 HV_GET_SET_VP_STATE_SIM_PAGE = 2 | HV_GET_SET_VP_STATE_TYPE_PFN, 613 HV_GET_SET_VP_STATE_SIEF_PAGE = 3 | HV_GET_SET_VP_STATE_TYPE_PFN, 614 HV_GET_SET_VP_STATE_SYNTHETIC_TIMERS = 4, 615 }; 616 617 struct hv_vp_state_data { 618 u32 type; 619 u32 rsvd; 620 struct hv_vp_state_data_xsave xsave; 621 } __packed; 622 623 struct hv_input_get_vp_state { 624 u64 partition_id; 625 u32 vp_index; 626 u8 input_vtl; 627 u8 rsvd0; 628 u16 rsvd1; 629 struct hv_vp_state_data state_data; 630 u64 output_data_pfns[]; 631 } __packed; 632 633 union hv_output_get_vp_state { 634 struct hv_synthetic_timers_state synthetic_timers_state; 635 } __packed; 636 637 union hv_input_set_vp_state_data { 638 u64 pfns; 639 u8 bytes; 640 } __packed; 641 642 struct hv_input_set_vp_state { 643 u64 partition_id; 644 u32 vp_index; 645 u8 input_vtl; 646 u8 rsvd0; 647 u16 rsvd1; 648 struct hv_vp_state_data state_data; 649 union hv_input_set_vp_state_data data[]; 650 } __packed; 651 652 /* 653 * Dispatch state for the VP communicated by the hypervisor to the 654 * VP-dispatching thread in the root on return from HVCALL_DISPATCH_VP. 655 */ 656 enum hv_vp_dispatch_state { 657 HV_VP_DISPATCH_STATE_INVALID = 0, 658 HV_VP_DISPATCH_STATE_BLOCKED = 1, 659 HV_VP_DISPATCH_STATE_READY = 2, 660 }; 661 662 /* 663 * Dispatch event that caused the current dispatch state on return from 664 * HVCALL_DISPATCH_VP. 665 */ 666 enum hv_vp_dispatch_event { 667 HV_VP_DISPATCH_EVENT_INVALID = 0x00000000, 668 HV_VP_DISPATCH_EVENT_SUSPEND = 0x00000001, 669 HV_VP_DISPATCH_EVENT_INTERCEPT = 0x00000002, 670 }; 671 672 #define HV_ROOT_SCHEDULER_MAX_VPS_PER_CHILD_PARTITION 1024 673 /* The maximum array size of HV_GENERIC_SET (vp_set) buffer */ 674 #define HV_GENERIC_SET_QWORD_COUNT(max) (((((max) - 1) >> 6) + 1) + 2) 675 676 struct hv_vp_signal_bitset_scheduler_message { 677 u64 partition_id; 678 u32 overflow_count; 679 u16 vp_count; 680 u16 reserved; 681 682 #define BITSET_BUFFER_SIZE \ 683 HV_GENERIC_SET_QWORD_COUNT(HV_ROOT_SCHEDULER_MAX_VPS_PER_CHILD_PARTITION) 684 union { 685 struct hv_vpset bitset; 686 u64 bitset_buffer[BITSET_BUFFER_SIZE]; 687 } vp_bitset; 688 #undef BITSET_BUFFER_SIZE 689 } __packed; 690 691 static_assert(sizeof(struct hv_vp_signal_bitset_scheduler_message) <= 692 (sizeof(struct hv_message) - sizeof(struct hv_message_header))); 693 694 #define HV_MESSAGE_MAX_PARTITION_VP_PAIR_COUNT \ 695 (((sizeof(struct hv_message) - sizeof(struct hv_message_header)) / \ 696 (sizeof(u64 /* partition id */) + sizeof(u32 /* vp index */))) - 1) 697 698 struct hv_vp_signal_pair_scheduler_message { 699 u32 overflow_count; 700 u8 vp_count; 701 u8 reserved1[3]; 702 703 u64 partition_ids[HV_MESSAGE_MAX_PARTITION_VP_PAIR_COUNT]; 704 u32 vp_indexes[HV_MESSAGE_MAX_PARTITION_VP_PAIR_COUNT]; 705 706 u8 reserved2[4]; 707 } __packed; 708 709 static_assert(sizeof(struct hv_vp_signal_pair_scheduler_message) == 710 (sizeof(struct hv_message) - sizeof(struct hv_message_header))); 711 712 /* Input and output structures for HVCALL_DISPATCH_VP */ 713 #define HV_DISPATCH_VP_FLAG_CLEAR_INTERCEPT_SUSPEND 0x1 714 #define HV_DISPATCH_VP_FLAG_ENABLE_CALLER_INTERRUPTS 0x2 715 #define HV_DISPATCH_VP_FLAG_SET_CALLER_SPEC_CTRL 0x4 716 #define HV_DISPATCH_VP_FLAG_SKIP_VP_SPEC_FLUSH 0x8 717 #define HV_DISPATCH_VP_FLAG_SKIP_CALLER_SPEC_FLUSH 0x10 718 #define HV_DISPATCH_VP_FLAG_SKIP_CALLER_USER_SPEC_FLUSH 0x20 719 720 struct hv_input_dispatch_vp { 721 u64 partition_id; 722 u32 vp_index; 723 u32 flags; 724 u64 time_slice; /* in 100ns */ 725 u64 spec_ctrl; 726 } __packed; 727 728 struct hv_output_dispatch_vp { 729 u32 dispatch_state; /* enum hv_vp_dispatch_state */ 730 u32 dispatch_event; /* enum hv_vp_dispatch_event */ 731 } __packed; 732 733 #endif /* _HV_HVHDK_H */ 734