blob: 32db70ea9cecaaad07d66515ac2f1a0aab21bc4e [file] [log] [blame]
Ben Cheng655a7c02013-10-16 16:09:24 -07001/****************************************************************************
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
Christopher Ferris38062f92014-07-09 15:33:25 -070026#define VFIO_SPAPR_TCE_IOMMU 2
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070027#define VFIO_TYPE1v2_IOMMU 3
Elliott Hughes8cb52b02013-11-21 13:43:23 -080028/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070029#define VFIO_DMA_CC_IOMMU 4
Christopher Ferris82d75042015-01-26 10:57:07 -080030#define VFIO_EEH 5
31#define VFIO_TYPE1_NESTING_IOMMU 6
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070032#define VFIO_TYPE (';')
Christopher Ferris82d75042015-01-26 10:57:07 -080033/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -070034#define VFIO_BASE 100
Ben Cheng655a7c02013-10-16 16:09:24 -070035#define VFIO_GET_API_VERSION _IO(VFIO_TYPE, VFIO_BASE + 0)
36#define VFIO_CHECK_EXTENSION _IO(VFIO_TYPE, VFIO_BASE + 1)
37#define VFIO_SET_IOMMU _IO(VFIO_TYPE, VFIO_BASE + 2)
Christopher Ferris82d75042015-01-26 10:57:07 -080038/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -070039struct vfio_group_status {
Tao Baod7db5942015-01-28 10:07:51 -080040 __u32 argsz;
41 __u32 flags;
Ben Cheng655a7c02013-10-16 16:09:24 -070042#define VFIO_GROUP_FLAGS_VIABLE (1 << 0)
Christopher Ferris82d75042015-01-26 10:57:07 -080043/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -070044#define VFIO_GROUP_FLAGS_CONTAINER_SET (1 << 1)
Ben Cheng655a7c02013-10-16 16:09:24 -070045};
46#define VFIO_GROUP_GET_STATUS _IO(VFIO_TYPE, VFIO_BASE + 3)
47#define VFIO_GROUP_SET_CONTAINER _IO(VFIO_TYPE, VFIO_BASE + 4)
Christopher Ferris82d75042015-01-26 10:57:07 -080048/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -070049#define VFIO_GROUP_UNSET_CONTAINER _IO(VFIO_TYPE, VFIO_BASE + 5)
Ben Cheng655a7c02013-10-16 16:09:24 -070050#define VFIO_GROUP_GET_DEVICE_FD _IO(VFIO_TYPE, VFIO_BASE + 6)
51struct vfio_device_info {
Tao Baod7db5942015-01-28 10:07:51 -080052 __u32 argsz;
Christopher Ferris82d75042015-01-26 10:57:07 -080053/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -080054 __u32 flags;
Ben Cheng655a7c02013-10-16 16:09:24 -070055#define VFIO_DEVICE_FLAGS_RESET (1 << 0)
56#define VFIO_DEVICE_FLAGS_PCI (1 << 1)
Tao Baod7db5942015-01-28 10:07:51 -080057 __u32 num_regions;
Christopher Ferris82d75042015-01-26 10:57:07 -080058/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -080059 __u32 num_irqs;
Ben Cheng655a7c02013-10-16 16:09:24 -070060};
61#define VFIO_DEVICE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 7)
62struct vfio_region_info {
Christopher Ferris82d75042015-01-26 10:57:07 -080063/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -080064 __u32 argsz;
65 __u32 flags;
Ben Cheng655a7c02013-10-16 16:09:24 -070066#define VFIO_REGION_INFO_FLAG_READ (1 << 0)
67#define VFIO_REGION_INFO_FLAG_WRITE (1 << 1)
Christopher Ferris82d75042015-01-26 10:57:07 -080068/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -070069#define VFIO_REGION_INFO_FLAG_MMAP (1 << 2)
Tao Baod7db5942015-01-28 10:07:51 -080070 __u32 index;
71 __u32 resv;
72 __u64 size;
Christopher Ferris82d75042015-01-26 10:57:07 -080073/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -080074 __u64 offset;
Ben Cheng655a7c02013-10-16 16:09:24 -070075};
76#define VFIO_DEVICE_GET_REGION_INFO _IO(VFIO_TYPE, VFIO_BASE + 8)
77struct vfio_irq_info {
Christopher Ferris82d75042015-01-26 10:57:07 -080078/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -080079 __u32 argsz;
80 __u32 flags;
Ben Cheng655a7c02013-10-16 16:09:24 -070081#define VFIO_IRQ_INFO_EVENTFD (1 << 0)
82#define VFIO_IRQ_INFO_MASKABLE (1 << 1)
Christopher Ferris82d75042015-01-26 10:57:07 -080083/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -070084#define VFIO_IRQ_INFO_AUTOMASKED (1 << 2)
Ben Cheng655a7c02013-10-16 16:09:24 -070085#define VFIO_IRQ_INFO_NORESIZE (1 << 3)
Tao Baod7db5942015-01-28 10:07:51 -080086 __u32 index;
87 __u32 count;
Christopher Ferris82d75042015-01-26 10:57:07 -080088/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -070089};
Ben Cheng655a7c02013-10-16 16:09:24 -070090#define VFIO_DEVICE_GET_IRQ_INFO _IO(VFIO_TYPE, VFIO_BASE + 9)
91struct vfio_irq_set {
Tao Baod7db5942015-01-28 10:07:51 -080092 __u32 argsz;
Christopher Ferris82d75042015-01-26 10:57:07 -080093/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -080094 __u32 flags;
Ben Cheng655a7c02013-10-16 16:09:24 -070095#define VFIO_IRQ_SET_DATA_NONE (1 << 0)
96#define VFIO_IRQ_SET_DATA_BOOL (1 << 1)
97#define VFIO_IRQ_SET_DATA_EVENTFD (1 << 2)
Christopher Ferris82d75042015-01-26 10:57:07 -080098/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -070099#define VFIO_IRQ_SET_ACTION_MASK (1 << 3)
Ben Cheng655a7c02013-10-16 16:09:24 -0700100#define VFIO_IRQ_SET_ACTION_UNMASK (1 << 4)
101#define VFIO_IRQ_SET_ACTION_TRIGGER (1 << 5)
Tao Baod7db5942015-01-28 10:07:51 -0800102 __u32 index;
Christopher Ferris82d75042015-01-26 10:57:07 -0800103/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -0800104 __u32 start;
105 __u32 count;
106 __u8 data[];
Ben Cheng655a7c02013-10-16 16:09:24 -0700107};
Christopher Ferris82d75042015-01-26 10:57:07 -0800108/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -0700109#define VFIO_DEVICE_SET_IRQS _IO(VFIO_TYPE, VFIO_BASE + 10)
Tao Baod7db5942015-01-28 10:07:51 -0800110#define VFIO_IRQ_SET_DATA_TYPE_MASK (VFIO_IRQ_SET_DATA_NONE | VFIO_IRQ_SET_DATA_BOOL | VFIO_IRQ_SET_DATA_EVENTFD)
111#define VFIO_IRQ_SET_ACTION_TYPE_MASK (VFIO_IRQ_SET_ACTION_MASK | VFIO_IRQ_SET_ACTION_UNMASK | VFIO_IRQ_SET_ACTION_TRIGGER)
Ben Cheng655a7c02013-10-16 16:09:24 -0700112#define VFIO_DEVICE_RESET _IO(VFIO_TYPE, VFIO_BASE + 11)
Christopher Ferris82d75042015-01-26 10:57:07 -0800113/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -0700114enum {
Tao Baod7db5942015-01-28 10:07:51 -0800115 VFIO_PCI_BAR0_REGION_INDEX,
116 VFIO_PCI_BAR1_REGION_INDEX,
117 VFIO_PCI_BAR2_REGION_INDEX,
Christopher Ferris82d75042015-01-26 10:57:07 -0800118/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -0800119 VFIO_PCI_BAR3_REGION_INDEX,
120 VFIO_PCI_BAR4_REGION_INDEX,
121 VFIO_PCI_BAR5_REGION_INDEX,
122 VFIO_PCI_ROM_REGION_INDEX,
Christopher Ferris82d75042015-01-26 10:57:07 -0800123/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -0800124 VFIO_PCI_CONFIG_REGION_INDEX,
125 VFIO_PCI_VGA_REGION_INDEX,
126 VFIO_PCI_NUM_REGIONS
Ben Cheng655a7c02013-10-16 16:09:24 -0700127};
Christopher Ferris82d75042015-01-26 10:57:07 -0800128/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -0700129enum {
Tao Baod7db5942015-01-28 10:07:51 -0800130 VFIO_PCI_INTX_IRQ_INDEX,
131 VFIO_PCI_MSI_IRQ_INDEX,
132 VFIO_PCI_MSIX_IRQ_INDEX,
Christopher Ferris82d75042015-01-26 10:57:07 -0800133/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -0800134 VFIO_PCI_ERR_IRQ_INDEX,
135 VFIO_PCI_NUM_IRQS
Ben Cheng655a7c02013-10-16 16:09:24 -0700136};
Christopher Ferris38062f92014-07-09 15:33:25 -0700137struct vfio_pci_dependent_device {
Christopher Ferris82d75042015-01-26 10:57:07 -0800138/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -0800139 __u32 group_id;
140 __u16 segment;
141 __u8 bus;
142 __u8 devfn;
Christopher Ferris82d75042015-01-26 10:57:07 -0800143/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -0700144};
145struct vfio_pci_hot_reset_info {
Tao Baod7db5942015-01-28 10:07:51 -0800146 __u32 argsz;
147 __u32 flags;
Christopher Ferris82d75042015-01-26 10:57:07 -0800148/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -0800149 __u32 count;
150 struct vfio_pci_dependent_device devices[];
Christopher Ferris38062f92014-07-09 15:33:25 -0700151};
152#define VFIO_DEVICE_GET_PCI_HOT_RESET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12)
Christopher Ferris82d75042015-01-26 10:57:07 -0800153/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -0700154struct vfio_pci_hot_reset {
Tao Baod7db5942015-01-28 10:07:51 -0800155 __u32 argsz;
156 __u32 flags;
157 __u32 count;
Christopher Ferris82d75042015-01-26 10:57:07 -0800158/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -0800159 __s32 group_fds[];
Christopher Ferris38062f92014-07-09 15:33:25 -0700160};
161#define VFIO_DEVICE_PCI_HOT_RESET _IO(VFIO_TYPE, VFIO_BASE + 13)
162struct vfio_iommu_type1_info {
Christopher Ferris82d75042015-01-26 10:57:07 -0800163/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -0800164 __u32 argsz;
165 __u32 flags;
Ben Cheng655a7c02013-10-16 16:09:24 -0700166#define VFIO_IOMMU_INFO_PGSIZES (1 << 0)
Tao Baod7db5942015-01-28 10:07:51 -0800167 __u64 iova_pgsizes;
Christopher Ferris82d75042015-01-26 10:57:07 -0800168/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -0700169};
Ben Cheng655a7c02013-10-16 16:09:24 -0700170#define VFIO_IOMMU_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12)
171struct vfio_iommu_type1_dma_map {
Tao Baod7db5942015-01-28 10:07:51 -0800172 __u32 argsz;
Christopher Ferris82d75042015-01-26 10:57:07 -0800173/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -0800174 __u32 flags;
Ben Cheng655a7c02013-10-16 16:09:24 -0700175#define VFIO_DMA_MAP_FLAG_READ (1 << 0)
176#define VFIO_DMA_MAP_FLAG_WRITE (1 << 1)
Tao Baod7db5942015-01-28 10:07:51 -0800177 __u64 vaddr;
Christopher Ferris82d75042015-01-26 10:57:07 -0800178/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -0800179 __u64 iova;
180 __u64 size;
Ben Cheng655a7c02013-10-16 16:09:24 -0700181};
182#define VFIO_IOMMU_MAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 13)
Christopher Ferris82d75042015-01-26 10:57:07 -0800183/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -0700184struct vfio_iommu_type1_dma_unmap {
Tao Baod7db5942015-01-28 10:07:51 -0800185 __u32 argsz;
186 __u32 flags;
187 __u64 iova;
Christopher Ferris82d75042015-01-26 10:57:07 -0800188/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -0800189 __u64 size;
Ben Cheng655a7c02013-10-16 16:09:24 -0700190};
191#define VFIO_IOMMU_UNMAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 14)
Christopher Ferris38062f92014-07-09 15:33:25 -0700192#define VFIO_IOMMU_ENABLE _IO(VFIO_TYPE, VFIO_BASE + 15)
Christopher Ferris82d75042015-01-26 10:57:07 -0800193/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -0700194#define VFIO_IOMMU_DISABLE _IO(VFIO_TYPE, VFIO_BASE + 16)
195struct vfio_iommu_spapr_tce_info {
Tao Baod7db5942015-01-28 10:07:51 -0800196 __u32 argsz;
197 __u32 flags;
Christopher Ferris82d75042015-01-26 10:57:07 -0800198/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -0800199 __u32 dma32_window_start;
200 __u32 dma32_window_size;
Christopher Ferris38062f92014-07-09 15:33:25 -0700201};
202#define VFIO_IOMMU_SPAPR_TCE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12)
Christopher Ferris82d75042015-01-26 10:57:07 -0800203/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
204struct vfio_eeh_pe_op {
Tao Baod7db5942015-01-28 10:07:51 -0800205 __u32 argsz;
206 __u32 flags;
207 __u32 op;
Christopher Ferris82d75042015-01-26 10:57:07 -0800208/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
209};
210#define VFIO_EEH_PE_DISABLE 0
211#define VFIO_EEH_PE_ENABLE 1
212#define VFIO_EEH_PE_UNFREEZE_IO 2
213/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
214#define VFIO_EEH_PE_UNFREEZE_DMA 3
215#define VFIO_EEH_PE_GET_STATE 4
216#define VFIO_EEH_PE_STATE_NORMAL 0
217#define VFIO_EEH_PE_STATE_RESET 1
218/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
219#define VFIO_EEH_PE_STATE_STOPPED 2
220#define VFIO_EEH_PE_STATE_STOPPED_DMA 4
221#define VFIO_EEH_PE_STATE_UNAVAIL 5
222#define VFIO_EEH_PE_RESET_DEACTIVATE 5
223/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
224#define VFIO_EEH_PE_RESET_HOT 6
225#define VFIO_EEH_PE_RESET_FUNDAMENTAL 7
226#define VFIO_EEH_PE_CONFIGURE 8
227#define VFIO_EEH_PE_OP _IO(VFIO_TYPE, VFIO_BASE + 21)
228/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -0700229#endif