151b24e34SJan Kiszka #ifndef __LINUX_KVM_H 251b24e34SJan Kiszka #define __LINUX_KVM_H 351b24e34SJan Kiszka 451b24e34SJan Kiszka /* 551b24e34SJan Kiszka * Userspace interface for /dev/kvm - kernel based virtual machine 651b24e34SJan Kiszka * 751b24e34SJan Kiszka * Note: you must update KVM_API_VERSION if you change this interface. 851b24e34SJan Kiszka */ 951b24e34SJan Kiszka 1051b24e34SJan Kiszka #include <linux/types.h> 1151b24e34SJan Kiszka 1251b24e34SJan Kiszka #include <linux/ioctl.h> 1351b24e34SJan Kiszka #include <asm/kvm.h> 1451b24e34SJan Kiszka 1551b24e34SJan Kiszka #define KVM_API_VERSION 12 1651b24e34SJan Kiszka 1751b24e34SJan Kiszka /* *** Deprecated interfaces *** */ 1851b24e34SJan Kiszka 1951b24e34SJan Kiszka #define KVM_TRC_SHIFT 16 2051b24e34SJan Kiszka 2151b24e34SJan Kiszka #define KVM_TRC_ENTRYEXIT (1 << KVM_TRC_SHIFT) 2251b24e34SJan Kiszka #define KVM_TRC_HANDLER (1 << (KVM_TRC_SHIFT + 1)) 2351b24e34SJan Kiszka 2451b24e34SJan Kiszka #define KVM_TRC_VMENTRY (KVM_TRC_ENTRYEXIT + 0x01) 2551b24e34SJan Kiszka #define KVM_TRC_VMEXIT (KVM_TRC_ENTRYEXIT + 0x02) 2651b24e34SJan Kiszka #define KVM_TRC_PAGE_FAULT (KVM_TRC_HANDLER + 0x01) 2751b24e34SJan Kiszka 2851b24e34SJan Kiszka #define KVM_TRC_HEAD_SIZE 12 2951b24e34SJan Kiszka #define KVM_TRC_CYCLE_SIZE 8 3051b24e34SJan Kiszka #define KVM_TRC_EXTRA_MAX 7 3151b24e34SJan Kiszka 3251b24e34SJan Kiszka #define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02) 3351b24e34SJan Kiszka #define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03) 3451b24e34SJan Kiszka #define KVM_TRC_PEND_INTR (KVM_TRC_HANDLER + 0x04) 3551b24e34SJan Kiszka #define KVM_TRC_IO_READ (KVM_TRC_HANDLER + 0x05) 3651b24e34SJan Kiszka #define KVM_TRC_IO_WRITE (KVM_TRC_HANDLER + 0x06) 3751b24e34SJan Kiszka #define KVM_TRC_CR_READ (KVM_TRC_HANDLER + 0x07) 3851b24e34SJan Kiszka #define KVM_TRC_CR_WRITE (KVM_TRC_HANDLER + 0x08) 3951b24e34SJan Kiszka #define KVM_TRC_DR_READ (KVM_TRC_HANDLER + 0x09) 4051b24e34SJan Kiszka #define KVM_TRC_DR_WRITE (KVM_TRC_HANDLER + 0x0A) 4151b24e34SJan Kiszka #define KVM_TRC_MSR_READ (KVM_TRC_HANDLER + 0x0B) 4251b24e34SJan Kiszka #define KVM_TRC_MSR_WRITE (KVM_TRC_HANDLER + 0x0C) 4351b24e34SJan Kiszka #define KVM_TRC_CPUID (KVM_TRC_HANDLER + 0x0D) 4451b24e34SJan Kiszka #define KVM_TRC_INTR (KVM_TRC_HANDLER + 0x0E) 4551b24e34SJan Kiszka #define KVM_TRC_NMI (KVM_TRC_HANDLER + 0x0F) 4651b24e34SJan Kiszka #define KVM_TRC_VMMCALL (KVM_TRC_HANDLER + 0x10) 4751b24e34SJan Kiszka #define KVM_TRC_HLT (KVM_TRC_HANDLER + 0x11) 4851b24e34SJan Kiszka #define KVM_TRC_CLTS (KVM_TRC_HANDLER + 0x12) 4951b24e34SJan Kiszka #define KVM_TRC_LMSW (KVM_TRC_HANDLER + 0x13) 5051b24e34SJan Kiszka #define KVM_TRC_APIC_ACCESS (KVM_TRC_HANDLER + 0x14) 5151b24e34SJan Kiszka #define KVM_TRC_TDP_FAULT (KVM_TRC_HANDLER + 0x15) 5251b24e34SJan Kiszka #define KVM_TRC_GTLB_WRITE (KVM_TRC_HANDLER + 0x16) 5351b24e34SJan Kiszka #define KVM_TRC_STLB_WRITE (KVM_TRC_HANDLER + 0x17) 5451b24e34SJan Kiszka #define KVM_TRC_STLB_INVAL (KVM_TRC_HANDLER + 0x18) 5551b24e34SJan Kiszka #define KVM_TRC_PPC_INSTR (KVM_TRC_HANDLER + 0x19) 5651b24e34SJan Kiszka 5751b24e34SJan Kiszka struct kvm_user_trace_setup { 5851b24e34SJan Kiszka __u32 buf_size; 5951b24e34SJan Kiszka __u32 buf_nr; 6051b24e34SJan Kiszka }; 6151b24e34SJan Kiszka 6251b24e34SJan Kiszka #define __KVM_DEPRECATED_MAIN_W_0x06 \ 6351b24e34SJan Kiszka _IOW(KVMIO, 0x06, struct kvm_user_trace_setup) 6451b24e34SJan Kiszka #define __KVM_DEPRECATED_MAIN_0x07 _IO(KVMIO, 0x07) 6551b24e34SJan Kiszka #define __KVM_DEPRECATED_MAIN_0x08 _IO(KVMIO, 0x08) 6651b24e34SJan Kiszka 6751b24e34SJan Kiszka #define __KVM_DEPRECATED_VM_R_0x70 _IOR(KVMIO, 0x70, struct kvm_assigned_irq) 6851b24e34SJan Kiszka 6951b24e34SJan Kiszka struct kvm_breakpoint { 7051b24e34SJan Kiszka __u32 enabled; 7151b24e34SJan Kiszka __u32 padding; 7251b24e34SJan Kiszka __u64 address; 7351b24e34SJan Kiszka }; 7451b24e34SJan Kiszka 7551b24e34SJan Kiszka struct kvm_debug_guest { 7651b24e34SJan Kiszka __u32 enabled; 7751b24e34SJan Kiszka __u32 pad; 7851b24e34SJan Kiszka struct kvm_breakpoint breakpoints[4]; 7951b24e34SJan Kiszka __u32 singlestep; 8051b24e34SJan Kiszka }; 8151b24e34SJan Kiszka 8251b24e34SJan Kiszka #define __KVM_DEPRECATED_VCPU_W_0x87 _IOW(KVMIO, 0x87, struct kvm_debug_guest) 8351b24e34SJan Kiszka 8451b24e34SJan Kiszka /* *** End of deprecated interfaces *** */ 8551b24e34SJan Kiszka 8651b24e34SJan Kiszka 8751b24e34SJan Kiszka /* for KVM_CREATE_MEMORY_REGION */ 8851b24e34SJan Kiszka struct kvm_memory_region { 8951b24e34SJan Kiszka __u32 slot; 9051b24e34SJan Kiszka __u32 flags; 9151b24e34SJan Kiszka __u64 guest_phys_addr; 9251b24e34SJan Kiszka __u64 memory_size; /* bytes */ 9351b24e34SJan Kiszka }; 9451b24e34SJan Kiszka 9551b24e34SJan Kiszka /* for KVM_SET_USER_MEMORY_REGION */ 9651b24e34SJan Kiszka struct kvm_userspace_memory_region { 9751b24e34SJan Kiszka __u32 slot; 9851b24e34SJan Kiszka __u32 flags; 9951b24e34SJan Kiszka __u64 guest_phys_addr; 10051b24e34SJan Kiszka __u64 memory_size; /* bytes */ 10151b24e34SJan Kiszka __u64 userspace_addr; /* start of the userspace allocated memory */ 10251b24e34SJan Kiszka }; 10351b24e34SJan Kiszka 104*716b8e4dSAlex Williamson /* 105*716b8e4dSAlex Williamson * The bit 0 ~ bit 15 of kvm_memory_region::flags are visible for userspace, 106*716b8e4dSAlex Williamson * other bits are reserved for kvm internal use which are defined in 107*716b8e4dSAlex Williamson * include/linux/kvm_host.h. 108*716b8e4dSAlex Williamson */ 109*716b8e4dSAlex Williamson #define KVM_MEM_LOG_DIRTY_PAGES (1UL << 0) 110*716b8e4dSAlex Williamson #define KVM_MEM_READONLY (1UL << 1) 11151b24e34SJan Kiszka 11251b24e34SJan Kiszka /* for KVM_IRQ_LINE */ 11351b24e34SJan Kiszka struct kvm_irq_level { 11451b24e34SJan Kiszka /* 11551b24e34SJan Kiszka * ACPI gsi notion of irq. 11651b24e34SJan Kiszka * For IA-64 (APIC model) IOAPIC0: irq 0-23; IOAPIC1: irq 24-47.. 11751b24e34SJan Kiszka * For X86 (standard AT mode) PIC0/1: irq 0-15. IOAPIC0: 0-23.. 11851b24e34SJan Kiszka */ 11951b24e34SJan Kiszka union { 12051b24e34SJan Kiszka __u32 irq; 12151b24e34SJan Kiszka __s32 status; 12251b24e34SJan Kiszka }; 12351b24e34SJan Kiszka __u32 level; 12451b24e34SJan Kiszka }; 12551b24e34SJan Kiszka 12651b24e34SJan Kiszka 12751b24e34SJan Kiszka struct kvm_irqchip { 12851b24e34SJan Kiszka __u32 chip_id; 12951b24e34SJan Kiszka __u32 pad; 13051b24e34SJan Kiszka union { 13151b24e34SJan Kiszka char dummy[512]; /* reserving space */ 13251b24e34SJan Kiszka #ifdef __KVM_HAVE_PIT 13351b24e34SJan Kiszka struct kvm_pic_state pic; 13451b24e34SJan Kiszka #endif 13551b24e34SJan Kiszka #ifdef __KVM_HAVE_IOAPIC 13651b24e34SJan Kiszka struct kvm_ioapic_state ioapic; 13751b24e34SJan Kiszka #endif 13851b24e34SJan Kiszka } chip; 13951b24e34SJan Kiszka }; 14051b24e34SJan Kiszka 14151b24e34SJan Kiszka /* for KVM_CREATE_PIT2 */ 14251b24e34SJan Kiszka struct kvm_pit_config { 14351b24e34SJan Kiszka __u32 flags; 14451b24e34SJan Kiszka __u32 pad[15]; 14551b24e34SJan Kiszka }; 14651b24e34SJan Kiszka 14751b24e34SJan Kiszka #define KVM_PIT_SPEAKER_DUMMY 1 14851b24e34SJan Kiszka 14951b24e34SJan Kiszka #define KVM_EXIT_UNKNOWN 0 15051b24e34SJan Kiszka #define KVM_EXIT_EXCEPTION 1 15151b24e34SJan Kiszka #define KVM_EXIT_IO 2 15251b24e34SJan Kiszka #define KVM_EXIT_HYPERCALL 3 15351b24e34SJan Kiszka #define KVM_EXIT_DEBUG 4 15451b24e34SJan Kiszka #define KVM_EXIT_HLT 5 15551b24e34SJan Kiszka #define KVM_EXIT_MMIO 6 15651b24e34SJan Kiszka #define KVM_EXIT_IRQ_WINDOW_OPEN 7 15751b24e34SJan Kiszka #define KVM_EXIT_SHUTDOWN 8 15851b24e34SJan Kiszka #define KVM_EXIT_FAIL_ENTRY 9 15951b24e34SJan Kiszka #define KVM_EXIT_INTR 10 16051b24e34SJan Kiszka #define KVM_EXIT_SET_TPR 11 16151b24e34SJan Kiszka #define KVM_EXIT_TPR_ACCESS 12 16251b24e34SJan Kiszka #define KVM_EXIT_S390_SIEIC 13 16351b24e34SJan Kiszka #define KVM_EXIT_S390_RESET 14 16451b24e34SJan Kiszka #define KVM_EXIT_DCR 15 16551b24e34SJan Kiszka #define KVM_EXIT_NMI 16 16651b24e34SJan Kiszka #define KVM_EXIT_INTERNAL_ERROR 17 16751b24e34SJan Kiszka #define KVM_EXIT_OSI 18 1687c6da3deSAlexander Graf #define KVM_EXIT_PAPR_HCALL 19 1691529ae1bSAlexander Graf #define KVM_EXIT_S390_UCONTROL 20 17051b24e34SJan Kiszka 17151b24e34SJan Kiszka /* For KVM_EXIT_INTERNAL_ERROR */ 17251b24e34SJan Kiszka #define KVM_INTERNAL_ERROR_EMULATION 1 17351b24e34SJan Kiszka #define KVM_INTERNAL_ERROR_SIMUL_EX 2 17451b24e34SJan Kiszka 17551b24e34SJan Kiszka /* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */ 17651b24e34SJan Kiszka struct kvm_run { 17751b24e34SJan Kiszka /* in */ 17851b24e34SJan Kiszka __u8 request_interrupt_window; 17951b24e34SJan Kiszka __u8 padding1[7]; 18051b24e34SJan Kiszka 18151b24e34SJan Kiszka /* out */ 18251b24e34SJan Kiszka __u32 exit_reason; 18351b24e34SJan Kiszka __u8 ready_for_interrupt_injection; 18451b24e34SJan Kiszka __u8 if_flag; 18551b24e34SJan Kiszka __u8 padding2[2]; 18651b24e34SJan Kiszka 18751b24e34SJan Kiszka /* in (pre_kvm_run), out (post_kvm_run) */ 18851b24e34SJan Kiszka __u64 cr8; 18951b24e34SJan Kiszka __u64 apic_base; 19051b24e34SJan Kiszka 19151b24e34SJan Kiszka #ifdef __KVM_S390 19251b24e34SJan Kiszka /* the processor status word for s390 */ 19351b24e34SJan Kiszka __u64 psw_mask; /* psw upper half */ 19451b24e34SJan Kiszka __u64 psw_addr; /* psw lower half */ 19551b24e34SJan Kiszka #endif 19651b24e34SJan Kiszka union { 19751b24e34SJan Kiszka /* KVM_EXIT_UNKNOWN */ 19851b24e34SJan Kiszka struct { 19951b24e34SJan Kiszka __u64 hardware_exit_reason; 20051b24e34SJan Kiszka } hw; 20151b24e34SJan Kiszka /* KVM_EXIT_FAIL_ENTRY */ 20251b24e34SJan Kiszka struct { 20351b24e34SJan Kiszka __u64 hardware_entry_failure_reason; 20451b24e34SJan Kiszka } fail_entry; 20551b24e34SJan Kiszka /* KVM_EXIT_EXCEPTION */ 20651b24e34SJan Kiszka struct { 20751b24e34SJan Kiszka __u32 exception; 20851b24e34SJan Kiszka __u32 error_code; 20951b24e34SJan Kiszka } ex; 21051b24e34SJan Kiszka /* KVM_EXIT_IO */ 21151b24e34SJan Kiszka struct { 21251b24e34SJan Kiszka #define KVM_EXIT_IO_IN 0 21351b24e34SJan Kiszka #define KVM_EXIT_IO_OUT 1 21451b24e34SJan Kiszka __u8 direction; 21551b24e34SJan Kiszka __u8 size; /* bytes */ 21651b24e34SJan Kiszka __u16 port; 21751b24e34SJan Kiszka __u32 count; 21851b24e34SJan Kiszka __u64 data_offset; /* relative to kvm_run start */ 21951b24e34SJan Kiszka } io; 22051b24e34SJan Kiszka struct { 22151b24e34SJan Kiszka struct kvm_debug_exit_arch arch; 22251b24e34SJan Kiszka } debug; 22351b24e34SJan Kiszka /* KVM_EXIT_MMIO */ 22451b24e34SJan Kiszka struct { 22551b24e34SJan Kiszka __u64 phys_addr; 22651b24e34SJan Kiszka __u8 data[8]; 22751b24e34SJan Kiszka __u32 len; 22851b24e34SJan Kiszka __u8 is_write; 22951b24e34SJan Kiszka } mmio; 23051b24e34SJan Kiszka /* KVM_EXIT_HYPERCALL */ 23151b24e34SJan Kiszka struct { 23251b24e34SJan Kiszka __u64 nr; 23351b24e34SJan Kiszka __u64 args[6]; 23451b24e34SJan Kiszka __u64 ret; 23551b24e34SJan Kiszka __u32 longmode; 23651b24e34SJan Kiszka __u32 pad; 23751b24e34SJan Kiszka } hypercall; 23851b24e34SJan Kiszka /* KVM_EXIT_TPR_ACCESS */ 23951b24e34SJan Kiszka struct { 24051b24e34SJan Kiszka __u64 rip; 24151b24e34SJan Kiszka __u32 is_write; 24251b24e34SJan Kiszka __u32 pad; 24351b24e34SJan Kiszka } tpr_access; 24451b24e34SJan Kiszka /* KVM_EXIT_S390_SIEIC */ 24551b24e34SJan Kiszka struct { 24651b24e34SJan Kiszka __u8 icptcode; 24751b24e34SJan Kiszka __u16 ipa; 24851b24e34SJan Kiszka __u32 ipb; 24951b24e34SJan Kiszka } s390_sieic; 25051b24e34SJan Kiszka /* KVM_EXIT_S390_RESET */ 25151b24e34SJan Kiszka #define KVM_S390_RESET_POR 1 25251b24e34SJan Kiszka #define KVM_S390_RESET_CLEAR 2 25351b24e34SJan Kiszka #define KVM_S390_RESET_SUBSYSTEM 4 25451b24e34SJan Kiszka #define KVM_S390_RESET_CPU_INIT 8 25551b24e34SJan Kiszka #define KVM_S390_RESET_IPL 16 25651b24e34SJan Kiszka __u64 s390_reset_flags; 2571529ae1bSAlexander Graf /* KVM_EXIT_S390_UCONTROL */ 2581529ae1bSAlexander Graf struct { 2591529ae1bSAlexander Graf __u64 trans_exc_code; 2601529ae1bSAlexander Graf __u32 pgm_code; 2611529ae1bSAlexander Graf } s390_ucontrol; 26251b24e34SJan Kiszka /* KVM_EXIT_DCR */ 26351b24e34SJan Kiszka struct { 26451b24e34SJan Kiszka __u32 dcrn; 26551b24e34SJan Kiszka __u32 data; 26651b24e34SJan Kiszka __u8 is_write; 26751b24e34SJan Kiszka } dcr; 26851b24e34SJan Kiszka struct { 26951b24e34SJan Kiszka __u32 suberror; 27051b24e34SJan Kiszka /* Available with KVM_CAP_INTERNAL_ERROR_DATA: */ 27151b24e34SJan Kiszka __u32 ndata; 27251b24e34SJan Kiszka __u64 data[16]; 27351b24e34SJan Kiszka } internal; 27451b24e34SJan Kiszka /* KVM_EXIT_OSI */ 27551b24e34SJan Kiszka struct { 27651b24e34SJan Kiszka __u64 gprs[32]; 27751b24e34SJan Kiszka } osi; 2787c6da3deSAlexander Graf struct { 2797c6da3deSAlexander Graf __u64 nr; 2807c6da3deSAlexander Graf __u64 ret; 2817c6da3deSAlexander Graf __u64 args[9]; 2827c6da3deSAlexander Graf } papr_hcall; 28351b24e34SJan Kiszka /* Fix the size of the union. */ 28451b24e34SJan Kiszka char padding[256]; 28551b24e34SJan Kiszka }; 2861529ae1bSAlexander Graf 2871529ae1bSAlexander Graf /* 2881529ae1bSAlexander Graf * shared registers between kvm and userspace. 2891529ae1bSAlexander Graf * kvm_valid_regs specifies the register classes set by the host 2901529ae1bSAlexander Graf * kvm_dirty_regs specified the register classes dirtied by userspace 2911529ae1bSAlexander Graf * struct kvm_sync_regs is architecture specific, as well as the 2921529ae1bSAlexander Graf * bits for kvm_valid_regs and kvm_dirty_regs 2931529ae1bSAlexander Graf */ 2941529ae1bSAlexander Graf __u64 kvm_valid_regs; 2951529ae1bSAlexander Graf __u64 kvm_dirty_regs; 2961529ae1bSAlexander Graf union { 2971529ae1bSAlexander Graf struct kvm_sync_regs regs; 2981529ae1bSAlexander Graf char padding[1024]; 2991529ae1bSAlexander Graf } s; 30051b24e34SJan Kiszka }; 30151b24e34SJan Kiszka 30251b24e34SJan Kiszka /* for KVM_REGISTER_COALESCED_MMIO / KVM_UNREGISTER_COALESCED_MMIO */ 30351b24e34SJan Kiszka 30451b24e34SJan Kiszka struct kvm_coalesced_mmio_zone { 30551b24e34SJan Kiszka __u64 addr; 30651b24e34SJan Kiszka __u32 size; 30751b24e34SJan Kiszka __u32 pad; 30851b24e34SJan Kiszka }; 30951b24e34SJan Kiszka 31051b24e34SJan Kiszka struct kvm_coalesced_mmio { 31151b24e34SJan Kiszka __u64 phys_addr; 31251b24e34SJan Kiszka __u32 len; 31351b24e34SJan Kiszka __u32 pad; 31451b24e34SJan Kiszka __u8 data[8]; 31551b24e34SJan Kiszka }; 31651b24e34SJan Kiszka 31751b24e34SJan Kiszka struct kvm_coalesced_mmio_ring { 31851b24e34SJan Kiszka __u32 first, last; 31951b24e34SJan Kiszka struct kvm_coalesced_mmio coalesced_mmio[0]; 32051b24e34SJan Kiszka }; 32151b24e34SJan Kiszka 32251b24e34SJan Kiszka #define KVM_COALESCED_MMIO_MAX \ 32351b24e34SJan Kiszka ((PAGE_SIZE - sizeof(struct kvm_coalesced_mmio_ring)) / \ 32451b24e34SJan Kiszka sizeof(struct kvm_coalesced_mmio)) 32551b24e34SJan Kiszka 32651b24e34SJan Kiszka /* for KVM_TRANSLATE */ 32751b24e34SJan Kiszka struct kvm_translation { 32851b24e34SJan Kiszka /* in */ 32951b24e34SJan Kiszka __u64 linear_address; 33051b24e34SJan Kiszka 33151b24e34SJan Kiszka /* out */ 33251b24e34SJan Kiszka __u64 physical_address; 33351b24e34SJan Kiszka __u8 valid; 33451b24e34SJan Kiszka __u8 writeable; 33551b24e34SJan Kiszka __u8 usermode; 33651b24e34SJan Kiszka __u8 pad[5]; 33751b24e34SJan Kiszka }; 33851b24e34SJan Kiszka 33951b24e34SJan Kiszka /* for KVM_INTERRUPT */ 34051b24e34SJan Kiszka struct kvm_interrupt { 34151b24e34SJan Kiszka /* in */ 34251b24e34SJan Kiszka __u32 irq; 34351b24e34SJan Kiszka }; 34451b24e34SJan Kiszka 34551b24e34SJan Kiszka /* for KVM_GET_DIRTY_LOG */ 34651b24e34SJan Kiszka struct kvm_dirty_log { 34751b24e34SJan Kiszka __u32 slot; 34851b24e34SJan Kiszka __u32 padding1; 34951b24e34SJan Kiszka union { 35051b24e34SJan Kiszka void *dirty_bitmap; /* one bit per page */ 35151b24e34SJan Kiszka __u64 padding2; 35251b24e34SJan Kiszka }; 35351b24e34SJan Kiszka }; 35451b24e34SJan Kiszka 35551b24e34SJan Kiszka /* for KVM_SET_SIGNAL_MASK */ 35651b24e34SJan Kiszka struct kvm_signal_mask { 35751b24e34SJan Kiszka __u32 len; 35851b24e34SJan Kiszka __u8 sigset[0]; 35951b24e34SJan Kiszka }; 36051b24e34SJan Kiszka 36151b24e34SJan Kiszka /* for KVM_TPR_ACCESS_REPORTING */ 36251b24e34SJan Kiszka struct kvm_tpr_access_ctl { 36351b24e34SJan Kiszka __u32 enabled; 36451b24e34SJan Kiszka __u32 flags; 36551b24e34SJan Kiszka __u32 reserved[8]; 36651b24e34SJan Kiszka }; 36751b24e34SJan Kiszka 36851b24e34SJan Kiszka /* for KVM_SET_VAPIC_ADDR */ 36951b24e34SJan Kiszka struct kvm_vapic_addr { 37051b24e34SJan Kiszka __u64 vapic_addr; 37151b24e34SJan Kiszka }; 37251b24e34SJan Kiszka 37351b24e34SJan Kiszka /* for KVM_SET_MPSTATE */ 37451b24e34SJan Kiszka 37551b24e34SJan Kiszka #define KVM_MP_STATE_RUNNABLE 0 37651b24e34SJan Kiszka #define KVM_MP_STATE_UNINITIALIZED 1 37751b24e34SJan Kiszka #define KVM_MP_STATE_INIT_RECEIVED 2 37851b24e34SJan Kiszka #define KVM_MP_STATE_HALTED 3 37951b24e34SJan Kiszka #define KVM_MP_STATE_SIPI_RECEIVED 4 38051b24e34SJan Kiszka 38151b24e34SJan Kiszka struct kvm_mp_state { 38251b24e34SJan Kiszka __u32 mp_state; 38351b24e34SJan Kiszka }; 38451b24e34SJan Kiszka 38551b24e34SJan Kiszka struct kvm_s390_psw { 38651b24e34SJan Kiszka __u64 mask; 38751b24e34SJan Kiszka __u64 addr; 38851b24e34SJan Kiszka }; 38951b24e34SJan Kiszka 39051b24e34SJan Kiszka /* valid values for type in kvm_s390_interrupt */ 39151b24e34SJan Kiszka #define KVM_S390_SIGP_STOP 0xfffe0000u 39251b24e34SJan Kiszka #define KVM_S390_PROGRAM_INT 0xfffe0001u 39351b24e34SJan Kiszka #define KVM_S390_SIGP_SET_PREFIX 0xfffe0002u 39451b24e34SJan Kiszka #define KVM_S390_RESTART 0xfffe0003u 39551b24e34SJan Kiszka #define KVM_S390_INT_VIRTIO 0xffff2603u 39651b24e34SJan Kiszka #define KVM_S390_INT_SERVICE 0xffff2401u 39751b24e34SJan Kiszka #define KVM_S390_INT_EMERGENCY 0xffff1201u 3981529ae1bSAlexander Graf #define KVM_S390_INT_EXTERNAL_CALL 0xffff1202u 39951b24e34SJan Kiszka 40051b24e34SJan Kiszka struct kvm_s390_interrupt { 40151b24e34SJan Kiszka __u32 type; 40251b24e34SJan Kiszka __u32 parm; 40351b24e34SJan Kiszka __u64 parm64; 40451b24e34SJan Kiszka }; 40551b24e34SJan Kiszka 40651b24e34SJan Kiszka /* for KVM_SET_GUEST_DEBUG */ 40751b24e34SJan Kiszka 40851b24e34SJan Kiszka #define KVM_GUESTDBG_ENABLE 0x00000001 40951b24e34SJan Kiszka #define KVM_GUESTDBG_SINGLESTEP 0x00000002 41051b24e34SJan Kiszka 41151b24e34SJan Kiszka struct kvm_guest_debug { 41251b24e34SJan Kiszka __u32 control; 41351b24e34SJan Kiszka __u32 pad; 41451b24e34SJan Kiszka struct kvm_guest_debug_arch arch; 41551b24e34SJan Kiszka }; 41651b24e34SJan Kiszka 41751b24e34SJan Kiszka enum { 41851b24e34SJan Kiszka kvm_ioeventfd_flag_nr_datamatch, 41951b24e34SJan Kiszka kvm_ioeventfd_flag_nr_pio, 42051b24e34SJan Kiszka kvm_ioeventfd_flag_nr_deassign, 42151b24e34SJan Kiszka kvm_ioeventfd_flag_nr_max, 42251b24e34SJan Kiszka }; 42351b24e34SJan Kiszka 42451b24e34SJan Kiszka #define KVM_IOEVENTFD_FLAG_DATAMATCH (1 << kvm_ioeventfd_flag_nr_datamatch) 42551b24e34SJan Kiszka #define KVM_IOEVENTFD_FLAG_PIO (1 << kvm_ioeventfd_flag_nr_pio) 42651b24e34SJan Kiszka #define KVM_IOEVENTFD_FLAG_DEASSIGN (1 << kvm_ioeventfd_flag_nr_deassign) 42751b24e34SJan Kiszka 42851b24e34SJan Kiszka #define KVM_IOEVENTFD_VALID_FLAG_MASK ((1 << kvm_ioeventfd_flag_nr_max) - 1) 42951b24e34SJan Kiszka 43051b24e34SJan Kiszka struct kvm_ioeventfd { 43151b24e34SJan Kiszka __u64 datamatch; 43251b24e34SJan Kiszka __u64 addr; /* legal pio/mmio address */ 43351b24e34SJan Kiszka __u32 len; /* 1, 2, 4, or 8 bytes */ 43451b24e34SJan Kiszka __s32 fd; 43551b24e34SJan Kiszka __u32 flags; 43651b24e34SJan Kiszka __u8 pad[36]; 43751b24e34SJan Kiszka }; 43851b24e34SJan Kiszka 43951b24e34SJan Kiszka /* for KVM_ENABLE_CAP */ 44051b24e34SJan Kiszka struct kvm_enable_cap { 44151b24e34SJan Kiszka /* in */ 44251b24e34SJan Kiszka __u32 cap; 44351b24e34SJan Kiszka __u32 flags; 44451b24e34SJan Kiszka __u64 args[4]; 44551b24e34SJan Kiszka __u8 pad[64]; 44651b24e34SJan Kiszka }; 44751b24e34SJan Kiszka 44851b24e34SJan Kiszka /* for KVM_PPC_GET_PVINFO */ 44951b24e34SJan Kiszka struct kvm_ppc_pvinfo { 45051b24e34SJan Kiszka /* out */ 45151b24e34SJan Kiszka __u32 flags; 45251b24e34SJan Kiszka __u32 hcall[4]; 45351b24e34SJan Kiszka __u8 pad[108]; 45451b24e34SJan Kiszka }; 45551b24e34SJan Kiszka 45680a3eb10SJan Kiszka /* for KVM_PPC_GET_SMMU_INFO */ 45780a3eb10SJan Kiszka #define KVM_PPC_PAGE_SIZES_MAX_SZ 8 45880a3eb10SJan Kiszka 45980a3eb10SJan Kiszka struct kvm_ppc_one_page_size { 46080a3eb10SJan Kiszka __u32 page_shift; /* Page shift (or 0) */ 46180a3eb10SJan Kiszka __u32 pte_enc; /* Encoding in the HPTE (>>12) */ 46280a3eb10SJan Kiszka }; 46380a3eb10SJan Kiszka 46480a3eb10SJan Kiszka struct kvm_ppc_one_seg_page_size { 46580a3eb10SJan Kiszka __u32 page_shift; /* Base page shift of segment (or 0) */ 46680a3eb10SJan Kiszka __u32 slb_enc; /* SLB encoding for BookS */ 46780a3eb10SJan Kiszka struct kvm_ppc_one_page_size enc[KVM_PPC_PAGE_SIZES_MAX_SZ]; 46880a3eb10SJan Kiszka }; 46980a3eb10SJan Kiszka 47080a3eb10SJan Kiszka #define KVM_PPC_PAGE_SIZES_REAL 0x00000001 47180a3eb10SJan Kiszka #define KVM_PPC_1T_SEGMENTS 0x00000002 47280a3eb10SJan Kiszka 47380a3eb10SJan Kiszka struct kvm_ppc_smmu_info { 47480a3eb10SJan Kiszka __u64 flags; 47580a3eb10SJan Kiszka __u32 slb_size; 47680a3eb10SJan Kiszka __u32 pad; 47780a3eb10SJan Kiszka struct kvm_ppc_one_seg_page_size sps[KVM_PPC_PAGE_SIZES_MAX_SZ]; 47880a3eb10SJan Kiszka }; 47980a3eb10SJan Kiszka 48051b24e34SJan Kiszka #define KVMIO 0xAE 48151b24e34SJan Kiszka 4821529ae1bSAlexander Graf /* machine type bits, to be used as argument to KVM_CREATE_VM */ 4831529ae1bSAlexander Graf #define KVM_VM_S390_UCONTROL 1 4841529ae1bSAlexander Graf 4851529ae1bSAlexander Graf #define KVM_S390_SIE_PAGE_OFFSET 1 4861529ae1bSAlexander Graf 48751b24e34SJan Kiszka /* 48851b24e34SJan Kiszka * ioctls for /dev/kvm fds: 48951b24e34SJan Kiszka */ 49051b24e34SJan Kiszka #define KVM_GET_API_VERSION _IO(KVMIO, 0x00) 49151b24e34SJan Kiszka #define KVM_CREATE_VM _IO(KVMIO, 0x01) /* returns a VM fd */ 49251b24e34SJan Kiszka #define KVM_GET_MSR_INDEX_LIST _IOWR(KVMIO, 0x02, struct kvm_msr_list) 49351b24e34SJan Kiszka 49451b24e34SJan Kiszka #define KVM_S390_ENABLE_SIE _IO(KVMIO, 0x06) 49551b24e34SJan Kiszka /* 49651b24e34SJan Kiszka * Check if a kvm extension is available. Argument is extension number, 49751b24e34SJan Kiszka * return is 1 (yes) or 0 (no, sorry). 49851b24e34SJan Kiszka */ 49951b24e34SJan Kiszka #define KVM_CHECK_EXTENSION _IO(KVMIO, 0x03) 50051b24e34SJan Kiszka /* 50151b24e34SJan Kiszka * Get size for mmap(vcpu_fd) 50251b24e34SJan Kiszka */ 50351b24e34SJan Kiszka #define KVM_GET_VCPU_MMAP_SIZE _IO(KVMIO, 0x04) /* in bytes */ 50451b24e34SJan Kiszka #define KVM_GET_SUPPORTED_CPUID _IOWR(KVMIO, 0x05, struct kvm_cpuid2) 50551b24e34SJan Kiszka #define KVM_TRACE_ENABLE __KVM_DEPRECATED_MAIN_W_0x06 50651b24e34SJan Kiszka #define KVM_TRACE_PAUSE __KVM_DEPRECATED_MAIN_0x07 50751b24e34SJan Kiszka #define KVM_TRACE_DISABLE __KVM_DEPRECATED_MAIN_0x08 50851b24e34SJan Kiszka 50951b24e34SJan Kiszka /* 51051b24e34SJan Kiszka * Extension capability list. 51151b24e34SJan Kiszka */ 51251b24e34SJan Kiszka #define KVM_CAP_IRQCHIP 0 51351b24e34SJan Kiszka #define KVM_CAP_HLT 1 51451b24e34SJan Kiszka #define KVM_CAP_MMU_SHADOW_CACHE_CONTROL 2 51551b24e34SJan Kiszka #define KVM_CAP_USER_MEMORY 3 51651b24e34SJan Kiszka #define KVM_CAP_SET_TSS_ADDR 4 51751b24e34SJan Kiszka #define KVM_CAP_VAPIC 6 51851b24e34SJan Kiszka #define KVM_CAP_EXT_CPUID 7 51951b24e34SJan Kiszka #define KVM_CAP_CLOCKSOURCE 8 5207c6da3deSAlexander Graf #define KVM_CAP_NR_VCPUS 9 /* returns recommended max vcpus per vm */ 52151b24e34SJan Kiszka #define KVM_CAP_NR_MEMSLOTS 10 /* returns max memory slots per vm */ 52251b24e34SJan Kiszka #define KVM_CAP_PIT 11 52351b24e34SJan Kiszka #define KVM_CAP_NOP_IO_DELAY 12 52451b24e34SJan Kiszka #define KVM_CAP_PV_MMU 13 52551b24e34SJan Kiszka #define KVM_CAP_MP_STATE 14 52651b24e34SJan Kiszka #define KVM_CAP_COALESCED_MMIO 15 52751b24e34SJan Kiszka #define KVM_CAP_SYNC_MMU 16 /* Changes to host mmap are reflected in guest */ 52851b24e34SJan Kiszka #ifdef __KVM_HAVE_DEVICE_ASSIGNMENT 52951b24e34SJan Kiszka #define KVM_CAP_DEVICE_ASSIGNMENT 17 53051b24e34SJan Kiszka #endif 53151b24e34SJan Kiszka #define KVM_CAP_IOMMU 18 53251b24e34SJan Kiszka #ifdef __KVM_HAVE_MSI 53351b24e34SJan Kiszka #define KVM_CAP_DEVICE_MSI 20 53451b24e34SJan Kiszka #endif 53551b24e34SJan Kiszka /* Bug in KVM_SET_USER_MEMORY_REGION fixed: */ 53651b24e34SJan Kiszka #define KVM_CAP_DESTROY_MEMORY_REGION_WORKS 21 53751b24e34SJan Kiszka #ifdef __KVM_HAVE_USER_NMI 53851b24e34SJan Kiszka #define KVM_CAP_USER_NMI 22 53951b24e34SJan Kiszka #endif 54051b24e34SJan Kiszka #ifdef __KVM_HAVE_GUEST_DEBUG 54151b24e34SJan Kiszka #define KVM_CAP_SET_GUEST_DEBUG 23 54251b24e34SJan Kiszka #endif 54351b24e34SJan Kiszka #ifdef __KVM_HAVE_PIT 54451b24e34SJan Kiszka #define KVM_CAP_REINJECT_CONTROL 24 54551b24e34SJan Kiszka #endif 54651b24e34SJan Kiszka #ifdef __KVM_HAVE_IOAPIC 54751b24e34SJan Kiszka #define KVM_CAP_IRQ_ROUTING 25 54851b24e34SJan Kiszka #endif 54951b24e34SJan Kiszka #define KVM_CAP_IRQ_INJECT_STATUS 26 55051b24e34SJan Kiszka #ifdef __KVM_HAVE_DEVICE_ASSIGNMENT 55151b24e34SJan Kiszka #define KVM_CAP_DEVICE_DEASSIGNMENT 27 55251b24e34SJan Kiszka #endif 55351b24e34SJan Kiszka #ifdef __KVM_HAVE_MSIX 55451b24e34SJan Kiszka #define KVM_CAP_DEVICE_MSIX 28 55551b24e34SJan Kiszka #endif 55651b24e34SJan Kiszka #define KVM_CAP_ASSIGN_DEV_IRQ 29 55751b24e34SJan Kiszka /* Another bug in KVM_SET_USER_MEMORY_REGION fixed: */ 55851b24e34SJan Kiszka #define KVM_CAP_JOIN_MEMORY_REGIONS_WORKS 30 55951b24e34SJan Kiszka #ifdef __KVM_HAVE_MCE 56051b24e34SJan Kiszka #define KVM_CAP_MCE 31 56151b24e34SJan Kiszka #endif 56251b24e34SJan Kiszka #define KVM_CAP_IRQFD 32 56351b24e34SJan Kiszka #ifdef __KVM_HAVE_PIT 56451b24e34SJan Kiszka #define KVM_CAP_PIT2 33 56551b24e34SJan Kiszka #endif 56651b24e34SJan Kiszka #define KVM_CAP_SET_BOOT_CPU_ID 34 56751b24e34SJan Kiszka #ifdef __KVM_HAVE_PIT_STATE2 56851b24e34SJan Kiszka #define KVM_CAP_PIT_STATE2 35 56951b24e34SJan Kiszka #endif 57051b24e34SJan Kiszka #define KVM_CAP_IOEVENTFD 36 57151b24e34SJan Kiszka #define KVM_CAP_SET_IDENTITY_MAP_ADDR 37 57251b24e34SJan Kiszka #ifdef __KVM_HAVE_XEN_HVM 57351b24e34SJan Kiszka #define KVM_CAP_XEN_HVM 38 57451b24e34SJan Kiszka #endif 57551b24e34SJan Kiszka #define KVM_CAP_ADJUST_CLOCK 39 57651b24e34SJan Kiszka #define KVM_CAP_INTERNAL_ERROR_DATA 40 57751b24e34SJan Kiszka #ifdef __KVM_HAVE_VCPU_EVENTS 57851b24e34SJan Kiszka #define KVM_CAP_VCPU_EVENTS 41 57951b24e34SJan Kiszka #endif 58051b24e34SJan Kiszka #define KVM_CAP_S390_PSW 42 58151b24e34SJan Kiszka #define KVM_CAP_PPC_SEGSTATE 43 58251b24e34SJan Kiszka #define KVM_CAP_HYPERV 44 58351b24e34SJan Kiszka #define KVM_CAP_HYPERV_VAPIC 45 58451b24e34SJan Kiszka #define KVM_CAP_HYPERV_SPIN 46 58551b24e34SJan Kiszka #define KVM_CAP_PCI_SEGMENT 47 58651b24e34SJan Kiszka #define KVM_CAP_PPC_PAIRED_SINGLES 48 58751b24e34SJan Kiszka #define KVM_CAP_INTR_SHADOW 49 58851b24e34SJan Kiszka #ifdef __KVM_HAVE_DEBUGREGS 58951b24e34SJan Kiszka #define KVM_CAP_DEBUGREGS 50 59051b24e34SJan Kiszka #endif 59151b24e34SJan Kiszka #define KVM_CAP_X86_ROBUST_SINGLESTEP 51 59251b24e34SJan Kiszka #define KVM_CAP_PPC_OSI 52 59351b24e34SJan Kiszka #define KVM_CAP_PPC_UNSET_IRQ 53 59451b24e34SJan Kiszka #define KVM_CAP_ENABLE_CAP 54 59551b24e34SJan Kiszka #ifdef __KVM_HAVE_XSAVE 59651b24e34SJan Kiszka #define KVM_CAP_XSAVE 55 59751b24e34SJan Kiszka #endif 59851b24e34SJan Kiszka #ifdef __KVM_HAVE_XCRS 59951b24e34SJan Kiszka #define KVM_CAP_XCRS 56 60051b24e34SJan Kiszka #endif 60151b24e34SJan Kiszka #define KVM_CAP_PPC_GET_PVINFO 57 60251b24e34SJan Kiszka #define KVM_CAP_PPC_IRQ_LEVEL 58 60351b24e34SJan Kiszka #define KVM_CAP_ASYNC_PF 59 60451b24e34SJan Kiszka #define KVM_CAP_TSC_CONTROL 60 60551b24e34SJan Kiszka #define KVM_CAP_GET_TSC_KHZ 61 60651b24e34SJan Kiszka #define KVM_CAP_PPC_BOOKE_SREGS 62 6077c6da3deSAlexander Graf #define KVM_CAP_SPAPR_TCE 63 6087c6da3deSAlexander Graf #define KVM_CAP_PPC_SMT 64 6097c6da3deSAlexander Graf #define KVM_CAP_PPC_RMA 65 6107c6da3deSAlexander Graf #define KVM_CAP_MAX_VCPUS 66 /* returns max vcpus per vm */ 6119d4e4f8cSAlexander Graf #define KVM_CAP_PPC_HIOR 67 6127c6da3deSAlexander Graf #define KVM_CAP_PPC_PAPR 68 613a54fc080SAlexander Graf #define KVM_CAP_SW_TLB 69 6149d4e4f8cSAlexander Graf #define KVM_CAP_ONE_REG 70 6151529ae1bSAlexander Graf #define KVM_CAP_S390_GMAP 71 6161529ae1bSAlexander Graf #define KVM_CAP_TSC_DEADLINE_TIMER 72 6171529ae1bSAlexander Graf #define KVM_CAP_S390_UCONTROL 73 6181529ae1bSAlexander Graf #define KVM_CAP_SYNC_REGS 74 6199ab2195dSMarcelo Tosatti #define KVM_CAP_PCI_2_3 75 6209ab2195dSMarcelo Tosatti #define KVM_CAP_KVMCLOCK_CTRL 76 62180a3eb10SJan Kiszka #define KVM_CAP_SIGNAL_MSI 77 62280a3eb10SJan Kiszka #define KVM_CAP_PPC_GET_SMMU_INFO 78 6232a60dba4SAlexander Graf #define KVM_CAP_S390_COW 79 624651682dcSMichael S. Tsirkin #define KVM_CAP_PPC_ALLOC_HTAB 80 625*716b8e4dSAlex Williamson #ifdef __KVM_HAVE_READONLY_MEM 626*716b8e4dSAlex Williamson #define KVM_CAP_READONLY_MEM 81 627*716b8e4dSAlex Williamson #endif 628*716b8e4dSAlex Williamson #define KVM_CAP_IRQFD_RESAMPLE 82 62951b24e34SJan Kiszka 63051b24e34SJan Kiszka #ifdef KVM_CAP_IRQ_ROUTING 63151b24e34SJan Kiszka 63251b24e34SJan Kiszka struct kvm_irq_routing_irqchip { 63351b24e34SJan Kiszka __u32 irqchip; 63451b24e34SJan Kiszka __u32 pin; 63551b24e34SJan Kiszka }; 63651b24e34SJan Kiszka 63751b24e34SJan Kiszka struct kvm_irq_routing_msi { 63851b24e34SJan Kiszka __u32 address_lo; 63951b24e34SJan Kiszka __u32 address_hi; 64051b24e34SJan Kiszka __u32 data; 64151b24e34SJan Kiszka __u32 pad; 64251b24e34SJan Kiszka }; 64351b24e34SJan Kiszka 64451b24e34SJan Kiszka /* gsi routing entry types */ 64551b24e34SJan Kiszka #define KVM_IRQ_ROUTING_IRQCHIP 1 64651b24e34SJan Kiszka #define KVM_IRQ_ROUTING_MSI 2 64751b24e34SJan Kiszka 64851b24e34SJan Kiszka struct kvm_irq_routing_entry { 64951b24e34SJan Kiszka __u32 gsi; 65051b24e34SJan Kiszka __u32 type; 65151b24e34SJan Kiszka __u32 flags; 65251b24e34SJan Kiszka __u32 pad; 65351b24e34SJan Kiszka union { 65451b24e34SJan Kiszka struct kvm_irq_routing_irqchip irqchip; 65551b24e34SJan Kiszka struct kvm_irq_routing_msi msi; 65651b24e34SJan Kiszka __u32 pad[8]; 65751b24e34SJan Kiszka } u; 65851b24e34SJan Kiszka }; 65951b24e34SJan Kiszka 66051b24e34SJan Kiszka struct kvm_irq_routing { 66151b24e34SJan Kiszka __u32 nr; 66251b24e34SJan Kiszka __u32 flags; 66351b24e34SJan Kiszka struct kvm_irq_routing_entry entries[0]; 66451b24e34SJan Kiszka }; 66551b24e34SJan Kiszka 66651b24e34SJan Kiszka #endif 66751b24e34SJan Kiszka 66851b24e34SJan Kiszka #ifdef KVM_CAP_MCE 66951b24e34SJan Kiszka /* x86 MCE */ 67051b24e34SJan Kiszka struct kvm_x86_mce { 67151b24e34SJan Kiszka __u64 status; 67251b24e34SJan Kiszka __u64 addr; 67351b24e34SJan Kiszka __u64 misc; 67451b24e34SJan Kiszka __u64 mcg_status; 67551b24e34SJan Kiszka __u8 bank; 67651b24e34SJan Kiszka __u8 pad1[7]; 67751b24e34SJan Kiszka __u64 pad2[3]; 67851b24e34SJan Kiszka }; 67951b24e34SJan Kiszka #endif 68051b24e34SJan Kiszka 68151b24e34SJan Kiszka #ifdef KVM_CAP_XEN_HVM 68251b24e34SJan Kiszka struct kvm_xen_hvm_config { 68351b24e34SJan Kiszka __u32 flags; 68451b24e34SJan Kiszka __u32 msr; 68551b24e34SJan Kiszka __u64 blob_addr_32; 68651b24e34SJan Kiszka __u64 blob_addr_64; 68751b24e34SJan Kiszka __u8 blob_size_32; 68851b24e34SJan Kiszka __u8 blob_size_64; 68951b24e34SJan Kiszka __u8 pad2[30]; 69051b24e34SJan Kiszka }; 69151b24e34SJan Kiszka #endif 69251b24e34SJan Kiszka 69351b24e34SJan Kiszka #define KVM_IRQFD_FLAG_DEASSIGN (1 << 0) 694*716b8e4dSAlex Williamson /* 695*716b8e4dSAlex Williamson * Available with KVM_CAP_IRQFD_RESAMPLE 696*716b8e4dSAlex Williamson * 697*716b8e4dSAlex Williamson * KVM_IRQFD_FLAG_RESAMPLE indicates resamplefd is valid and specifies 698*716b8e4dSAlex Williamson * the irqfd to operate in resampling mode for level triggered interrupt 699*716b8e4dSAlex Williamson * emlation. See Documentation/virtual/kvm/api.txt. 700*716b8e4dSAlex Williamson */ 701*716b8e4dSAlex Williamson #define KVM_IRQFD_FLAG_RESAMPLE (1 << 1) 70251b24e34SJan Kiszka 70351b24e34SJan Kiszka struct kvm_irqfd { 70451b24e34SJan Kiszka __u32 fd; 70551b24e34SJan Kiszka __u32 gsi; 70651b24e34SJan Kiszka __u32 flags; 707*716b8e4dSAlex Williamson __u32 resamplefd; 708*716b8e4dSAlex Williamson __u8 pad[16]; 70951b24e34SJan Kiszka }; 71051b24e34SJan Kiszka 71151b24e34SJan Kiszka struct kvm_clock_data { 71251b24e34SJan Kiszka __u64 clock; 71351b24e34SJan Kiszka __u32 flags; 71451b24e34SJan Kiszka __u32 pad[9]; 71551b24e34SJan Kiszka }; 71651b24e34SJan Kiszka 717a54fc080SAlexander Graf #define KVM_MMU_FSL_BOOKE_NOHV 0 718a54fc080SAlexander Graf #define KVM_MMU_FSL_BOOKE_HV 1 719a54fc080SAlexander Graf 720a54fc080SAlexander Graf struct kvm_config_tlb { 721a54fc080SAlexander Graf __u64 params; 722a54fc080SAlexander Graf __u64 array; 723a54fc080SAlexander Graf __u32 mmu_type; 724a54fc080SAlexander Graf __u32 array_len; 725a54fc080SAlexander Graf }; 726a54fc080SAlexander Graf 727a54fc080SAlexander Graf struct kvm_dirty_tlb { 728a54fc080SAlexander Graf __u64 bitmap; 729a54fc080SAlexander Graf __u32 num_dirty; 730a54fc080SAlexander Graf }; 731a54fc080SAlexander Graf 7329d4e4f8cSAlexander Graf /* Available with KVM_CAP_ONE_REG */ 7339d4e4f8cSAlexander Graf 734a31be480SAlexander Graf #define KVM_REG_ARCH_MASK 0xff00000000000000ULL 735a31be480SAlexander Graf #define KVM_REG_GENERIC 0x0000000000000000ULL 7369d4e4f8cSAlexander Graf 7379d4e4f8cSAlexander Graf /* 7389d4e4f8cSAlexander Graf * Architecture specific registers are to be defined in arch headers and 7399d4e4f8cSAlexander Graf * ORed with the arch identifier. 7409d4e4f8cSAlexander Graf */ 741a31be480SAlexander Graf #define KVM_REG_PPC 0x1000000000000000ULL 742a31be480SAlexander Graf #define KVM_REG_X86 0x2000000000000000ULL 743a31be480SAlexander Graf #define KVM_REG_IA64 0x3000000000000000ULL 744a31be480SAlexander Graf #define KVM_REG_ARM 0x4000000000000000ULL 745a31be480SAlexander Graf #define KVM_REG_S390 0x5000000000000000ULL 746a31be480SAlexander Graf 747a31be480SAlexander Graf #define KVM_REG_SIZE_SHIFT 52 748a31be480SAlexander Graf #define KVM_REG_SIZE_MASK 0x00f0000000000000ULL 749a31be480SAlexander Graf #define KVM_REG_SIZE_U8 0x0000000000000000ULL 750a31be480SAlexander Graf #define KVM_REG_SIZE_U16 0x0010000000000000ULL 751a31be480SAlexander Graf #define KVM_REG_SIZE_U32 0x0020000000000000ULL 752a31be480SAlexander Graf #define KVM_REG_SIZE_U64 0x0030000000000000ULL 753a31be480SAlexander Graf #define KVM_REG_SIZE_U128 0x0040000000000000ULL 754a31be480SAlexander Graf #define KVM_REG_SIZE_U256 0x0050000000000000ULL 755a31be480SAlexander Graf #define KVM_REG_SIZE_U512 0x0060000000000000ULL 756a31be480SAlexander Graf #define KVM_REG_SIZE_U1024 0x0070000000000000ULL 7579d4e4f8cSAlexander Graf 7589d4e4f8cSAlexander Graf struct kvm_one_reg { 7599d4e4f8cSAlexander Graf __u64 id; 760a31be480SAlexander Graf __u64 addr; 7619d4e4f8cSAlexander Graf }; 7629d4e4f8cSAlexander Graf 76380a3eb10SJan Kiszka struct kvm_msi { 76480a3eb10SJan Kiszka __u32 address_lo; 76580a3eb10SJan Kiszka __u32 address_hi; 76680a3eb10SJan Kiszka __u32 data; 76780a3eb10SJan Kiszka __u32 flags; 76880a3eb10SJan Kiszka __u8 pad[16]; 76980a3eb10SJan Kiszka }; 77080a3eb10SJan Kiszka 77151b24e34SJan Kiszka /* 77251b24e34SJan Kiszka * ioctls for VM fds 77351b24e34SJan Kiszka */ 77451b24e34SJan Kiszka #define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region) 77551b24e34SJan Kiszka /* 77651b24e34SJan Kiszka * KVM_CREATE_VCPU receives as a parameter the vcpu slot, and returns 77751b24e34SJan Kiszka * a vcpu fd. 77851b24e34SJan Kiszka */ 77951b24e34SJan Kiszka #define KVM_CREATE_VCPU _IO(KVMIO, 0x41) 78051b24e34SJan Kiszka #define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log) 78151b24e34SJan Kiszka /* KVM_SET_MEMORY_ALIAS is obsolete: */ 78251b24e34SJan Kiszka #define KVM_SET_MEMORY_ALIAS _IOW(KVMIO, 0x43, struct kvm_memory_alias) 78351b24e34SJan Kiszka #define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44) 78451b24e34SJan Kiszka #define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45) 78551b24e34SJan Kiszka #define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46, \ 78651b24e34SJan Kiszka struct kvm_userspace_memory_region) 78751b24e34SJan Kiszka #define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47) 78851b24e34SJan Kiszka #define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO, 0x48, __u64) 7891529ae1bSAlexander Graf 7901529ae1bSAlexander Graf /* enable ucontrol for s390 */ 7911529ae1bSAlexander Graf struct kvm_s390_ucas_mapping { 7921529ae1bSAlexander Graf __u64 user_addr; 7931529ae1bSAlexander Graf __u64 vcpu_addr; 7941529ae1bSAlexander Graf __u64 length; 7951529ae1bSAlexander Graf }; 7961529ae1bSAlexander Graf #define KVM_S390_UCAS_MAP _IOW(KVMIO, 0x50, struct kvm_s390_ucas_mapping) 7971529ae1bSAlexander Graf #define KVM_S390_UCAS_UNMAP _IOW(KVMIO, 0x51, struct kvm_s390_ucas_mapping) 7981529ae1bSAlexander Graf #define KVM_S390_VCPU_FAULT _IOW(KVMIO, 0x52, unsigned long) 7991529ae1bSAlexander Graf 80051b24e34SJan Kiszka /* Device model IOC */ 80151b24e34SJan Kiszka #define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60) 80251b24e34SJan Kiszka #define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level) 80351b24e34SJan Kiszka #define KVM_GET_IRQCHIP _IOWR(KVMIO, 0x62, struct kvm_irqchip) 80451b24e34SJan Kiszka #define KVM_SET_IRQCHIP _IOR(KVMIO, 0x63, struct kvm_irqchip) 80551b24e34SJan Kiszka #define KVM_CREATE_PIT _IO(KVMIO, 0x64) 80651b24e34SJan Kiszka #define KVM_GET_PIT _IOWR(KVMIO, 0x65, struct kvm_pit_state) 80751b24e34SJan Kiszka #define KVM_SET_PIT _IOR(KVMIO, 0x66, struct kvm_pit_state) 80851b24e34SJan Kiszka #define KVM_IRQ_LINE_STATUS _IOWR(KVMIO, 0x67, struct kvm_irq_level) 80951b24e34SJan Kiszka #define KVM_REGISTER_COALESCED_MMIO \ 81051b24e34SJan Kiszka _IOW(KVMIO, 0x67, struct kvm_coalesced_mmio_zone) 81151b24e34SJan Kiszka #define KVM_UNREGISTER_COALESCED_MMIO \ 81251b24e34SJan Kiszka _IOW(KVMIO, 0x68, struct kvm_coalesced_mmio_zone) 81351b24e34SJan Kiszka #define KVM_ASSIGN_PCI_DEVICE _IOR(KVMIO, 0x69, \ 81451b24e34SJan Kiszka struct kvm_assigned_pci_dev) 81551b24e34SJan Kiszka #define KVM_SET_GSI_ROUTING _IOW(KVMIO, 0x6a, struct kvm_irq_routing) 81651b24e34SJan Kiszka /* deprecated, replaced by KVM_ASSIGN_DEV_IRQ */ 81751b24e34SJan Kiszka #define KVM_ASSIGN_IRQ __KVM_DEPRECATED_VM_R_0x70 81851b24e34SJan Kiszka #define KVM_ASSIGN_DEV_IRQ _IOW(KVMIO, 0x70, struct kvm_assigned_irq) 81951b24e34SJan Kiszka #define KVM_REINJECT_CONTROL _IO(KVMIO, 0x71) 82051b24e34SJan Kiszka #define KVM_DEASSIGN_PCI_DEVICE _IOW(KVMIO, 0x72, \ 82151b24e34SJan Kiszka struct kvm_assigned_pci_dev) 82251b24e34SJan Kiszka #define KVM_ASSIGN_SET_MSIX_NR _IOW(KVMIO, 0x73, \ 82351b24e34SJan Kiszka struct kvm_assigned_msix_nr) 82451b24e34SJan Kiszka #define KVM_ASSIGN_SET_MSIX_ENTRY _IOW(KVMIO, 0x74, \ 82551b24e34SJan Kiszka struct kvm_assigned_msix_entry) 82651b24e34SJan Kiszka #define KVM_DEASSIGN_DEV_IRQ _IOW(KVMIO, 0x75, struct kvm_assigned_irq) 82751b24e34SJan Kiszka #define KVM_IRQFD _IOW(KVMIO, 0x76, struct kvm_irqfd) 82851b24e34SJan Kiszka #define KVM_CREATE_PIT2 _IOW(KVMIO, 0x77, struct kvm_pit_config) 82951b24e34SJan Kiszka #define KVM_SET_BOOT_CPU_ID _IO(KVMIO, 0x78) 83051b24e34SJan Kiszka #define KVM_IOEVENTFD _IOW(KVMIO, 0x79, struct kvm_ioeventfd) 83151b24e34SJan Kiszka #define KVM_XEN_HVM_CONFIG _IOW(KVMIO, 0x7a, struct kvm_xen_hvm_config) 83251b24e34SJan Kiszka #define KVM_SET_CLOCK _IOW(KVMIO, 0x7b, struct kvm_clock_data) 83351b24e34SJan Kiszka #define KVM_GET_CLOCK _IOR(KVMIO, 0x7c, struct kvm_clock_data) 83451b24e34SJan Kiszka /* Available with KVM_CAP_PIT_STATE2 */ 83551b24e34SJan Kiszka #define KVM_GET_PIT2 _IOR(KVMIO, 0x9f, struct kvm_pit_state2) 83651b24e34SJan Kiszka #define KVM_SET_PIT2 _IOW(KVMIO, 0xa0, struct kvm_pit_state2) 83751b24e34SJan Kiszka /* Available with KVM_CAP_PPC_GET_PVINFO */ 83851b24e34SJan Kiszka #define KVM_PPC_GET_PVINFO _IOW(KVMIO, 0xa1, struct kvm_ppc_pvinfo) 83951b24e34SJan Kiszka /* Available with KVM_CAP_TSC_CONTROL */ 84051b24e34SJan Kiszka #define KVM_SET_TSC_KHZ _IO(KVMIO, 0xa2) 84151b24e34SJan Kiszka #define KVM_GET_TSC_KHZ _IO(KVMIO, 0xa3) 8429ab2195dSMarcelo Tosatti /* Available with KVM_CAP_PCI_2_3 */ 8439ab2195dSMarcelo Tosatti #define KVM_ASSIGN_SET_INTX_MASK _IOW(KVMIO, 0xa4, \ 8449ab2195dSMarcelo Tosatti struct kvm_assigned_pci_dev) 84580a3eb10SJan Kiszka /* Available with KVM_CAP_SIGNAL_MSI */ 84680a3eb10SJan Kiszka #define KVM_SIGNAL_MSI _IOW(KVMIO, 0xa5, struct kvm_msi) 84780a3eb10SJan Kiszka /* Available with KVM_CAP_PPC_GET_SMMU_INFO */ 84880a3eb10SJan Kiszka #define KVM_PPC_GET_SMMU_INFO _IOR(KVMIO, 0xa6, struct kvm_ppc_smmu_info) 849651682dcSMichael S. Tsirkin /* Available with KVM_CAP_PPC_ALLOC_HTAB */ 850651682dcSMichael S. Tsirkin #define KVM_PPC_ALLOCATE_HTAB _IOWR(KVMIO, 0xa7, __u32) 85151b24e34SJan Kiszka 85251b24e34SJan Kiszka /* 85351b24e34SJan Kiszka * ioctls for vcpu fds 85451b24e34SJan Kiszka */ 85551b24e34SJan Kiszka #define KVM_RUN _IO(KVMIO, 0x80) 85651b24e34SJan Kiszka #define KVM_GET_REGS _IOR(KVMIO, 0x81, struct kvm_regs) 85751b24e34SJan Kiszka #define KVM_SET_REGS _IOW(KVMIO, 0x82, struct kvm_regs) 85851b24e34SJan Kiszka #define KVM_GET_SREGS _IOR(KVMIO, 0x83, struct kvm_sregs) 85951b24e34SJan Kiszka #define KVM_SET_SREGS _IOW(KVMIO, 0x84, struct kvm_sregs) 86051b24e34SJan Kiszka #define KVM_TRANSLATE _IOWR(KVMIO, 0x85, struct kvm_translation) 86151b24e34SJan Kiszka #define KVM_INTERRUPT _IOW(KVMIO, 0x86, struct kvm_interrupt) 86251b24e34SJan Kiszka /* KVM_DEBUG_GUEST is no longer supported, use KVM_SET_GUEST_DEBUG instead */ 86351b24e34SJan Kiszka #define KVM_DEBUG_GUEST __KVM_DEPRECATED_VCPU_W_0x87 86451b24e34SJan Kiszka #define KVM_GET_MSRS _IOWR(KVMIO, 0x88, struct kvm_msrs) 86551b24e34SJan Kiszka #define KVM_SET_MSRS _IOW(KVMIO, 0x89, struct kvm_msrs) 86651b24e34SJan Kiszka #define KVM_SET_CPUID _IOW(KVMIO, 0x8a, struct kvm_cpuid) 86751b24e34SJan Kiszka #define KVM_SET_SIGNAL_MASK _IOW(KVMIO, 0x8b, struct kvm_signal_mask) 86851b24e34SJan Kiszka #define KVM_GET_FPU _IOR(KVMIO, 0x8c, struct kvm_fpu) 86951b24e34SJan Kiszka #define KVM_SET_FPU _IOW(KVMIO, 0x8d, struct kvm_fpu) 87051b24e34SJan Kiszka #define KVM_GET_LAPIC _IOR(KVMIO, 0x8e, struct kvm_lapic_state) 87151b24e34SJan Kiszka #define KVM_SET_LAPIC _IOW(KVMIO, 0x8f, struct kvm_lapic_state) 87251b24e34SJan Kiszka #define KVM_SET_CPUID2 _IOW(KVMIO, 0x90, struct kvm_cpuid2) 87351b24e34SJan Kiszka #define KVM_GET_CPUID2 _IOWR(KVMIO, 0x91, struct kvm_cpuid2) 87451b24e34SJan Kiszka /* Available with KVM_CAP_VAPIC */ 87551b24e34SJan Kiszka #define KVM_TPR_ACCESS_REPORTING _IOWR(KVMIO, 0x92, struct kvm_tpr_access_ctl) 87651b24e34SJan Kiszka /* Available with KVM_CAP_VAPIC */ 87751b24e34SJan Kiszka #define KVM_SET_VAPIC_ADDR _IOW(KVMIO, 0x93, struct kvm_vapic_addr) 87851b24e34SJan Kiszka /* valid for virtual machine (for floating interrupt)_and_ vcpu */ 87951b24e34SJan Kiszka #define KVM_S390_INTERRUPT _IOW(KVMIO, 0x94, struct kvm_s390_interrupt) 88051b24e34SJan Kiszka /* store status for s390 */ 88151b24e34SJan Kiszka #define KVM_S390_STORE_STATUS_NOADDR (-1ul) 88251b24e34SJan Kiszka #define KVM_S390_STORE_STATUS_PREFIXED (-2ul) 88351b24e34SJan Kiszka #define KVM_S390_STORE_STATUS _IOW(KVMIO, 0x95, unsigned long) 88451b24e34SJan Kiszka /* initial ipl psw for s390 */ 88551b24e34SJan Kiszka #define KVM_S390_SET_INITIAL_PSW _IOW(KVMIO, 0x96, struct kvm_s390_psw) 88651b24e34SJan Kiszka /* initial reset for s390 */ 88751b24e34SJan Kiszka #define KVM_S390_INITIAL_RESET _IO(KVMIO, 0x97) 88851b24e34SJan Kiszka #define KVM_GET_MP_STATE _IOR(KVMIO, 0x98, struct kvm_mp_state) 88951b24e34SJan Kiszka #define KVM_SET_MP_STATE _IOW(KVMIO, 0x99, struct kvm_mp_state) 89051b24e34SJan Kiszka /* Available with KVM_CAP_NMI */ 89151b24e34SJan Kiszka #define KVM_NMI _IO(KVMIO, 0x9a) 89251b24e34SJan Kiszka /* Available with KVM_CAP_SET_GUEST_DEBUG */ 89351b24e34SJan Kiszka #define KVM_SET_GUEST_DEBUG _IOW(KVMIO, 0x9b, struct kvm_guest_debug) 89451b24e34SJan Kiszka /* MCE for x86 */ 89551b24e34SJan Kiszka #define KVM_X86_SETUP_MCE _IOW(KVMIO, 0x9c, __u64) 89651b24e34SJan Kiszka #define KVM_X86_GET_MCE_CAP_SUPPORTED _IOR(KVMIO, 0x9d, __u64) 89751b24e34SJan Kiszka #define KVM_X86_SET_MCE _IOW(KVMIO, 0x9e, struct kvm_x86_mce) 89851b24e34SJan Kiszka /* IA64 stack access */ 89951b24e34SJan Kiszka #define KVM_IA64_VCPU_GET_STACK _IOR(KVMIO, 0x9a, void *) 90051b24e34SJan Kiszka #define KVM_IA64_VCPU_SET_STACK _IOW(KVMIO, 0x9b, void *) 90151b24e34SJan Kiszka /* Available with KVM_CAP_VCPU_EVENTS */ 90251b24e34SJan Kiszka #define KVM_GET_VCPU_EVENTS _IOR(KVMIO, 0x9f, struct kvm_vcpu_events) 90351b24e34SJan Kiszka #define KVM_SET_VCPU_EVENTS _IOW(KVMIO, 0xa0, struct kvm_vcpu_events) 90451b24e34SJan Kiszka /* Available with KVM_CAP_DEBUGREGS */ 90551b24e34SJan Kiszka #define KVM_GET_DEBUGREGS _IOR(KVMIO, 0xa1, struct kvm_debugregs) 90651b24e34SJan Kiszka #define KVM_SET_DEBUGREGS _IOW(KVMIO, 0xa2, struct kvm_debugregs) 90751b24e34SJan Kiszka #define KVM_ENABLE_CAP _IOW(KVMIO, 0xa3, struct kvm_enable_cap) 90851b24e34SJan Kiszka /* Available with KVM_CAP_XSAVE */ 90951b24e34SJan Kiszka #define KVM_GET_XSAVE _IOR(KVMIO, 0xa4, struct kvm_xsave) 91051b24e34SJan Kiszka #define KVM_SET_XSAVE _IOW(KVMIO, 0xa5, struct kvm_xsave) 91151b24e34SJan Kiszka /* Available with KVM_CAP_XCRS */ 91251b24e34SJan Kiszka #define KVM_GET_XCRS _IOR(KVMIO, 0xa6, struct kvm_xcrs) 91351b24e34SJan Kiszka #define KVM_SET_XCRS _IOW(KVMIO, 0xa7, struct kvm_xcrs) 9147c6da3deSAlexander Graf #define KVM_CREATE_SPAPR_TCE _IOW(KVMIO, 0xa8, struct kvm_create_spapr_tce) 9157c6da3deSAlexander Graf /* Available with KVM_CAP_RMA */ 9167c6da3deSAlexander Graf #define KVM_ALLOCATE_RMA _IOR(KVMIO, 0xa9, struct kvm_allocate_rma) 917a54fc080SAlexander Graf /* Available with KVM_CAP_SW_TLB */ 918a54fc080SAlexander Graf #define KVM_DIRTY_TLB _IOW(KVMIO, 0xaa, struct kvm_dirty_tlb) 9199d4e4f8cSAlexander Graf /* Available with KVM_CAP_ONE_REG */ 920a31be480SAlexander Graf #define KVM_GET_ONE_REG _IOW(KVMIO, 0xab, struct kvm_one_reg) 9219d4e4f8cSAlexander Graf #define KVM_SET_ONE_REG _IOW(KVMIO, 0xac, struct kvm_one_reg) 9229ab2195dSMarcelo Tosatti /* VM is being stopped by host */ 9239ab2195dSMarcelo Tosatti #define KVM_KVMCLOCK_CTRL _IO(KVMIO, 0xad) 92451b24e34SJan Kiszka 92551b24e34SJan Kiszka #define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) 9269ab2195dSMarcelo Tosatti #define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1) 9279ab2195dSMarcelo Tosatti #define KVM_DEV_ASSIGN_MASK_INTX (1 << 2) 92851b24e34SJan Kiszka 92951b24e34SJan Kiszka struct kvm_assigned_pci_dev { 93051b24e34SJan Kiszka __u32 assigned_dev_id; 93151b24e34SJan Kiszka __u32 busnr; 93251b24e34SJan Kiszka __u32 devfn; 93351b24e34SJan Kiszka __u32 flags; 93451b24e34SJan Kiszka __u32 segnr; 93551b24e34SJan Kiszka union { 93651b24e34SJan Kiszka __u32 reserved[11]; 93751b24e34SJan Kiszka }; 93851b24e34SJan Kiszka }; 93951b24e34SJan Kiszka 94051b24e34SJan Kiszka #define KVM_DEV_IRQ_HOST_INTX (1 << 0) 94151b24e34SJan Kiszka #define KVM_DEV_IRQ_HOST_MSI (1 << 1) 94251b24e34SJan Kiszka #define KVM_DEV_IRQ_HOST_MSIX (1 << 2) 94351b24e34SJan Kiszka 94451b24e34SJan Kiszka #define KVM_DEV_IRQ_GUEST_INTX (1 << 8) 94551b24e34SJan Kiszka #define KVM_DEV_IRQ_GUEST_MSI (1 << 9) 94651b24e34SJan Kiszka #define KVM_DEV_IRQ_GUEST_MSIX (1 << 10) 94751b24e34SJan Kiszka 94851b24e34SJan Kiszka #define KVM_DEV_IRQ_HOST_MASK 0x00ff 94951b24e34SJan Kiszka #define KVM_DEV_IRQ_GUEST_MASK 0xff00 95051b24e34SJan Kiszka 95151b24e34SJan Kiszka struct kvm_assigned_irq { 95251b24e34SJan Kiszka __u32 assigned_dev_id; 9537c6da3deSAlexander Graf __u32 host_irq; /* ignored (legacy field) */ 95451b24e34SJan Kiszka __u32 guest_irq; 95551b24e34SJan Kiszka __u32 flags; 95651b24e34SJan Kiszka union { 95751b24e34SJan Kiszka __u32 reserved[12]; 95851b24e34SJan Kiszka }; 95951b24e34SJan Kiszka }; 96051b24e34SJan Kiszka 96151b24e34SJan Kiszka struct kvm_assigned_msix_nr { 96251b24e34SJan Kiszka __u32 assigned_dev_id; 96351b24e34SJan Kiszka __u16 entry_nr; 96451b24e34SJan Kiszka __u16 padding; 96551b24e34SJan Kiszka }; 96651b24e34SJan Kiszka 96751b24e34SJan Kiszka #define KVM_MAX_MSIX_PER_DEV 256 96851b24e34SJan Kiszka struct kvm_assigned_msix_entry { 96951b24e34SJan Kiszka __u32 assigned_dev_id; 97051b24e34SJan Kiszka __u32 gsi; 97151b24e34SJan Kiszka __u16 entry; /* The index of entry in the MSI-X table */ 97251b24e34SJan Kiszka __u16 padding[3]; 97351b24e34SJan Kiszka }; 97451b24e34SJan Kiszka 97551b24e34SJan Kiszka #endif /* __LINUX_KVM_H */ 976