1 /**************************************************************************** 2 **************************************************************************** 3 *** 4 *** This header was automatically generated from a Linux kernel header 5 *** of the same name, to make information necessary for userspace to 6 *** call into the kernel available to libc. It contains only constants, 7 *** structures, and macros generated from the original header, and thus, 8 *** contains no copyrightable information. 9 *** 10 *** To edit the content of this header, modify the corresponding 11 *** source file (e.g. under external/kernel-headers/original/) then 12 *** run bionic/libc/kernel/tools/update_all.py 13 *** 14 *** Any manual change here will be lost the next time this script will 15 *** be run. You've been warned! 16 *** 17 **************************************************************************** 18 ****************************************************************************/ 19 #ifndef __LINUX_KVM_H 20 #define __LINUX_KVM_H 21 #include <linux/types.h> 22 #include <linux/compiler.h> 23 #include <linux/ioctl.h> 24 #include <asm/kvm.h> 25 #define KVM_API_VERSION 12 26 #define KVM_TRC_SHIFT 16 27 #define KVM_TRC_ENTRYEXIT (1 << KVM_TRC_SHIFT) 28 #define KVM_TRC_HANDLER (1 << (KVM_TRC_SHIFT + 1)) 29 #define KVM_TRC_VMENTRY (KVM_TRC_ENTRYEXIT + 0x01) 30 #define KVM_TRC_VMEXIT (KVM_TRC_ENTRYEXIT + 0x02) 31 #define KVM_TRC_PAGE_FAULT (KVM_TRC_HANDLER + 0x01) 32 #define KVM_TRC_HEAD_SIZE 12 33 #define KVM_TRC_CYCLE_SIZE 8 34 #define KVM_TRC_EXTRA_MAX 7 35 #define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02) 36 #define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03) 37 #define KVM_TRC_PEND_INTR (KVM_TRC_HANDLER + 0x04) 38 #define KVM_TRC_IO_READ (KVM_TRC_HANDLER + 0x05) 39 #define KVM_TRC_IO_WRITE (KVM_TRC_HANDLER + 0x06) 40 #define KVM_TRC_CR_READ (KVM_TRC_HANDLER + 0x07) 41 #define KVM_TRC_CR_WRITE (KVM_TRC_HANDLER + 0x08) 42 #define KVM_TRC_DR_READ (KVM_TRC_HANDLER + 0x09) 43 #define KVM_TRC_DR_WRITE (KVM_TRC_HANDLER + 0x0A) 44 #define KVM_TRC_MSR_READ (KVM_TRC_HANDLER + 0x0B) 45 #define KVM_TRC_MSR_WRITE (KVM_TRC_HANDLER + 0x0C) 46 #define KVM_TRC_CPUID (KVM_TRC_HANDLER + 0x0D) 47 #define KVM_TRC_INTR (KVM_TRC_HANDLER + 0x0E) 48 #define KVM_TRC_NMI (KVM_TRC_HANDLER + 0x0F) 49 #define KVM_TRC_VMMCALL (KVM_TRC_HANDLER + 0x10) 50 #define KVM_TRC_HLT (KVM_TRC_HANDLER + 0x11) 51 #define KVM_TRC_CLTS (KVM_TRC_HANDLER + 0x12) 52 #define KVM_TRC_LMSW (KVM_TRC_HANDLER + 0x13) 53 #define KVM_TRC_APIC_ACCESS (KVM_TRC_HANDLER + 0x14) 54 #define KVM_TRC_TDP_FAULT (KVM_TRC_HANDLER + 0x15) 55 #define KVM_TRC_GTLB_WRITE (KVM_TRC_HANDLER + 0x16) 56 #define KVM_TRC_STLB_WRITE (KVM_TRC_HANDLER + 0x17) 57 #define KVM_TRC_STLB_INVAL (KVM_TRC_HANDLER + 0x18) 58 #define KVM_TRC_PPC_INSTR (KVM_TRC_HANDLER + 0x19) 59 struct kvm_user_trace_setup { 60 __u32 buf_size; 61 __u32 buf_nr; 62 }; 63 #define __KVM_DEPRECATED_MAIN_W_0x06 _IOW(KVMIO, 0x06, struct kvm_user_trace_setup) 64 #define __KVM_DEPRECATED_MAIN_0x07 _IO(KVMIO, 0x07) 65 #define __KVM_DEPRECATED_MAIN_0x08 _IO(KVMIO, 0x08) 66 #define __KVM_DEPRECATED_VM_R_0x70 _IOR(KVMIO, 0x70, struct kvm_assigned_irq) 67 struct kvm_breakpoint { 68 __u32 enabled; 69 __u32 padding; 70 __u64 address; 71 }; 72 struct kvm_debug_guest { 73 __u32 enabled; 74 __u32 pad; 75 struct kvm_breakpoint breakpoints[4]; 76 __u32 singlestep; 77 }; 78 #define __KVM_DEPRECATED_VCPU_W_0x87 _IOW(KVMIO, 0x87, struct kvm_debug_guest) 79 struct kvm_memory_region { 80 __u32 slot; 81 __u32 flags; 82 __u64 guest_phys_addr; 83 __u64 memory_size; 84 }; 85 struct kvm_userspace_memory_region { 86 __u32 slot; 87 __u32 flags; 88 __u64 guest_phys_addr; 89 __u64 memory_size; 90 __u64 userspace_addr; 91 }; 92 #define KVM_MEM_LOG_DIRTY_PAGES (1UL << 0) 93 #define KVM_MEM_READONLY (1UL << 1) 94 struct kvm_irq_level { 95 union { 96 __u32 irq; 97 __s32 status; 98 }; 99 __u32 level; 100 }; 101 struct kvm_irqchip { 102 __u32 chip_id; 103 __u32 pad; 104 union { 105 char dummy[512]; 106 #ifdef __KVM_HAVE_PIT 107 struct kvm_pic_state pic; 108 #endif 109 #ifdef __KVM_HAVE_IOAPIC 110 struct kvm_ioapic_state ioapic; 111 #endif 112 } chip; 113 }; 114 struct kvm_pit_config { 115 __u32 flags; 116 __u32 pad[15]; 117 }; 118 #define KVM_PIT_SPEAKER_DUMMY 1 119 struct kvm_s390_skeys { 120 __u64 start_gfn; 121 __u64 count; 122 __u64 skeydata_addr; 123 __u32 flags; 124 __u32 reserved[9]; 125 }; 126 #define KVM_S390_CMMA_PEEK (1 << 0) 127 struct kvm_s390_cmma_log { 128 __u64 start_gfn; 129 __u32 count; 130 __u32 flags; 131 union { 132 __u64 remaining; 133 __u64 mask; 134 }; 135 __u64 values; 136 }; 137 struct kvm_hyperv_exit { 138 #define KVM_EXIT_HYPERV_SYNIC 1 139 #define KVM_EXIT_HYPERV_HCALL 2 140 __u32 type; 141 union { 142 struct { 143 __u32 msr; 144 __u64 control; 145 __u64 evt_page; 146 __u64 msg_page; 147 } synic; 148 struct { 149 __u64 input; 150 __u64 result; 151 __u64 params[2]; 152 } hcall; 153 } u; 154 }; 155 #define KVM_S390_GET_SKEYS_NONE 1 156 #define KVM_S390_SKEYS_MAX 1048576 157 #define KVM_EXIT_UNKNOWN 0 158 #define KVM_EXIT_EXCEPTION 1 159 #define KVM_EXIT_IO 2 160 #define KVM_EXIT_HYPERCALL 3 161 #define KVM_EXIT_DEBUG 4 162 #define KVM_EXIT_HLT 5 163 #define KVM_EXIT_MMIO 6 164 #define KVM_EXIT_IRQ_WINDOW_OPEN 7 165 #define KVM_EXIT_SHUTDOWN 8 166 #define KVM_EXIT_FAIL_ENTRY 9 167 #define KVM_EXIT_INTR 10 168 #define KVM_EXIT_SET_TPR 11 169 #define KVM_EXIT_TPR_ACCESS 12 170 #define KVM_EXIT_S390_SIEIC 13 171 #define KVM_EXIT_S390_RESET 14 172 #define KVM_EXIT_DCR 15 173 #define KVM_EXIT_NMI 16 174 #define KVM_EXIT_INTERNAL_ERROR 17 175 #define KVM_EXIT_OSI 18 176 #define KVM_EXIT_PAPR_HCALL 19 177 #define KVM_EXIT_S390_UCONTROL 20 178 #define KVM_EXIT_WATCHDOG 21 179 #define KVM_EXIT_S390_TSCH 22 180 #define KVM_EXIT_EPR 23 181 #define KVM_EXIT_SYSTEM_EVENT 24 182 #define KVM_EXIT_S390_STSI 25 183 #define KVM_EXIT_IOAPIC_EOI 26 184 #define KVM_EXIT_HYPERV 27 185 #define KVM_EXIT_ARM_NISV 28 186 #define KVM_INTERNAL_ERROR_EMULATION 1 187 #define KVM_INTERNAL_ERROR_SIMUL_EX 2 188 #define KVM_INTERNAL_ERROR_DELIVERY_EV 3 189 #define KVM_INTERNAL_ERROR_UNEXPECTED_EXIT_REASON 4 190 struct kvm_run { 191 __u8 request_interrupt_window; 192 __u8 immediate_exit; 193 __u8 padding1[6]; 194 __u32 exit_reason; 195 __u8 ready_for_interrupt_injection; 196 __u8 if_flag; 197 __u16 flags; 198 __u64 cr8; 199 __u64 apic_base; 200 #ifdef __KVM_S390 201 __u64 psw_mask; 202 __u64 psw_addr; 203 #endif 204 union { 205 struct { 206 __u64 hardware_exit_reason; 207 } hw; 208 struct { 209 __u64 hardware_entry_failure_reason; 210 } fail_entry; 211 struct { 212 __u32 exception; 213 __u32 error_code; 214 } ex; 215 struct { 216 #define KVM_EXIT_IO_IN 0 217 #define KVM_EXIT_IO_OUT 1 218 __u8 direction; 219 __u8 size; 220 __u16 port; 221 __u32 count; 222 __u64 data_offset; 223 } io; 224 struct { 225 struct kvm_debug_exit_arch arch; 226 } debug; 227 struct { 228 __u64 phys_addr; 229 __u8 data[8]; 230 __u32 len; 231 __u8 is_write; 232 } mmio; 233 struct { 234 __u64 nr; 235 __u64 args[6]; 236 __u64 ret; 237 __u32 longmode; 238 __u32 pad; 239 } hypercall; 240 struct { 241 __u64 rip; 242 __u32 is_write; 243 __u32 pad; 244 } tpr_access; 245 struct { 246 __u8 icptcode; 247 __u16 ipa; 248 __u32 ipb; 249 } s390_sieic; 250 #define KVM_S390_RESET_POR 1 251 #define KVM_S390_RESET_CLEAR 2 252 #define KVM_S390_RESET_SUBSYSTEM 4 253 #define KVM_S390_RESET_CPU_INIT 8 254 #define KVM_S390_RESET_IPL 16 255 __u64 s390_reset_flags; 256 struct { 257 __u64 trans_exc_code; 258 __u32 pgm_code; 259 } s390_ucontrol; 260 struct { 261 __u32 dcrn; 262 __u32 data; 263 __u8 is_write; 264 } dcr; 265 struct { 266 __u32 suberror; 267 __u32 ndata; 268 __u64 data[16]; 269 } internal; 270 struct { 271 __u64 gprs[32]; 272 } osi; 273 struct { 274 __u64 nr; 275 __u64 ret; 276 __u64 args[9]; 277 } papr_hcall; 278 struct { 279 __u16 subchannel_id; 280 __u16 subchannel_nr; 281 __u32 io_int_parm; 282 __u32 io_int_word; 283 __u32 ipb; 284 __u8 dequeued; 285 } s390_tsch; 286 struct { 287 __u32 epr; 288 } epr; 289 struct { 290 #define KVM_SYSTEM_EVENT_SHUTDOWN 1 291 #define KVM_SYSTEM_EVENT_RESET 2 292 #define KVM_SYSTEM_EVENT_CRASH 3 293 __u32 type; 294 __u64 flags; 295 } system_event; 296 struct { 297 __u64 addr; 298 __u8 ar; 299 __u8 reserved; 300 __u8 fc; 301 __u8 sel1; 302 __u16 sel2; 303 } s390_stsi; 304 struct { 305 __u8 vector; 306 } eoi; 307 struct kvm_hyperv_exit hyperv; 308 struct { 309 __u64 esr_iss; 310 __u64 fault_ipa; 311 } arm_nisv; 312 char padding[256]; 313 }; 314 #define SYNC_REGS_SIZE_BYTES 2048 315 __u64 kvm_valid_regs; 316 __u64 kvm_dirty_regs; 317 union { 318 struct kvm_sync_regs regs; 319 char padding[SYNC_REGS_SIZE_BYTES]; 320 } s; 321 }; 322 struct kvm_coalesced_mmio_zone { 323 __u64 addr; 324 __u32 size; 325 union { 326 __u32 pad; 327 __u32 pio; 328 }; 329 }; 330 struct kvm_coalesced_mmio { 331 __u64 phys_addr; 332 __u32 len; 333 union { 334 __u32 pad; 335 __u32 pio; 336 }; 337 __u8 data[8]; 338 }; 339 struct kvm_coalesced_mmio_ring { 340 __u32 first, last; 341 struct kvm_coalesced_mmio coalesced_mmio[0]; 342 }; 343 #define KVM_COALESCED_MMIO_MAX ((PAGE_SIZE - sizeof(struct kvm_coalesced_mmio_ring)) / sizeof(struct kvm_coalesced_mmio)) 344 struct kvm_translation { 345 __u64 linear_address; 346 __u64 physical_address; 347 __u8 valid; 348 __u8 writeable; 349 __u8 usermode; 350 __u8 pad[5]; 351 }; 352 struct kvm_s390_mem_op { 353 __u64 gaddr; 354 __u64 flags; 355 __u32 size; 356 __u32 op; 357 __u64 buf; 358 union { 359 __u8 ar; 360 __u32 sida_offset; 361 __u8 reserved[32]; 362 }; 363 }; 364 #define KVM_S390_MEMOP_LOGICAL_READ 0 365 #define KVM_S390_MEMOP_LOGICAL_WRITE 1 366 #define KVM_S390_MEMOP_SIDA_READ 2 367 #define KVM_S390_MEMOP_SIDA_WRITE 3 368 #define KVM_S390_MEMOP_F_CHECK_ONLY (1ULL << 0) 369 #define KVM_S390_MEMOP_F_INJECT_EXCEPTION (1ULL << 1) 370 struct kvm_interrupt { 371 __u32 irq; 372 }; 373 struct kvm_dirty_log { 374 __u32 slot; 375 __u32 padding1; 376 union { 377 void __user * dirty_bitmap; 378 __u64 padding2; 379 }; 380 }; 381 struct kvm_clear_dirty_log { 382 __u32 slot; 383 __u32 num_pages; 384 __u64 first_page; 385 union { 386 void __user * dirty_bitmap; 387 __u64 padding2; 388 }; 389 }; 390 struct kvm_signal_mask { 391 __u32 len; 392 __u8 sigset[0]; 393 }; 394 struct kvm_tpr_access_ctl { 395 __u32 enabled; 396 __u32 flags; 397 __u32 reserved[8]; 398 }; 399 struct kvm_vapic_addr { 400 __u64 vapic_addr; 401 }; 402 #define KVM_MP_STATE_RUNNABLE 0 403 #define KVM_MP_STATE_UNINITIALIZED 1 404 #define KVM_MP_STATE_INIT_RECEIVED 2 405 #define KVM_MP_STATE_HALTED 3 406 #define KVM_MP_STATE_SIPI_RECEIVED 4 407 #define KVM_MP_STATE_STOPPED 5 408 #define KVM_MP_STATE_CHECK_STOP 6 409 #define KVM_MP_STATE_OPERATING 7 410 #define KVM_MP_STATE_LOAD 8 411 struct kvm_mp_state { 412 __u32 mp_state; 413 }; 414 struct kvm_s390_psw { 415 __u64 mask; 416 __u64 addr; 417 }; 418 #define KVM_S390_SIGP_STOP 0xfffe0000u 419 #define KVM_S390_PROGRAM_INT 0xfffe0001u 420 #define KVM_S390_SIGP_SET_PREFIX 0xfffe0002u 421 #define KVM_S390_RESTART 0xfffe0003u 422 #define KVM_S390_INT_PFAULT_INIT 0xfffe0004u 423 #define KVM_S390_INT_PFAULT_DONE 0xfffe0005u 424 #define KVM_S390_MCHK 0xfffe1000u 425 #define KVM_S390_INT_CLOCK_COMP 0xffff1004u 426 #define KVM_S390_INT_CPU_TIMER 0xffff1005u 427 #define KVM_S390_INT_VIRTIO 0xffff2603u 428 #define KVM_S390_INT_SERVICE 0xffff2401u 429 #define KVM_S390_INT_EMERGENCY 0xffff1201u 430 #define KVM_S390_INT_EXTERNAL_CALL 0xffff1202u 431 #define KVM_S390_INT_IO(ai,cssid,ssid,schid) (((schid)) | ((ssid) << 16) | ((cssid) << 18) | ((ai) << 26)) 432 #define KVM_S390_INT_IO_MIN 0x00000000u 433 #define KVM_S390_INT_IO_MAX 0xfffdffffu 434 #define KVM_S390_INT_IO_AI_MASK 0x04000000u 435 struct kvm_s390_interrupt { 436 __u32 type; 437 __u32 parm; 438 __u64 parm64; 439 }; 440 struct kvm_s390_io_info { 441 __u16 subchannel_id; 442 __u16 subchannel_nr; 443 __u32 io_int_parm; 444 __u32 io_int_word; 445 }; 446 struct kvm_s390_ext_info { 447 __u32 ext_params; 448 __u32 pad; 449 __u64 ext_params2; 450 }; 451 struct kvm_s390_pgm_info { 452 __u64 trans_exc_code; 453 __u64 mon_code; 454 __u64 per_address; 455 __u32 data_exc_code; 456 __u16 code; 457 __u16 mon_class_nr; 458 __u8 per_code; 459 __u8 per_atmid; 460 __u8 exc_access_id; 461 __u8 per_access_id; 462 __u8 op_access_id; 463 #define KVM_S390_PGM_FLAGS_ILC_VALID 0x01 464 #define KVM_S390_PGM_FLAGS_ILC_0 0x02 465 #define KVM_S390_PGM_FLAGS_ILC_1 0x04 466 #define KVM_S390_PGM_FLAGS_ILC_MASK 0x06 467 #define KVM_S390_PGM_FLAGS_NO_REWIND 0x08 468 __u8 flags; 469 __u8 pad[2]; 470 }; 471 struct kvm_s390_prefix_info { 472 __u32 address; 473 }; 474 struct kvm_s390_extcall_info { 475 __u16 code; 476 }; 477 struct kvm_s390_emerg_info { 478 __u16 code; 479 }; 480 #define KVM_S390_STOP_FLAG_STORE_STATUS 0x01 481 struct kvm_s390_stop_info { 482 __u32 flags; 483 }; 484 struct kvm_s390_mchk_info { 485 __u64 cr14; 486 __u64 mcic; 487 __u64 failing_storage_address; 488 __u32 ext_damage_code; 489 __u32 pad; 490 __u8 fixed_logout[16]; 491 }; 492 struct kvm_s390_irq { 493 __u64 type; 494 union { 495 struct kvm_s390_io_info io; 496 struct kvm_s390_ext_info ext; 497 struct kvm_s390_pgm_info pgm; 498 struct kvm_s390_emerg_info emerg; 499 struct kvm_s390_extcall_info extcall; 500 struct kvm_s390_prefix_info prefix; 501 struct kvm_s390_stop_info stop; 502 struct kvm_s390_mchk_info mchk; 503 char reserved[64]; 504 } u; 505 }; 506 struct kvm_s390_irq_state { 507 __u64 buf; 508 __u32 flags; 509 __u32 len; 510 __u32 reserved[4]; 511 }; 512 #define KVM_GUESTDBG_ENABLE 0x00000001 513 #define KVM_GUESTDBG_SINGLESTEP 0x00000002 514 struct kvm_guest_debug { 515 __u32 control; 516 __u32 pad; 517 struct kvm_guest_debug_arch arch; 518 }; 519 enum { 520 kvm_ioeventfd_flag_nr_datamatch, 521 kvm_ioeventfd_flag_nr_pio, 522 kvm_ioeventfd_flag_nr_deassign, 523 kvm_ioeventfd_flag_nr_virtio_ccw_notify, 524 kvm_ioeventfd_flag_nr_fast_mmio, 525 kvm_ioeventfd_flag_nr_max, 526 }; 527 #define KVM_IOEVENTFD_FLAG_DATAMATCH (1 << kvm_ioeventfd_flag_nr_datamatch) 528 #define KVM_IOEVENTFD_FLAG_PIO (1 << kvm_ioeventfd_flag_nr_pio) 529 #define KVM_IOEVENTFD_FLAG_DEASSIGN (1 << kvm_ioeventfd_flag_nr_deassign) 530 #define KVM_IOEVENTFD_FLAG_VIRTIO_CCW_NOTIFY (1 << kvm_ioeventfd_flag_nr_virtio_ccw_notify) 531 #define KVM_IOEVENTFD_VALID_FLAG_MASK ((1 << kvm_ioeventfd_flag_nr_max) - 1) 532 struct kvm_ioeventfd { 533 __u64 datamatch; 534 __u64 addr; 535 __u32 len; 536 __s32 fd; 537 __u32 flags; 538 __u8 pad[36]; 539 }; 540 #define KVM_X86_DISABLE_EXITS_MWAIT (1 << 0) 541 #define KVM_X86_DISABLE_EXITS_HLT (1 << 1) 542 #define KVM_X86_DISABLE_EXITS_PAUSE (1 << 2) 543 #define KVM_X86_DISABLE_EXITS_CSTATE (1 << 3) 544 #define KVM_X86_DISABLE_VALID_EXITS (KVM_X86_DISABLE_EXITS_MWAIT | KVM_X86_DISABLE_EXITS_HLT | KVM_X86_DISABLE_EXITS_PAUSE | KVM_X86_DISABLE_EXITS_CSTATE) 545 struct kvm_enable_cap { 546 __u32 cap; 547 __u32 flags; 548 __u64 args[4]; 549 __u8 pad[64]; 550 }; 551 #define KVM_PPC_PVINFO_FLAGS_EV_IDLE (1 << 0) 552 struct kvm_ppc_pvinfo { 553 __u32 flags; 554 __u32 hcall[4]; 555 __u8 pad[108]; 556 }; 557 #define KVM_PPC_PAGE_SIZES_MAX_SZ 8 558 struct kvm_ppc_one_page_size { 559 __u32 page_shift; 560 __u32 pte_enc; 561 }; 562 struct kvm_ppc_one_seg_page_size { 563 __u32 page_shift; 564 __u32 slb_enc; 565 struct kvm_ppc_one_page_size enc[KVM_PPC_PAGE_SIZES_MAX_SZ]; 566 }; 567 #define KVM_PPC_PAGE_SIZES_REAL 0x00000001 568 #define KVM_PPC_1T_SEGMENTS 0x00000002 569 #define KVM_PPC_NO_HASH 0x00000004 570 struct kvm_ppc_smmu_info { 571 __u64 flags; 572 __u32 slb_size; 573 __u16 data_keys; 574 __u16 instr_keys; 575 struct kvm_ppc_one_seg_page_size sps[KVM_PPC_PAGE_SIZES_MAX_SZ]; 576 }; 577 struct kvm_ppc_resize_hpt { 578 __u64 flags; 579 __u32 shift; 580 __u32 pad; 581 }; 582 #define KVMIO 0xAE 583 #define KVM_VM_S390_UCONTROL 1 584 #define KVM_VM_PPC_HV 1 585 #define KVM_VM_PPC_PR 2 586 #define KVM_VM_MIPS_TE 0 587 #define KVM_VM_MIPS_VZ 1 588 #define KVM_S390_SIE_PAGE_OFFSET 1 589 #define KVM_VM_TYPE_ARM_IPA_SIZE_MASK 0xffULL 590 #define KVM_VM_TYPE_ARM_IPA_SIZE(x) ((x) & KVM_VM_TYPE_ARM_IPA_SIZE_MASK) 591 #define KVM_GET_API_VERSION _IO(KVMIO, 0x00) 592 #define KVM_CREATE_VM _IO(KVMIO, 0x01) 593 #define KVM_GET_MSR_INDEX_LIST _IOWR(KVMIO, 0x02, struct kvm_msr_list) 594 #define KVM_S390_ENABLE_SIE _IO(KVMIO, 0x06) 595 #define KVM_CHECK_EXTENSION _IO(KVMIO, 0x03) 596 #define KVM_GET_VCPU_MMAP_SIZE _IO(KVMIO, 0x04) 597 #define KVM_GET_SUPPORTED_CPUID _IOWR(KVMIO, 0x05, struct kvm_cpuid2) 598 #define KVM_TRACE_ENABLE __KVM_DEPRECATED_MAIN_W_0x06 599 #define KVM_TRACE_PAUSE __KVM_DEPRECATED_MAIN_0x07 600 #define KVM_TRACE_DISABLE __KVM_DEPRECATED_MAIN_0x08 601 #define KVM_GET_EMULATED_CPUID _IOWR(KVMIO, 0x09, struct kvm_cpuid2) 602 #define KVM_GET_MSR_FEATURE_INDEX_LIST _IOWR(KVMIO, 0x0a, struct kvm_msr_list) 603 #define KVM_CAP_IRQCHIP 0 604 #define KVM_CAP_HLT 1 605 #define KVM_CAP_MMU_SHADOW_CACHE_CONTROL 2 606 #define KVM_CAP_USER_MEMORY 3 607 #define KVM_CAP_SET_TSS_ADDR 4 608 #define KVM_CAP_VAPIC 6 609 #define KVM_CAP_EXT_CPUID 7 610 #define KVM_CAP_CLOCKSOURCE 8 611 #define KVM_CAP_NR_VCPUS 9 612 #define KVM_CAP_NR_MEMSLOTS 10 613 #define KVM_CAP_PIT 11 614 #define KVM_CAP_NOP_IO_DELAY 12 615 #define KVM_CAP_PV_MMU 13 616 #define KVM_CAP_MP_STATE 14 617 #define KVM_CAP_COALESCED_MMIO 15 618 #define KVM_CAP_SYNC_MMU 16 619 #define KVM_CAP_IOMMU 18 620 #define KVM_CAP_DESTROY_MEMORY_REGION_WORKS 21 621 #define KVM_CAP_USER_NMI 22 622 #ifdef __KVM_HAVE_GUEST_DEBUG 623 #define KVM_CAP_SET_GUEST_DEBUG 23 624 #endif 625 #ifdef __KVM_HAVE_PIT 626 #define KVM_CAP_REINJECT_CONTROL 24 627 #endif 628 #define KVM_CAP_IRQ_ROUTING 25 629 #define KVM_CAP_IRQ_INJECT_STATUS 26 630 #define KVM_CAP_ASSIGN_DEV_IRQ 29 631 #define KVM_CAP_JOIN_MEMORY_REGIONS_WORKS 30 632 #ifdef __KVM_HAVE_MCE 633 #define KVM_CAP_MCE 31 634 #endif 635 #define KVM_CAP_IRQFD 32 636 #ifdef __KVM_HAVE_PIT 637 #define KVM_CAP_PIT2 33 638 #endif 639 #define KVM_CAP_SET_BOOT_CPU_ID 34 640 #ifdef __KVM_HAVE_PIT_STATE2 641 #define KVM_CAP_PIT_STATE2 35 642 #endif 643 #define KVM_CAP_IOEVENTFD 36 644 #define KVM_CAP_SET_IDENTITY_MAP_ADDR 37 645 #ifdef __KVM_HAVE_XEN_HVM 646 #define KVM_CAP_XEN_HVM 38 647 #endif 648 #define KVM_CAP_ADJUST_CLOCK 39 649 #define KVM_CAP_INTERNAL_ERROR_DATA 40 650 #ifdef __KVM_HAVE_VCPU_EVENTS 651 #define KVM_CAP_VCPU_EVENTS 41 652 #endif 653 #define KVM_CAP_S390_PSW 42 654 #define KVM_CAP_PPC_SEGSTATE 43 655 #define KVM_CAP_HYPERV 44 656 #define KVM_CAP_HYPERV_VAPIC 45 657 #define KVM_CAP_HYPERV_SPIN 46 658 #define KVM_CAP_PCI_SEGMENT 47 659 #define KVM_CAP_PPC_PAIRED_SINGLES 48 660 #define KVM_CAP_INTR_SHADOW 49 661 #ifdef __KVM_HAVE_DEBUGREGS 662 #define KVM_CAP_DEBUGREGS 50 663 #endif 664 #define KVM_CAP_X86_ROBUST_SINGLESTEP 51 665 #define KVM_CAP_PPC_OSI 52 666 #define KVM_CAP_PPC_UNSET_IRQ 53 667 #define KVM_CAP_ENABLE_CAP 54 668 #ifdef __KVM_HAVE_XSAVE 669 #define KVM_CAP_XSAVE 55 670 #endif 671 #ifdef __KVM_HAVE_XCRS 672 #define KVM_CAP_XCRS 56 673 #endif 674 #define KVM_CAP_PPC_GET_PVINFO 57 675 #define KVM_CAP_PPC_IRQ_LEVEL 58 676 #define KVM_CAP_ASYNC_PF 59 677 #define KVM_CAP_TSC_CONTROL 60 678 #define KVM_CAP_GET_TSC_KHZ 61 679 #define KVM_CAP_PPC_BOOKE_SREGS 62 680 #define KVM_CAP_SPAPR_TCE 63 681 #define KVM_CAP_PPC_SMT 64 682 #define KVM_CAP_PPC_RMA 65 683 #define KVM_CAP_MAX_VCPUS 66 684 #define KVM_CAP_PPC_HIOR 67 685 #define KVM_CAP_PPC_PAPR 68 686 #define KVM_CAP_SW_TLB 69 687 #define KVM_CAP_ONE_REG 70 688 #define KVM_CAP_S390_GMAP 71 689 #define KVM_CAP_TSC_DEADLINE_TIMER 72 690 #define KVM_CAP_S390_UCONTROL 73 691 #define KVM_CAP_SYNC_REGS 74 692 #define KVM_CAP_PCI_2_3 75 693 #define KVM_CAP_KVMCLOCK_CTRL 76 694 #define KVM_CAP_SIGNAL_MSI 77 695 #define KVM_CAP_PPC_GET_SMMU_INFO 78 696 #define KVM_CAP_S390_COW 79 697 #define KVM_CAP_PPC_ALLOC_HTAB 80 698 #define KVM_CAP_READONLY_MEM 81 699 #define KVM_CAP_IRQFD_RESAMPLE 82 700 #define KVM_CAP_PPC_BOOKE_WATCHDOG 83 701 #define KVM_CAP_PPC_HTAB_FD 84 702 #define KVM_CAP_S390_CSS_SUPPORT 85 703 #define KVM_CAP_PPC_EPR 86 704 #define KVM_CAP_ARM_PSCI 87 705 #define KVM_CAP_ARM_SET_DEVICE_ADDR 88 706 #define KVM_CAP_DEVICE_CTRL 89 707 #define KVM_CAP_IRQ_MPIC 90 708 #define KVM_CAP_PPC_RTAS 91 709 #define KVM_CAP_IRQ_XICS 92 710 #define KVM_CAP_ARM_EL1_32BIT 93 711 #define KVM_CAP_SPAPR_MULTITCE 94 712 #define KVM_CAP_EXT_EMUL_CPUID 95 713 #define KVM_CAP_HYPERV_TIME 96 714 #define KVM_CAP_IOAPIC_POLARITY_IGNORED 97 715 #define KVM_CAP_ENABLE_CAP_VM 98 716 #define KVM_CAP_S390_IRQCHIP 99 717 #define KVM_CAP_IOEVENTFD_NO_LENGTH 100 718 #define KVM_CAP_VM_ATTRIBUTES 101 719 #define KVM_CAP_ARM_PSCI_0_2 102 720 #define KVM_CAP_PPC_FIXUP_HCALL 103 721 #define KVM_CAP_PPC_ENABLE_HCALL 104 722 #define KVM_CAP_CHECK_EXTENSION_VM 105 723 #define KVM_CAP_S390_USER_SIGP 106 724 #define KVM_CAP_S390_VECTOR_REGISTERS 107 725 #define KVM_CAP_S390_MEM_OP 108 726 #define KVM_CAP_S390_USER_STSI 109 727 #define KVM_CAP_S390_SKEYS 110 728 #define KVM_CAP_MIPS_FPU 111 729 #define KVM_CAP_MIPS_MSA 112 730 #define KVM_CAP_S390_INJECT_IRQ 113 731 #define KVM_CAP_S390_IRQ_STATE 114 732 #define KVM_CAP_PPC_HWRNG 115 733 #define KVM_CAP_DISABLE_QUIRKS 116 734 #define KVM_CAP_X86_SMM 117 735 #define KVM_CAP_MULTI_ADDRESS_SPACE 118 736 #define KVM_CAP_GUEST_DEBUG_HW_BPS 119 737 #define KVM_CAP_GUEST_DEBUG_HW_WPS 120 738 #define KVM_CAP_SPLIT_IRQCHIP 121 739 #define KVM_CAP_IOEVENTFD_ANY_LENGTH 122 740 #define KVM_CAP_HYPERV_SYNIC 123 741 #define KVM_CAP_S390_RI 124 742 #define KVM_CAP_SPAPR_TCE_64 125 743 #define KVM_CAP_ARM_PMU_V3 126 744 #define KVM_CAP_VCPU_ATTRIBUTES 127 745 #define KVM_CAP_MAX_VCPU_ID 128 746 #define KVM_CAP_X2APIC_API 129 747 #define KVM_CAP_S390_USER_INSTR0 130 748 #define KVM_CAP_MSI_DEVID 131 749 #define KVM_CAP_PPC_HTM 132 750 #define KVM_CAP_SPAPR_RESIZE_HPT 133 751 #define KVM_CAP_PPC_MMU_RADIX 134 752 #define KVM_CAP_PPC_MMU_HASH_V3 135 753 #define KVM_CAP_IMMEDIATE_EXIT 136 754 #define KVM_CAP_MIPS_VZ 137 755 #define KVM_CAP_MIPS_TE 138 756 #define KVM_CAP_MIPS_64BIT 139 757 #define KVM_CAP_S390_GS 140 758 #define KVM_CAP_S390_AIS 141 759 #define KVM_CAP_SPAPR_TCE_VFIO 142 760 #define KVM_CAP_X86_DISABLE_EXITS 143 761 #define KVM_CAP_ARM_USER_IRQ 144 762 #define KVM_CAP_S390_CMMA_MIGRATION 145 763 #define KVM_CAP_PPC_FWNMI 146 764 #define KVM_CAP_PPC_SMT_POSSIBLE 147 765 #define KVM_CAP_HYPERV_SYNIC2 148 766 #define KVM_CAP_HYPERV_VP_INDEX 149 767 #define KVM_CAP_S390_AIS_MIGRATION 150 768 #define KVM_CAP_PPC_GET_CPU_CHAR 151 769 #define KVM_CAP_S390_BPB 152 770 #define KVM_CAP_GET_MSR_FEATURES 153 771 #define KVM_CAP_HYPERV_EVENTFD 154 772 #define KVM_CAP_HYPERV_TLBFLUSH 155 773 #define KVM_CAP_S390_HPAGE_1M 156 774 #define KVM_CAP_NESTED_STATE 157 775 #define KVM_CAP_ARM_INJECT_SERROR_ESR 158 776 #define KVM_CAP_MSR_PLATFORM_INFO 159 777 #define KVM_CAP_PPC_NESTED_HV 160 778 #define KVM_CAP_HYPERV_SEND_IPI 161 779 #define KVM_CAP_COALESCED_PIO 162 780 #define KVM_CAP_HYPERV_ENLIGHTENED_VMCS 163 781 #define KVM_CAP_EXCEPTION_PAYLOAD 164 782 #define KVM_CAP_ARM_VM_IPA_SIZE 165 783 #define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT 166 784 #define KVM_CAP_HYPERV_CPUID 167 785 #define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2 168 786 #define KVM_CAP_PPC_IRQ_XIVE 169 787 #define KVM_CAP_ARM_SVE 170 788 #define KVM_CAP_ARM_PTRAUTH_ADDRESS 171 789 #define KVM_CAP_ARM_PTRAUTH_GENERIC 172 790 #define KVM_CAP_PMU_EVENT_FILTER 173 791 #define KVM_CAP_ARM_IRQ_LINE_LAYOUT_2 174 792 #define KVM_CAP_HYPERV_DIRECT_TLBFLUSH 175 793 #define KVM_CAP_PPC_GUEST_DEBUG_SSTEP 176 794 #define KVM_CAP_ARM_NISV_TO_USER 177 795 #define KVM_CAP_ARM_INJECT_EXT_DABT 178 796 #define KVM_CAP_S390_VCPU_RESETS 179 797 #define KVM_CAP_S390_PROTECTED 180 798 #define KVM_CAP_PPC_SECURE_GUEST 181 799 #ifdef KVM_CAP_IRQ_ROUTING 800 struct kvm_irq_routing_irqchip { 801 __u32 irqchip; 802 __u32 pin; 803 }; 804 struct kvm_irq_routing_msi { 805 __u32 address_lo; 806 __u32 address_hi; 807 __u32 data; 808 union { 809 __u32 pad; 810 __u32 devid; 811 }; 812 }; 813 struct kvm_irq_routing_s390_adapter { 814 __u64 ind_addr; 815 __u64 summary_addr; 816 __u64 ind_offset; 817 __u32 summary_offset; 818 __u32 adapter_id; 819 }; 820 struct kvm_irq_routing_hv_sint { 821 __u32 vcpu; 822 __u32 sint; 823 }; 824 #define KVM_IRQ_ROUTING_IRQCHIP 1 825 #define KVM_IRQ_ROUTING_MSI 2 826 #define KVM_IRQ_ROUTING_S390_ADAPTER 3 827 #define KVM_IRQ_ROUTING_HV_SINT 4 828 struct kvm_irq_routing_entry { 829 __u32 gsi; 830 __u32 type; 831 __u32 flags; 832 __u32 pad; 833 union { 834 struct kvm_irq_routing_irqchip irqchip; 835 struct kvm_irq_routing_msi msi; 836 struct kvm_irq_routing_s390_adapter adapter; 837 struct kvm_irq_routing_hv_sint hv_sint; 838 __u32 pad[8]; 839 } u; 840 }; 841 struct kvm_irq_routing { 842 __u32 nr; 843 __u32 flags; 844 struct kvm_irq_routing_entry entries[0]; 845 }; 846 #endif 847 #ifdef KVM_CAP_MCE 848 struct kvm_x86_mce { 849 __u64 status; 850 __u64 addr; 851 __u64 misc; 852 __u64 mcg_status; 853 __u8 bank; 854 __u8 pad1[7]; 855 __u64 pad2[3]; 856 }; 857 #endif 858 #ifdef KVM_CAP_XEN_HVM 859 struct kvm_xen_hvm_config { 860 __u32 flags; 861 __u32 msr; 862 __u64 blob_addr_32; 863 __u64 blob_addr_64; 864 __u8 blob_size_32; 865 __u8 blob_size_64; 866 __u8 pad2[30]; 867 }; 868 #endif 869 #define KVM_IRQFD_FLAG_DEASSIGN (1 << 0) 870 #define KVM_IRQFD_FLAG_RESAMPLE (1 << 1) 871 struct kvm_irqfd { 872 __u32 fd; 873 __u32 gsi; 874 __u32 flags; 875 __u32 resamplefd; 876 __u8 pad[16]; 877 }; 878 #define KVM_CLOCK_TSC_STABLE 2 879 struct kvm_clock_data { 880 __u64 clock; 881 __u32 flags; 882 __u32 pad[9]; 883 }; 884 #define KVM_MMU_FSL_BOOKE_NOHV 0 885 #define KVM_MMU_FSL_BOOKE_HV 1 886 struct kvm_config_tlb { 887 __u64 params; 888 __u64 array; 889 __u32 mmu_type; 890 __u32 array_len; 891 }; 892 struct kvm_dirty_tlb { 893 __u64 bitmap; 894 __u32 num_dirty; 895 }; 896 #define KVM_REG_ARCH_MASK 0xff00000000000000ULL 897 #define KVM_REG_GENERIC 0x0000000000000000ULL 898 #define KVM_REG_PPC 0x1000000000000000ULL 899 #define KVM_REG_X86 0x2000000000000000ULL 900 #define KVM_REG_IA64 0x3000000000000000ULL 901 #define KVM_REG_ARM 0x4000000000000000ULL 902 #define KVM_REG_S390 0x5000000000000000ULL 903 #define KVM_REG_ARM64 0x6000000000000000ULL 904 #define KVM_REG_MIPS 0x7000000000000000ULL 905 #define KVM_REG_RISCV 0x8000000000000000ULL 906 #define KVM_REG_SIZE_SHIFT 52 907 #define KVM_REG_SIZE_MASK 0x00f0000000000000ULL 908 #define KVM_REG_SIZE_U8 0x0000000000000000ULL 909 #define KVM_REG_SIZE_U16 0x0010000000000000ULL 910 #define KVM_REG_SIZE_U32 0x0020000000000000ULL 911 #define KVM_REG_SIZE_U64 0x0030000000000000ULL 912 #define KVM_REG_SIZE_U128 0x0040000000000000ULL 913 #define KVM_REG_SIZE_U256 0x0050000000000000ULL 914 #define KVM_REG_SIZE_U512 0x0060000000000000ULL 915 #define KVM_REG_SIZE_U1024 0x0070000000000000ULL 916 #define KVM_REG_SIZE_U2048 0x0080000000000000ULL 917 struct kvm_reg_list { 918 __u64 n; 919 __u64 reg[0]; 920 }; 921 struct kvm_one_reg { 922 __u64 id; 923 __u64 addr; 924 }; 925 #define KVM_MSI_VALID_DEVID (1U << 0) 926 struct kvm_msi { 927 __u32 address_lo; 928 __u32 address_hi; 929 __u32 data; 930 __u32 flags; 931 __u32 devid; 932 __u8 pad[12]; 933 }; 934 struct kvm_arm_device_addr { 935 __u64 id; 936 __u64 addr; 937 }; 938 #define KVM_CREATE_DEVICE_TEST 1 939 struct kvm_create_device { 940 __u32 type; 941 __u32 fd; 942 __u32 flags; 943 }; 944 struct kvm_device_attr { 945 __u32 flags; 946 __u32 group; 947 __u64 attr; 948 __u64 addr; 949 }; 950 #define KVM_DEV_VFIO_GROUP 1 951 #define KVM_DEV_VFIO_GROUP_ADD 1 952 #define KVM_DEV_VFIO_GROUP_DEL 2 953 #define KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE 3 954 enum kvm_device_type { 955 KVM_DEV_TYPE_FSL_MPIC_20 = 1, 956 #define KVM_DEV_TYPE_FSL_MPIC_20 KVM_DEV_TYPE_FSL_MPIC_20 957 KVM_DEV_TYPE_FSL_MPIC_42, 958 #define KVM_DEV_TYPE_FSL_MPIC_42 KVM_DEV_TYPE_FSL_MPIC_42 959 KVM_DEV_TYPE_XICS, 960 #define KVM_DEV_TYPE_XICS KVM_DEV_TYPE_XICS 961 KVM_DEV_TYPE_VFIO, 962 #define KVM_DEV_TYPE_VFIO KVM_DEV_TYPE_VFIO 963 KVM_DEV_TYPE_ARM_VGIC_V2, 964 #define KVM_DEV_TYPE_ARM_VGIC_V2 KVM_DEV_TYPE_ARM_VGIC_V2 965 KVM_DEV_TYPE_FLIC, 966 #define KVM_DEV_TYPE_FLIC KVM_DEV_TYPE_FLIC 967 KVM_DEV_TYPE_ARM_VGIC_V3, 968 #define KVM_DEV_TYPE_ARM_VGIC_V3 KVM_DEV_TYPE_ARM_VGIC_V3 969 KVM_DEV_TYPE_ARM_VGIC_ITS, 970 #define KVM_DEV_TYPE_ARM_VGIC_ITS KVM_DEV_TYPE_ARM_VGIC_ITS 971 KVM_DEV_TYPE_XIVE, 972 #define KVM_DEV_TYPE_XIVE KVM_DEV_TYPE_XIVE 973 KVM_DEV_TYPE_ARM_PV_TIME, 974 #define KVM_DEV_TYPE_ARM_PV_TIME KVM_DEV_TYPE_ARM_PV_TIME 975 KVM_DEV_TYPE_MAX, 976 }; 977 struct kvm_vfio_spapr_tce { 978 __s32 groupfd; 979 __s32 tablefd; 980 }; 981 #define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region) 982 #define KVM_CREATE_VCPU _IO(KVMIO, 0x41) 983 #define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log) 984 #define KVM_SET_MEMORY_ALIAS _IOW(KVMIO, 0x43, struct kvm_memory_alias) 985 #define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44) 986 #define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45) 987 #define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46, struct kvm_userspace_memory_region) 988 #define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47) 989 #define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO, 0x48, __u64) 990 struct kvm_s390_ucas_mapping { 991 __u64 user_addr; 992 __u64 vcpu_addr; 993 __u64 length; 994 }; 995 #define KVM_S390_UCAS_MAP _IOW(KVMIO, 0x50, struct kvm_s390_ucas_mapping) 996 #define KVM_S390_UCAS_UNMAP _IOW(KVMIO, 0x51, struct kvm_s390_ucas_mapping) 997 #define KVM_S390_VCPU_FAULT _IOW(KVMIO, 0x52, unsigned long) 998 #define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60) 999 #define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level) 1000 #define KVM_GET_IRQCHIP _IOWR(KVMIO, 0x62, struct kvm_irqchip) 1001 #define KVM_SET_IRQCHIP _IOR(KVMIO, 0x63, struct kvm_irqchip) 1002 #define KVM_CREATE_PIT _IO(KVMIO, 0x64) 1003 #define KVM_GET_PIT _IOWR(KVMIO, 0x65, struct kvm_pit_state) 1004 #define KVM_SET_PIT _IOR(KVMIO, 0x66, struct kvm_pit_state) 1005 #define KVM_IRQ_LINE_STATUS _IOWR(KVMIO, 0x67, struct kvm_irq_level) 1006 #define KVM_REGISTER_COALESCED_MMIO _IOW(KVMIO, 0x67, struct kvm_coalesced_mmio_zone) 1007 #define KVM_UNREGISTER_COALESCED_MMIO _IOW(KVMIO, 0x68, struct kvm_coalesced_mmio_zone) 1008 #define KVM_ASSIGN_PCI_DEVICE _IOR(KVMIO, 0x69, struct kvm_assigned_pci_dev) 1009 #define KVM_SET_GSI_ROUTING _IOW(KVMIO, 0x6a, struct kvm_irq_routing) 1010 #define KVM_ASSIGN_IRQ __KVM_DEPRECATED_VM_R_0x70 1011 #define KVM_ASSIGN_DEV_IRQ _IOW(KVMIO, 0x70, struct kvm_assigned_irq) 1012 #define KVM_REINJECT_CONTROL _IO(KVMIO, 0x71) 1013 #define KVM_DEASSIGN_PCI_DEVICE _IOW(KVMIO, 0x72, struct kvm_assigned_pci_dev) 1014 #define KVM_ASSIGN_SET_MSIX_NR _IOW(KVMIO, 0x73, struct kvm_assigned_msix_nr) 1015 #define KVM_ASSIGN_SET_MSIX_ENTRY _IOW(KVMIO, 0x74, struct kvm_assigned_msix_entry) 1016 #define KVM_DEASSIGN_DEV_IRQ _IOW(KVMIO, 0x75, struct kvm_assigned_irq) 1017 #define KVM_IRQFD _IOW(KVMIO, 0x76, struct kvm_irqfd) 1018 #define KVM_CREATE_PIT2 _IOW(KVMIO, 0x77, struct kvm_pit_config) 1019 #define KVM_SET_BOOT_CPU_ID _IO(KVMIO, 0x78) 1020 #define KVM_IOEVENTFD _IOW(KVMIO, 0x79, struct kvm_ioeventfd) 1021 #define KVM_XEN_HVM_CONFIG _IOW(KVMIO, 0x7a, struct kvm_xen_hvm_config) 1022 #define KVM_SET_CLOCK _IOW(KVMIO, 0x7b, struct kvm_clock_data) 1023 #define KVM_GET_CLOCK _IOR(KVMIO, 0x7c, struct kvm_clock_data) 1024 #define KVM_GET_PIT2 _IOR(KVMIO, 0x9f, struct kvm_pit_state2) 1025 #define KVM_SET_PIT2 _IOW(KVMIO, 0xa0, struct kvm_pit_state2) 1026 #define KVM_PPC_GET_PVINFO _IOW(KVMIO, 0xa1, struct kvm_ppc_pvinfo) 1027 #define KVM_SET_TSC_KHZ _IO(KVMIO, 0xa2) 1028 #define KVM_GET_TSC_KHZ _IO(KVMIO, 0xa3) 1029 #define KVM_ASSIGN_SET_INTX_MASK _IOW(KVMIO, 0xa4, struct kvm_assigned_pci_dev) 1030 #define KVM_SIGNAL_MSI _IOW(KVMIO, 0xa5, struct kvm_msi) 1031 #define KVM_PPC_GET_SMMU_INFO _IOR(KVMIO, 0xa6, struct kvm_ppc_smmu_info) 1032 #define KVM_PPC_ALLOCATE_HTAB _IOWR(KVMIO, 0xa7, __u32) 1033 #define KVM_CREATE_SPAPR_TCE _IOW(KVMIO, 0xa8, struct kvm_create_spapr_tce) 1034 #define KVM_CREATE_SPAPR_TCE_64 _IOW(KVMIO, 0xa8, struct kvm_create_spapr_tce_64) 1035 #define KVM_ALLOCATE_RMA _IOR(KVMIO, 0xa9, struct kvm_allocate_rma) 1036 #define KVM_PPC_GET_HTAB_FD _IOW(KVMIO, 0xaa, struct kvm_get_htab_fd) 1037 #define KVM_ARM_SET_DEVICE_ADDR _IOW(KVMIO, 0xab, struct kvm_arm_device_addr) 1038 #define KVM_PPC_RTAS_DEFINE_TOKEN _IOW(KVMIO, 0xac, struct kvm_rtas_token_args) 1039 #define KVM_PPC_RESIZE_HPT_PREPARE _IOR(KVMIO, 0xad, struct kvm_ppc_resize_hpt) 1040 #define KVM_PPC_RESIZE_HPT_COMMIT _IOR(KVMIO, 0xae, struct kvm_ppc_resize_hpt) 1041 #define KVM_PPC_CONFIGURE_V3_MMU _IOW(KVMIO, 0xaf, struct kvm_ppc_mmuv3_cfg) 1042 #define KVM_PPC_GET_RMMU_INFO _IOW(KVMIO, 0xb0, struct kvm_ppc_rmmu_info) 1043 #define KVM_PPC_GET_CPU_CHAR _IOR(KVMIO, 0xb1, struct kvm_ppc_cpu_char) 1044 #define KVM_SET_PMU_EVENT_FILTER _IOW(KVMIO, 0xb2, struct kvm_pmu_event_filter) 1045 #define KVM_PPC_SVM_OFF _IO(KVMIO, 0xb3) 1046 #define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device) 1047 #define KVM_SET_DEVICE_ATTR _IOW(KVMIO, 0xe1, struct kvm_device_attr) 1048 #define KVM_GET_DEVICE_ATTR _IOW(KVMIO, 0xe2, struct kvm_device_attr) 1049 #define KVM_HAS_DEVICE_ATTR _IOW(KVMIO, 0xe3, struct kvm_device_attr) 1050 #define KVM_RUN _IO(KVMIO, 0x80) 1051 #define KVM_GET_REGS _IOR(KVMIO, 0x81, struct kvm_regs) 1052 #define KVM_SET_REGS _IOW(KVMIO, 0x82, struct kvm_regs) 1053 #define KVM_GET_SREGS _IOR(KVMIO, 0x83, struct kvm_sregs) 1054 #define KVM_SET_SREGS _IOW(KVMIO, 0x84, struct kvm_sregs) 1055 #define KVM_TRANSLATE _IOWR(KVMIO, 0x85, struct kvm_translation) 1056 #define KVM_INTERRUPT _IOW(KVMIO, 0x86, struct kvm_interrupt) 1057 #define KVM_DEBUG_GUEST __KVM_DEPRECATED_VCPU_W_0x87 1058 #define KVM_GET_MSRS _IOWR(KVMIO, 0x88, struct kvm_msrs) 1059 #define KVM_SET_MSRS _IOW(KVMIO, 0x89, struct kvm_msrs) 1060 #define KVM_SET_CPUID _IOW(KVMIO, 0x8a, struct kvm_cpuid) 1061 #define KVM_SET_SIGNAL_MASK _IOW(KVMIO, 0x8b, struct kvm_signal_mask) 1062 #define KVM_GET_FPU _IOR(KVMIO, 0x8c, struct kvm_fpu) 1063 #define KVM_SET_FPU _IOW(KVMIO, 0x8d, struct kvm_fpu) 1064 #define KVM_GET_LAPIC _IOR(KVMIO, 0x8e, struct kvm_lapic_state) 1065 #define KVM_SET_LAPIC _IOW(KVMIO, 0x8f, struct kvm_lapic_state) 1066 #define KVM_SET_CPUID2 _IOW(KVMIO, 0x90, struct kvm_cpuid2) 1067 #define KVM_GET_CPUID2 _IOWR(KVMIO, 0x91, struct kvm_cpuid2) 1068 #define KVM_TPR_ACCESS_REPORTING _IOWR(KVMIO, 0x92, struct kvm_tpr_access_ctl) 1069 #define KVM_SET_VAPIC_ADDR _IOW(KVMIO, 0x93, struct kvm_vapic_addr) 1070 #define KVM_S390_INTERRUPT _IOW(KVMIO, 0x94, struct kvm_s390_interrupt) 1071 #define KVM_S390_STORE_STATUS_NOADDR (- 1ul) 1072 #define KVM_S390_STORE_STATUS_PREFIXED (- 2ul) 1073 #define KVM_S390_STORE_STATUS _IOW(KVMIO, 0x95, unsigned long) 1074 #define KVM_S390_SET_INITIAL_PSW _IOW(KVMIO, 0x96, struct kvm_s390_psw) 1075 #define KVM_S390_INITIAL_RESET _IO(KVMIO, 0x97) 1076 #define KVM_GET_MP_STATE _IOR(KVMIO, 0x98, struct kvm_mp_state) 1077 #define KVM_SET_MP_STATE _IOW(KVMIO, 0x99, struct kvm_mp_state) 1078 #define KVM_NMI _IO(KVMIO, 0x9a) 1079 #define KVM_SET_GUEST_DEBUG _IOW(KVMIO, 0x9b, struct kvm_guest_debug) 1080 #define KVM_X86_SETUP_MCE _IOW(KVMIO, 0x9c, __u64) 1081 #define KVM_X86_GET_MCE_CAP_SUPPORTED _IOR(KVMIO, 0x9d, __u64) 1082 #define KVM_X86_SET_MCE _IOW(KVMIO, 0x9e, struct kvm_x86_mce) 1083 #define KVM_GET_VCPU_EVENTS _IOR(KVMIO, 0x9f, struct kvm_vcpu_events) 1084 #define KVM_SET_VCPU_EVENTS _IOW(KVMIO, 0xa0, struct kvm_vcpu_events) 1085 #define KVM_GET_DEBUGREGS _IOR(KVMIO, 0xa1, struct kvm_debugregs) 1086 #define KVM_SET_DEBUGREGS _IOW(KVMIO, 0xa2, struct kvm_debugregs) 1087 #define KVM_ENABLE_CAP _IOW(KVMIO, 0xa3, struct kvm_enable_cap) 1088 #define KVM_GET_XSAVE _IOR(KVMIO, 0xa4, struct kvm_xsave) 1089 #define KVM_SET_XSAVE _IOW(KVMIO, 0xa5, struct kvm_xsave) 1090 #define KVM_GET_XCRS _IOR(KVMIO, 0xa6, struct kvm_xcrs) 1091 #define KVM_SET_XCRS _IOW(KVMIO, 0xa7, struct kvm_xcrs) 1092 #define KVM_DIRTY_TLB _IOW(KVMIO, 0xaa, struct kvm_dirty_tlb) 1093 #define KVM_GET_ONE_REG _IOW(KVMIO, 0xab, struct kvm_one_reg) 1094 #define KVM_SET_ONE_REG _IOW(KVMIO, 0xac, struct kvm_one_reg) 1095 #define KVM_KVMCLOCK_CTRL _IO(KVMIO, 0xad) 1096 #define KVM_ARM_VCPU_INIT _IOW(KVMIO, 0xae, struct kvm_vcpu_init) 1097 #define KVM_ARM_PREFERRED_TARGET _IOR(KVMIO, 0xaf, struct kvm_vcpu_init) 1098 #define KVM_GET_REG_LIST _IOWR(KVMIO, 0xb0, struct kvm_reg_list) 1099 #define KVM_S390_MEM_OP _IOW(KVMIO, 0xb1, struct kvm_s390_mem_op) 1100 #define KVM_S390_GET_SKEYS _IOW(KVMIO, 0xb2, struct kvm_s390_skeys) 1101 #define KVM_S390_SET_SKEYS _IOW(KVMIO, 0xb3, struct kvm_s390_skeys) 1102 #define KVM_S390_IRQ _IOW(KVMIO, 0xb4, struct kvm_s390_irq) 1103 #define KVM_S390_SET_IRQ_STATE _IOW(KVMIO, 0xb5, struct kvm_s390_irq_state) 1104 #define KVM_S390_GET_IRQ_STATE _IOW(KVMIO, 0xb6, struct kvm_s390_irq_state) 1105 #define KVM_SMI _IO(KVMIO, 0xb7) 1106 #define KVM_S390_GET_CMMA_BITS _IOWR(KVMIO, 0xb8, struct kvm_s390_cmma_log) 1107 #define KVM_S390_SET_CMMA_BITS _IOW(KVMIO, 0xb9, struct kvm_s390_cmma_log) 1108 #define KVM_MEMORY_ENCRYPT_OP _IOWR(KVMIO, 0xba, unsigned long) 1109 struct kvm_enc_region { 1110 __u64 addr; 1111 __u64 size; 1112 }; 1113 #define KVM_MEMORY_ENCRYPT_REG_REGION _IOR(KVMIO, 0xbb, struct kvm_enc_region) 1114 #define KVM_MEMORY_ENCRYPT_UNREG_REGION _IOR(KVMIO, 0xbc, struct kvm_enc_region) 1115 #define KVM_HYPERV_EVENTFD _IOW(KVMIO, 0xbd, struct kvm_hyperv_eventfd) 1116 #define KVM_GET_NESTED_STATE _IOWR(KVMIO, 0xbe, struct kvm_nested_state) 1117 #define KVM_SET_NESTED_STATE _IOW(KVMIO, 0xbf, struct kvm_nested_state) 1118 #define KVM_CLEAR_DIRTY_LOG _IOWR(KVMIO, 0xc0, struct kvm_clear_dirty_log) 1119 #define KVM_GET_SUPPORTED_HV_CPUID _IOWR(KVMIO, 0xc1, struct kvm_cpuid2) 1120 #define KVM_ARM_VCPU_FINALIZE _IOW(KVMIO, 0xc2, int) 1121 #define KVM_S390_NORMAL_RESET _IO(KVMIO, 0xc3) 1122 #define KVM_S390_CLEAR_RESET _IO(KVMIO, 0xc4) 1123 struct kvm_s390_pv_sec_parm { 1124 __u64 origin; 1125 __u64 length; 1126 }; 1127 struct kvm_s390_pv_unp { 1128 __u64 addr; 1129 __u64 size; 1130 __u64 tweak; 1131 }; 1132 enum pv_cmd_id { 1133 KVM_PV_ENABLE, 1134 KVM_PV_DISABLE, 1135 KVM_PV_SET_SEC_PARMS, 1136 KVM_PV_UNPACK, 1137 KVM_PV_VERIFY, 1138 KVM_PV_PREP_RESET, 1139 KVM_PV_UNSHARE_ALL, 1140 }; 1141 struct kvm_pv_cmd { 1142 __u32 cmd; 1143 __u16 rc; 1144 __u16 rrc; 1145 __u64 data; 1146 __u32 flags; 1147 __u32 reserved[3]; 1148 }; 1149 #define KVM_S390_PV_COMMAND _IOWR(KVMIO, 0xc5, struct kvm_pv_cmd) 1150 enum sev_cmd_id { 1151 KVM_SEV_INIT = 0, 1152 KVM_SEV_ES_INIT, 1153 KVM_SEV_LAUNCH_START, 1154 KVM_SEV_LAUNCH_UPDATE_DATA, 1155 KVM_SEV_LAUNCH_UPDATE_VMSA, 1156 KVM_SEV_LAUNCH_SECRET, 1157 KVM_SEV_LAUNCH_MEASURE, 1158 KVM_SEV_LAUNCH_FINISH, 1159 KVM_SEV_SEND_START, 1160 KVM_SEV_SEND_UPDATE_DATA, 1161 KVM_SEV_SEND_UPDATE_VMSA, 1162 KVM_SEV_SEND_FINISH, 1163 KVM_SEV_RECEIVE_START, 1164 KVM_SEV_RECEIVE_UPDATE_DATA, 1165 KVM_SEV_RECEIVE_UPDATE_VMSA, 1166 KVM_SEV_RECEIVE_FINISH, 1167 KVM_SEV_GUEST_STATUS, 1168 KVM_SEV_DBG_DECRYPT, 1169 KVM_SEV_DBG_ENCRYPT, 1170 KVM_SEV_CERT_EXPORT, 1171 KVM_SEV_NR_MAX, 1172 }; 1173 struct kvm_sev_cmd { 1174 __u32 id; 1175 __u64 data; 1176 __u32 error; 1177 __u32 sev_fd; 1178 }; 1179 struct kvm_sev_launch_start { 1180 __u32 handle; 1181 __u32 policy; 1182 __u64 dh_uaddr; 1183 __u32 dh_len; 1184 __u64 session_uaddr; 1185 __u32 session_len; 1186 }; 1187 struct kvm_sev_launch_update_data { 1188 __u64 uaddr; 1189 __u32 len; 1190 }; 1191 struct kvm_sev_launch_secret { 1192 __u64 hdr_uaddr; 1193 __u32 hdr_len; 1194 __u64 guest_uaddr; 1195 __u32 guest_len; 1196 __u64 trans_uaddr; 1197 __u32 trans_len; 1198 }; 1199 struct kvm_sev_launch_measure { 1200 __u64 uaddr; 1201 __u32 len; 1202 }; 1203 struct kvm_sev_guest_status { 1204 __u32 handle; 1205 __u32 policy; 1206 __u32 state; 1207 }; 1208 struct kvm_sev_dbg { 1209 __u64 src_uaddr; 1210 __u64 dst_uaddr; 1211 __u32 len; 1212 }; 1213 #define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) 1214 #define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1) 1215 #define KVM_DEV_ASSIGN_MASK_INTX (1 << 2) 1216 struct kvm_assigned_pci_dev { 1217 __u32 assigned_dev_id; 1218 __u32 busnr; 1219 __u32 devfn; 1220 __u32 flags; 1221 __u32 segnr; 1222 union { 1223 __u32 reserved[11]; 1224 }; 1225 }; 1226 #define KVM_DEV_IRQ_HOST_INTX (1 << 0) 1227 #define KVM_DEV_IRQ_HOST_MSI (1 << 1) 1228 #define KVM_DEV_IRQ_HOST_MSIX (1 << 2) 1229 #define KVM_DEV_IRQ_GUEST_INTX (1 << 8) 1230 #define KVM_DEV_IRQ_GUEST_MSI (1 << 9) 1231 #define KVM_DEV_IRQ_GUEST_MSIX (1 << 10) 1232 #define KVM_DEV_IRQ_HOST_MASK 0x00ff 1233 #define KVM_DEV_IRQ_GUEST_MASK 0xff00 1234 struct kvm_assigned_irq { 1235 __u32 assigned_dev_id; 1236 __u32 host_irq; 1237 __u32 guest_irq; 1238 __u32 flags; 1239 union { 1240 __u32 reserved[12]; 1241 }; 1242 }; 1243 struct kvm_assigned_msix_nr { 1244 __u32 assigned_dev_id; 1245 __u16 entry_nr; 1246 __u16 padding; 1247 }; 1248 #define KVM_MAX_MSIX_PER_DEV 256 1249 struct kvm_assigned_msix_entry { 1250 __u32 assigned_dev_id; 1251 __u32 gsi; 1252 __u16 entry; 1253 __u16 padding[3]; 1254 }; 1255 #define KVM_X2APIC_API_USE_32BIT_IDS (1ULL << 0) 1256 #define KVM_X2APIC_API_DISABLE_BROADCAST_QUIRK (1ULL << 1) 1257 #define KVM_ARM_DEV_EL1_VTIMER (1 << 0) 1258 #define KVM_ARM_DEV_EL1_PTIMER (1 << 1) 1259 #define KVM_ARM_DEV_PMU (1 << 2) 1260 struct kvm_hyperv_eventfd { 1261 __u32 conn_id; 1262 __s32 fd; 1263 __u32 flags; 1264 __u32 padding[3]; 1265 }; 1266 #define KVM_HYPERV_CONN_ID_MASK 0x00ffffff 1267 #define KVM_HYPERV_EVENTFD_DEASSIGN (1 << 0) 1268 #define KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE (1 << 0) 1269 #define KVM_DIRTY_LOG_INITIALLY_SET (1 << 1) 1270 #endif 1271