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_TYPE1v2_IOMMU 3 28 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 29 #define VFIO_DMA_CC_IOMMU 4 30 #define VFIO_EEH 5 31 #define VFIO_TYPE1_NESTING_IOMMU 6 32 #define VFIO_SPAPR_TCE_v2_IOMMU 7 33 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 34 #define VFIO_TYPE (';') 35 #define VFIO_BASE 100 36 #define VFIO_GET_API_VERSION _IO(VFIO_TYPE, VFIO_BASE + 0) 37 #define VFIO_CHECK_EXTENSION _IO(VFIO_TYPE, VFIO_BASE + 1) 38 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 39 #define VFIO_SET_IOMMU _IO(VFIO_TYPE, VFIO_BASE + 2) 40 struct vfio_group_status { 41 __u32 argsz; 42 __u32 flags; 43 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 44 #define VFIO_GROUP_FLAGS_VIABLE (1 << 0) 45 #define VFIO_GROUP_FLAGS_CONTAINER_SET (1 << 1) 46 }; 47 #define VFIO_GROUP_GET_STATUS _IO(VFIO_TYPE, VFIO_BASE + 3) 48 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 49 #define VFIO_GROUP_SET_CONTAINER _IO(VFIO_TYPE, VFIO_BASE + 4) 50 #define VFIO_GROUP_UNSET_CONTAINER _IO(VFIO_TYPE, VFIO_BASE + 5) 51 #define VFIO_GROUP_GET_DEVICE_FD _IO(VFIO_TYPE, VFIO_BASE + 6) 52 struct vfio_device_info { 53 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 54 __u32 argsz; 55 __u32 flags; 56 #define VFIO_DEVICE_FLAGS_RESET (1 << 0) 57 #define VFIO_DEVICE_FLAGS_PCI (1 << 1) 58 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 59 #define VFIO_DEVICE_FLAGS_PLATFORM (1 << 2) 60 #define VFIO_DEVICE_FLAGS_AMBA (1 << 3) 61 __u32 num_regions; 62 __u32 num_irqs; 63 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 64 }; 65 #define VFIO_DEVICE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 7) 66 struct vfio_region_info { 67 __u32 argsz; 68 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 69 __u32 flags; 70 #define VFIO_REGION_INFO_FLAG_READ (1 << 0) 71 #define VFIO_REGION_INFO_FLAG_WRITE (1 << 1) 72 #define VFIO_REGION_INFO_FLAG_MMAP (1 << 2) 73 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 74 __u32 index; 75 __u32 resv; 76 __u64 size; 77 __u64 offset; 78 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 79 }; 80 #define VFIO_DEVICE_GET_REGION_INFO _IO(VFIO_TYPE, VFIO_BASE + 8) 81 struct vfio_irq_info { 82 __u32 argsz; 83 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 84 __u32 flags; 85 #define VFIO_IRQ_INFO_EVENTFD (1 << 0) 86 #define VFIO_IRQ_INFO_MASKABLE (1 << 1) 87 #define VFIO_IRQ_INFO_AUTOMASKED (1 << 2) 88 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 89 #define VFIO_IRQ_INFO_NORESIZE (1 << 3) 90 __u32 index; 91 __u32 count; 92 }; 93 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 94 #define VFIO_DEVICE_GET_IRQ_INFO _IO(VFIO_TYPE, VFIO_BASE + 9) 95 struct vfio_irq_set { 96 __u32 argsz; 97 __u32 flags; 98 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 99 #define VFIO_IRQ_SET_DATA_NONE (1 << 0) 100 #define VFIO_IRQ_SET_DATA_BOOL (1 << 1) 101 #define VFIO_IRQ_SET_DATA_EVENTFD (1 << 2) 102 #define VFIO_IRQ_SET_ACTION_MASK (1 << 3) 103 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 104 #define VFIO_IRQ_SET_ACTION_UNMASK (1 << 4) 105 #define VFIO_IRQ_SET_ACTION_TRIGGER (1 << 5) 106 __u32 index; 107 __u32 start; 108 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 109 __u32 count; 110 __u8 data[]; 111 }; 112 #define VFIO_DEVICE_SET_IRQS _IO(VFIO_TYPE, VFIO_BASE + 10) 113 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 114 #define VFIO_IRQ_SET_DATA_TYPE_MASK (VFIO_IRQ_SET_DATA_NONE | VFIO_IRQ_SET_DATA_BOOL | VFIO_IRQ_SET_DATA_EVENTFD) 115 #define VFIO_IRQ_SET_ACTION_TYPE_MASK (VFIO_IRQ_SET_ACTION_MASK | VFIO_IRQ_SET_ACTION_UNMASK | VFIO_IRQ_SET_ACTION_TRIGGER) 116 #define VFIO_DEVICE_RESET _IO(VFIO_TYPE, VFIO_BASE + 11) 117 enum { 118 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 119 VFIO_PCI_BAR0_REGION_INDEX, 120 VFIO_PCI_BAR1_REGION_INDEX, 121 VFIO_PCI_BAR2_REGION_INDEX, 122 VFIO_PCI_BAR3_REGION_INDEX, 123 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 124 VFIO_PCI_BAR4_REGION_INDEX, 125 VFIO_PCI_BAR5_REGION_INDEX, 126 VFIO_PCI_ROM_REGION_INDEX, 127 VFIO_PCI_CONFIG_REGION_INDEX, 128 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 129 VFIO_PCI_VGA_REGION_INDEX, 130 VFIO_PCI_NUM_REGIONS 131 }; 132 enum { 133 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 134 VFIO_PCI_INTX_IRQ_INDEX, 135 VFIO_PCI_MSI_IRQ_INDEX, 136 VFIO_PCI_MSIX_IRQ_INDEX, 137 VFIO_PCI_ERR_IRQ_INDEX, 138 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 139 VFIO_PCI_REQ_IRQ_INDEX, 140 VFIO_PCI_NUM_IRQS 141 }; 142 struct vfio_pci_dependent_device { 143 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 144 __u32 group_id; 145 __u16 segment; 146 __u8 bus; 147 __u8 devfn; 148 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 149 }; 150 struct vfio_pci_hot_reset_info { 151 __u32 argsz; 152 __u32 flags; 153 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 154 __u32 count; 155 struct vfio_pci_dependent_device devices[]; 156 }; 157 #define VFIO_DEVICE_GET_PCI_HOT_RESET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12) 158 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 159 struct vfio_pci_hot_reset { 160 __u32 argsz; 161 __u32 flags; 162 __u32 count; 163 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 164 __s32 group_fds[]; 165 }; 166 #define VFIO_DEVICE_PCI_HOT_RESET _IO(VFIO_TYPE, VFIO_BASE + 13) 167 struct vfio_iommu_type1_info { 168 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 169 __u32 argsz; 170 __u32 flags; 171 #define VFIO_IOMMU_INFO_PGSIZES (1 << 0) 172 __u64 iova_pgsizes; 173 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 174 }; 175 #define VFIO_IOMMU_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12) 176 struct vfio_iommu_type1_dma_map { 177 __u32 argsz; 178 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 179 __u32 flags; 180 #define VFIO_DMA_MAP_FLAG_READ (1 << 0) 181 #define VFIO_DMA_MAP_FLAG_WRITE (1 << 1) 182 __u64 vaddr; 183 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 184 __u64 iova; 185 __u64 size; 186 }; 187 #define VFIO_IOMMU_MAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 13) 188 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 189 struct vfio_iommu_type1_dma_unmap { 190 __u32 argsz; 191 __u32 flags; 192 __u64 iova; 193 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 194 __u64 size; 195 }; 196 #define VFIO_IOMMU_UNMAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 14) 197 #define VFIO_IOMMU_ENABLE _IO(VFIO_TYPE, VFIO_BASE + 15) 198 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 199 #define VFIO_IOMMU_DISABLE _IO(VFIO_TYPE, VFIO_BASE + 16) 200 struct vfio_iommu_spapr_tce_ddw_info { 201 __u64 pgsizes; 202 __u32 max_dynamic_windows_supported; 203 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 204 __u32 levels; 205 }; 206 struct vfio_iommu_spapr_tce_info { 207 __u32 argsz; 208 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 209 __u32 flags; 210 #define VFIO_IOMMU_SPAPR_INFO_DDW (1 << 0) 211 __u32 dma32_window_start; 212 __u32 dma32_window_size; 213 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 214 struct vfio_iommu_spapr_tce_ddw_info ddw; 215 }; 216 #define VFIO_IOMMU_SPAPR_TCE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12) 217 struct vfio_eeh_pe_err { 218 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 219 __u32 type; 220 __u32 func; 221 __u64 addr; 222 __u64 mask; 223 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 224 }; 225 struct vfio_eeh_pe_op { 226 __u32 argsz; 227 __u32 flags; 228 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 229 __u32 op; 230 union { 231 struct vfio_eeh_pe_err err; 232 }; 233 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 234 }; 235 #define VFIO_EEH_PE_DISABLE 0 236 #define VFIO_EEH_PE_ENABLE 1 237 #define VFIO_EEH_PE_UNFREEZE_IO 2 238 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 239 #define VFIO_EEH_PE_UNFREEZE_DMA 3 240 #define VFIO_EEH_PE_GET_STATE 4 241 #define VFIO_EEH_PE_STATE_NORMAL 0 242 #define VFIO_EEH_PE_STATE_RESET 1 243 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 244 #define VFIO_EEH_PE_STATE_STOPPED 2 245 #define VFIO_EEH_PE_STATE_STOPPED_DMA 4 246 #define VFIO_EEH_PE_STATE_UNAVAIL 5 247 #define VFIO_EEH_PE_RESET_DEACTIVATE 5 248 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 249 #define VFIO_EEH_PE_RESET_HOT 6 250 #define VFIO_EEH_PE_RESET_FUNDAMENTAL 7 251 #define VFIO_EEH_PE_CONFIGURE 8 252 #define VFIO_EEH_PE_INJECT_ERR 9 253 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 254 #define VFIO_EEH_PE_OP _IO(VFIO_TYPE, VFIO_BASE + 21) 255 struct vfio_iommu_spapr_register_memory { 256 __u32 argsz; 257 __u32 flags; 258 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 259 __u64 vaddr; 260 __u64 size; 261 }; 262 #define VFIO_IOMMU_SPAPR_REGISTER_MEMORY _IO(VFIO_TYPE, VFIO_BASE + 17) 263 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 264 #define VFIO_IOMMU_SPAPR_UNREGISTER_MEMORY _IO(VFIO_TYPE, VFIO_BASE + 18) 265 struct vfio_iommu_spapr_tce_create { 266 __u32 argsz; 267 __u32 flags; 268 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 269 __u32 page_shift; 270 __u64 window_size; 271 __u32 levels; 272 __u64 start_addr; 273 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 274 }; 275 #define VFIO_IOMMU_SPAPR_TCE_CREATE _IO(VFIO_TYPE, VFIO_BASE + 19) 276 struct vfio_iommu_spapr_tce_remove { 277 __u32 argsz; 278 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 279 __u32 flags; 280 __u64 start_addr; 281 }; 282 #define VFIO_IOMMU_SPAPR_TCE_REMOVE _IO(VFIO_TYPE, VFIO_BASE + 20) 283 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 284 #endif 285