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 _UAPIVFIO_H 20 #define _UAPIVFIO_H 21 #include <linux/types.h> 22 #include <linux/ioctl.h> 23 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 24 #define VFIO_API_VERSION 0 25 #define VFIO_TYPE1_IOMMU 1 26 #define VFIO_SPAPR_TCE_IOMMU 2 27 #define VFIO_TYPE (';') 28 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 29 #define VFIO_BASE 100 30 #define VFIO_GET_API_VERSION _IO(VFIO_TYPE, VFIO_BASE + 0) 31 #define VFIO_CHECK_EXTENSION _IO(VFIO_TYPE, VFIO_BASE + 1) 32 #define VFIO_SET_IOMMU _IO(VFIO_TYPE, VFIO_BASE + 2) 33 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 34 struct vfio_group_status { 35 __u32 argsz; 36 __u32 flags; 37 #define VFIO_GROUP_FLAGS_VIABLE (1 << 0) 38 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 39 #define VFIO_GROUP_FLAGS_CONTAINER_SET (1 << 1) 40 }; 41 #define VFIO_GROUP_GET_STATUS _IO(VFIO_TYPE, VFIO_BASE + 3) 42 #define VFIO_GROUP_SET_CONTAINER _IO(VFIO_TYPE, VFIO_BASE + 4) 43 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 44 #define VFIO_GROUP_UNSET_CONTAINER _IO(VFIO_TYPE, VFIO_BASE + 5) 45 #define VFIO_GROUP_GET_DEVICE_FD _IO(VFIO_TYPE, VFIO_BASE + 6) 46 struct vfio_device_info { 47 __u32 argsz; 48 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 49 __u32 flags; 50 #define VFIO_DEVICE_FLAGS_RESET (1 << 0) 51 #define VFIO_DEVICE_FLAGS_PCI (1 << 1) 52 __u32 num_regions; 53 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 54 __u32 num_irqs; 55 }; 56 #define VFIO_DEVICE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 7) 57 struct vfio_region_info { 58 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 59 __u32 argsz; 60 __u32 flags; 61 #define VFIO_REGION_INFO_FLAG_READ (1 << 0) 62 #define VFIO_REGION_INFO_FLAG_WRITE (1 << 1) 63 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 64 #define VFIO_REGION_INFO_FLAG_MMAP (1 << 2) 65 __u32 index; 66 __u32 resv; 67 __u64 size; 68 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 69 __u64 offset; 70 }; 71 #define VFIO_DEVICE_GET_REGION_INFO _IO(VFIO_TYPE, VFIO_BASE + 8) 72 struct vfio_irq_info { 73 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 74 __u32 argsz; 75 __u32 flags; 76 #define VFIO_IRQ_INFO_EVENTFD (1 << 0) 77 #define VFIO_IRQ_INFO_MASKABLE (1 << 1) 78 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 79 #define VFIO_IRQ_INFO_AUTOMASKED (1 << 2) 80 #define VFIO_IRQ_INFO_NORESIZE (1 << 3) 81 __u32 index; 82 __u32 count; 83 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 84 }; 85 #define VFIO_DEVICE_GET_IRQ_INFO _IO(VFIO_TYPE, VFIO_BASE + 9) 86 struct vfio_irq_set { 87 __u32 argsz; 88 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 89 __u32 flags; 90 #define VFIO_IRQ_SET_DATA_NONE (1 << 0) 91 #define VFIO_IRQ_SET_DATA_BOOL (1 << 1) 92 #define VFIO_IRQ_SET_DATA_EVENTFD (1 << 2) 93 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 94 #define VFIO_IRQ_SET_ACTION_MASK (1 << 3) 95 #define VFIO_IRQ_SET_ACTION_UNMASK (1 << 4) 96 #define VFIO_IRQ_SET_ACTION_TRIGGER (1 << 5) 97 __u32 index; 98 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 99 __u32 start; 100 __u32 count; 101 __u8 data[]; 102 }; 103 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 104 #define VFIO_DEVICE_SET_IRQS _IO(VFIO_TYPE, VFIO_BASE + 10) 105 #define VFIO_IRQ_SET_DATA_TYPE_MASK (VFIO_IRQ_SET_DATA_NONE | VFIO_IRQ_SET_DATA_BOOL | VFIO_IRQ_SET_DATA_EVENTFD) 106 #define VFIO_IRQ_SET_ACTION_TYPE_MASK (VFIO_IRQ_SET_ACTION_MASK | VFIO_IRQ_SET_ACTION_UNMASK | VFIO_IRQ_SET_ACTION_TRIGGER) 107 #define VFIO_DEVICE_RESET _IO(VFIO_TYPE, VFIO_BASE + 11) 108 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 109 enum { 110 VFIO_PCI_BAR0_REGION_INDEX, 111 VFIO_PCI_BAR1_REGION_INDEX, 112 VFIO_PCI_BAR2_REGION_INDEX, 113 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 114 VFIO_PCI_BAR3_REGION_INDEX, 115 VFIO_PCI_BAR4_REGION_INDEX, 116 VFIO_PCI_BAR5_REGION_INDEX, 117 VFIO_PCI_ROM_REGION_INDEX, 118 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 119 VFIO_PCI_CONFIG_REGION_INDEX, 120 VFIO_PCI_VGA_REGION_INDEX, 121 VFIO_PCI_NUM_REGIONS 122 }; 123 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 124 enum { 125 VFIO_PCI_INTX_IRQ_INDEX, 126 VFIO_PCI_MSI_IRQ_INDEX, 127 VFIO_PCI_MSIX_IRQ_INDEX, 128 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 129 VFIO_PCI_ERR_IRQ_INDEX, 130 VFIO_PCI_NUM_IRQS 131 }; 132 struct vfio_pci_dependent_device { 133 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 134 __u32 group_id; 135 __u16 segment; 136 __u8 bus; 137 __u8 devfn; 138 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 139 }; 140 struct vfio_pci_hot_reset_info { 141 __u32 argsz; 142 __u32 flags; 143 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 144 __u32 count; 145 struct vfio_pci_dependent_device devices[]; 146 }; 147 #define VFIO_DEVICE_GET_PCI_HOT_RESET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12) 148 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 149 struct vfio_pci_hot_reset { 150 __u32 argsz; 151 __u32 flags; 152 __u32 count; 153 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 154 __s32 group_fds[]; 155 }; 156 #define VFIO_DEVICE_PCI_HOT_RESET _IO(VFIO_TYPE, VFIO_BASE + 13) 157 struct vfio_iommu_type1_info { 158 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 159 __u32 argsz; 160 __u32 flags; 161 #define VFIO_IOMMU_INFO_PGSIZES (1 << 0) 162 __u64 iova_pgsizes; 163 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 164 }; 165 #define VFIO_IOMMU_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12) 166 struct vfio_iommu_type1_dma_map { 167 __u32 argsz; 168 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 169 __u32 flags; 170 #define VFIO_DMA_MAP_FLAG_READ (1 << 0) 171 #define VFIO_DMA_MAP_FLAG_WRITE (1 << 1) 172 __u64 vaddr; 173 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 174 __u64 iova; 175 __u64 size; 176 }; 177 #define VFIO_IOMMU_MAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 13) 178 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 179 struct vfio_iommu_type1_dma_unmap { 180 __u32 argsz; 181 __u32 flags; 182 __u64 iova; 183 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 184 __u64 size; 185 }; 186 #define VFIO_IOMMU_UNMAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 14) 187 #define VFIO_IOMMU_ENABLE _IO(VFIO_TYPE, VFIO_BASE + 15) 188 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 189 #define VFIO_IOMMU_DISABLE _IO(VFIO_TYPE, VFIO_BASE + 16) 190 struct vfio_iommu_spapr_tce_info { 191 __u32 argsz; 192 __u32 flags; 193 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 194 __u32 dma32_window_start; 195 __u32 dma32_window_size; 196 }; 197 #define VFIO_IOMMU_SPAPR_TCE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12) 198 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 199 #endif 200