vfio.h revision 8cb52b056cfc302e05304d847c4228dff15715cf
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_TYPE (';')
27#define VFIO_BASE 100
28/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
29#define VFIO_GET_API_VERSION _IO(VFIO_TYPE, VFIO_BASE + 0)
30#define VFIO_CHECK_EXTENSION _IO(VFIO_TYPE, VFIO_BASE + 1)
31#define VFIO_SET_IOMMU _IO(VFIO_TYPE, VFIO_BASE + 2)
32struct vfio_group_status {
33/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
34 __u32 argsz;
35 __u32 flags;
36#define VFIO_GROUP_FLAGS_VIABLE (1 << 0)
37#define VFIO_GROUP_FLAGS_CONTAINER_SET (1 << 1)
38/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
39};
40#define VFIO_GROUP_GET_STATUS _IO(VFIO_TYPE, VFIO_BASE + 3)
41#define VFIO_GROUP_SET_CONTAINER _IO(VFIO_TYPE, VFIO_BASE + 4)
42#define VFIO_GROUP_UNSET_CONTAINER _IO(VFIO_TYPE, VFIO_BASE + 5)
43/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
44#define VFIO_GROUP_GET_DEVICE_FD _IO(VFIO_TYPE, VFIO_BASE + 6)
45struct vfio_device_info {
46 __u32 argsz;
47 __u32 flags;
48/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
49#define VFIO_DEVICE_FLAGS_RESET (1 << 0)
50#define VFIO_DEVICE_FLAGS_PCI (1 << 1)
51 __u32 num_regions;
52 __u32 num_irqs;
53/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
54};
55#define VFIO_DEVICE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 7)
56struct vfio_region_info {
57 __u32 argsz;
58/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
59 __u32 flags;
60#define VFIO_REGION_INFO_FLAG_READ (1 << 0)
61#define VFIO_REGION_INFO_FLAG_WRITE (1 << 1)
62#define VFIO_REGION_INFO_FLAG_MMAP (1 << 2)
63/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
64 __u32 index;
65 __u32 resv;
66 __u64 size;
67 __u64 offset;
68/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
69};
70#define VFIO_DEVICE_GET_REGION_INFO _IO(VFIO_TYPE, VFIO_BASE + 8)
71struct vfio_irq_info {
72 __u32 argsz;
73/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
74 __u32 flags;
75#define VFIO_IRQ_INFO_EVENTFD (1 << 0)
76#define VFIO_IRQ_INFO_MASKABLE (1 << 1)
77#define VFIO_IRQ_INFO_AUTOMASKED (1 << 2)
78/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
79#define VFIO_IRQ_INFO_NORESIZE (1 << 3)
80 __u32 index;
81 __u32 count;
82};
83/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
84#define VFIO_DEVICE_GET_IRQ_INFO _IO(VFIO_TYPE, VFIO_BASE + 9)
85struct vfio_irq_set {
86 __u32 argsz;
87 __u32 flags;
88/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
89#define VFIO_IRQ_SET_DATA_NONE (1 << 0)
90#define VFIO_IRQ_SET_DATA_BOOL (1 << 1)
91#define VFIO_IRQ_SET_DATA_EVENTFD (1 << 2)
92#define VFIO_IRQ_SET_ACTION_MASK (1 << 3)
93/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
94#define VFIO_IRQ_SET_ACTION_UNMASK (1 << 4)
95#define VFIO_IRQ_SET_ACTION_TRIGGER (1 << 5)
96 __u32 index;
97 __u32 start;
98/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
99 __u32 count;
100 __u8 data[];
101};
102#define VFIO_DEVICE_SET_IRQS _IO(VFIO_TYPE, VFIO_BASE + 10)
103/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
104#define VFIO_IRQ_SET_DATA_TYPE_MASK (VFIO_IRQ_SET_DATA_NONE |   VFIO_IRQ_SET_DATA_BOOL |   VFIO_IRQ_SET_DATA_EVENTFD)
105#define VFIO_IRQ_SET_ACTION_TYPE_MASK (VFIO_IRQ_SET_ACTION_MASK |   VFIO_IRQ_SET_ACTION_UNMASK |   VFIO_IRQ_SET_ACTION_TRIGGER)
106#define VFIO_DEVICE_RESET _IO(VFIO_TYPE, VFIO_BASE + 11)
107enum {
108/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
109 VFIO_PCI_BAR0_REGION_INDEX,
110 VFIO_PCI_BAR1_REGION_INDEX,
111 VFIO_PCI_BAR2_REGION_INDEX,
112 VFIO_PCI_BAR3_REGION_INDEX,
113/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
114 VFIO_PCI_BAR4_REGION_INDEX,
115 VFIO_PCI_BAR5_REGION_INDEX,
116 VFIO_PCI_ROM_REGION_INDEX,
117 VFIO_PCI_CONFIG_REGION_INDEX,
118/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
119 VFIO_PCI_VGA_REGION_INDEX,
120 VFIO_PCI_NUM_REGIONS
121};
122enum {
123/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
124 VFIO_PCI_INTX_IRQ_INDEX,
125 VFIO_PCI_MSI_IRQ_INDEX,
126 VFIO_PCI_MSIX_IRQ_INDEX,
127 VFIO_PCI_ERR_IRQ_INDEX,
128/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
129 VFIO_PCI_NUM_IRQS
130};
131struct vfio_iommu_type1_info {
132 __u32 argsz;
133/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
134 __u32 flags;
135#define VFIO_IOMMU_INFO_PGSIZES (1 << 0)
136 __u64 iova_pgsizes;
137};
138/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
139#define VFIO_IOMMU_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12)
140struct vfio_iommu_type1_dma_map {
141 __u32 argsz;
142 __u32 flags;
143/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
144#define VFIO_DMA_MAP_FLAG_READ (1 << 0)
145#define VFIO_DMA_MAP_FLAG_WRITE (1 << 1)
146 __u64 vaddr;
147 __u64 iova;
148/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
149 __u64 size;
150};
151#define VFIO_IOMMU_MAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 13)
152struct vfio_iommu_type1_dma_unmap {
153/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
154 __u32 argsz;
155 __u32 flags;
156 __u64 iova;
157 __u64 size;
158/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
159};
160#define VFIO_IOMMU_UNMAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 14)
161#endif
162