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