blob: 88cb06732db54e3b1fd73021a171d57cda8ebc8b [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
Ben Cheng655a7c02013-10-16 16:09:24 -070027#define VFIO_TYPE (';')
Elliott Hughes8cb52b02013-11-21 13:43:23 -080028/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -070029#define VFIO_BASE 100
Ben Cheng655a7c02013-10-16 16:09:24 -070030#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)
Elliott Hughes8cb52b02013-11-21 13:43:23 -080033/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -070034struct vfio_group_status {
Ben Cheng655a7c02013-10-16 16:09:24 -070035 __u32 argsz;
36 __u32 flags;
37#define VFIO_GROUP_FLAGS_VIABLE (1 << 0)
Elliott Hughes8cb52b02013-11-21 13:43:23 -080038/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -070039#define VFIO_GROUP_FLAGS_CONTAINER_SET (1 << 1)
Ben Cheng655a7c02013-10-16 16:09:24 -070040};
41#define VFIO_GROUP_GET_STATUS _IO(VFIO_TYPE, VFIO_BASE + 3)
42#define VFIO_GROUP_SET_CONTAINER _IO(VFIO_TYPE, VFIO_BASE + 4)
Elliott Hughes8cb52b02013-11-21 13:43:23 -080043/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -070044#define VFIO_GROUP_UNSET_CONTAINER _IO(VFIO_TYPE, VFIO_BASE + 5)
Ben Cheng655a7c02013-10-16 16:09:24 -070045#define VFIO_GROUP_GET_DEVICE_FD _IO(VFIO_TYPE, VFIO_BASE + 6)
46struct vfio_device_info {
47 __u32 argsz;
Elliott Hughes8cb52b02013-11-21 13:43:23 -080048/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -070049 __u32 flags;
Ben Cheng655a7c02013-10-16 16:09:24 -070050#define VFIO_DEVICE_FLAGS_RESET (1 << 0)
51#define VFIO_DEVICE_FLAGS_PCI (1 << 1)
52 __u32 num_regions;
Elliott Hughes8cb52b02013-11-21 13:43:23 -080053/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -070054 __u32 num_irqs;
Ben Cheng655a7c02013-10-16 16:09:24 -070055};
56#define VFIO_DEVICE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 7)
57struct vfio_region_info {
Elliott Hughes8cb52b02013-11-21 13:43:23 -080058/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -070059 __u32 argsz;
Ben Cheng655a7c02013-10-16 16:09:24 -070060 __u32 flags;
61#define VFIO_REGION_INFO_FLAG_READ (1 << 0)
62#define VFIO_REGION_INFO_FLAG_WRITE (1 << 1)
Elliott Hughes8cb52b02013-11-21 13:43:23 -080063/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -070064#define VFIO_REGION_INFO_FLAG_MMAP (1 << 2)
Ben Cheng655a7c02013-10-16 16:09:24 -070065 __u32 index;
66 __u32 resv;
67 __u64 size;
Elliott Hughes8cb52b02013-11-21 13:43:23 -080068/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -070069 __u64 offset;
Ben Cheng655a7c02013-10-16 16:09:24 -070070};
71#define VFIO_DEVICE_GET_REGION_INFO _IO(VFIO_TYPE, VFIO_BASE + 8)
72struct vfio_irq_info {
Elliott Hughes8cb52b02013-11-21 13:43:23 -080073/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -070074 __u32 argsz;
Ben Cheng655a7c02013-10-16 16:09:24 -070075 __u32 flags;
76#define VFIO_IRQ_INFO_EVENTFD (1 << 0)
77#define VFIO_IRQ_INFO_MASKABLE (1 << 1)
Elliott Hughes8cb52b02013-11-21 13:43:23 -080078/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -070079#define VFIO_IRQ_INFO_AUTOMASKED (1 << 2)
Ben Cheng655a7c02013-10-16 16:09:24 -070080#define VFIO_IRQ_INFO_NORESIZE (1 << 3)
81 __u32 index;
82 __u32 count;
Elliott Hughes8cb52b02013-11-21 13:43:23 -080083/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -070084};
Ben Cheng655a7c02013-10-16 16:09:24 -070085#define VFIO_DEVICE_GET_IRQ_INFO _IO(VFIO_TYPE, VFIO_BASE + 9)
86struct vfio_irq_set {
87 __u32 argsz;
Elliott Hughes8cb52b02013-11-21 13:43:23 -080088/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -070089 __u32 flags;
Ben Cheng655a7c02013-10-16 16:09:24 -070090#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)
Elliott Hughes8cb52b02013-11-21 13:43:23 -080093/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -070094#define VFIO_IRQ_SET_ACTION_MASK (1 << 3)
Ben Cheng655a7c02013-10-16 16:09:24 -070095#define VFIO_IRQ_SET_ACTION_UNMASK (1 << 4)
96#define VFIO_IRQ_SET_ACTION_TRIGGER (1 << 5)
97 __u32 index;
Elliott Hughes8cb52b02013-11-21 13:43:23 -080098/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -070099 __u32 start;
Ben Cheng655a7c02013-10-16 16:09:24 -0700100 __u32 count;
101 __u8 data[];
102};
Elliott Hughes8cb52b02013-11-21 13:43:23 -0800103/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -0700104#define VFIO_DEVICE_SET_IRQS _IO(VFIO_TYPE, VFIO_BASE + 10)
Ben Cheng655a7c02013-10-16 16:09:24 -0700105#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)
Elliott Hughes8cb52b02013-11-21 13:43:23 -0800108/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -0700109enum {
Ben Cheng655a7c02013-10-16 16:09:24 -0700110 VFIO_PCI_BAR0_REGION_INDEX,
111 VFIO_PCI_BAR1_REGION_INDEX,
112 VFIO_PCI_BAR2_REGION_INDEX,
Elliott Hughes8cb52b02013-11-21 13:43:23 -0800113/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -0700114 VFIO_PCI_BAR3_REGION_INDEX,
Ben Cheng655a7c02013-10-16 16:09:24 -0700115 VFIO_PCI_BAR4_REGION_INDEX,
116 VFIO_PCI_BAR5_REGION_INDEX,
117 VFIO_PCI_ROM_REGION_INDEX,
Elliott Hughes8cb52b02013-11-21 13:43:23 -0800118/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -0700119 VFIO_PCI_CONFIG_REGION_INDEX,
Ben Cheng655a7c02013-10-16 16:09:24 -0700120 VFIO_PCI_VGA_REGION_INDEX,
121 VFIO_PCI_NUM_REGIONS
122};
Elliott Hughes8cb52b02013-11-21 13:43:23 -0800123/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -0700124enum {
Ben Cheng655a7c02013-10-16 16:09:24 -0700125 VFIO_PCI_INTX_IRQ_INDEX,
126 VFIO_PCI_MSI_IRQ_INDEX,
127 VFIO_PCI_MSIX_IRQ_INDEX,
Elliott Hughes8cb52b02013-11-21 13:43:23 -0800128/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -0700129 VFIO_PCI_ERR_IRQ_INDEX,
Ben Cheng655a7c02013-10-16 16:09:24 -0700130 VFIO_PCI_NUM_IRQS
131};
Christopher Ferris38062f92014-07-09 15:33:25 -0700132struct vfio_pci_dependent_device {
Elliott Hughes8cb52b02013-11-21 13:43:23 -0800133/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -0700134 __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};
140struct 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 */
149struct 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)
157struct vfio_iommu_type1_info {
158/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
159 __u32 argsz;
Ben Cheng655a7c02013-10-16 16:09:24 -0700160 __u32 flags;
161#define VFIO_IOMMU_INFO_PGSIZES (1 << 0)
162 __u64 iova_pgsizes;
Elliott Hughes8cb52b02013-11-21 13:43:23 -0800163/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -0700164};
Ben Cheng655a7c02013-10-16 16:09:24 -0700165#define VFIO_IOMMU_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12)
166struct vfio_iommu_type1_dma_map {
167 __u32 argsz;
Elliott Hughes8cb52b02013-11-21 13:43:23 -0800168/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -0700169 __u32 flags;
Ben Cheng655a7c02013-10-16 16:09:24 -0700170#define VFIO_DMA_MAP_FLAG_READ (1 << 0)
171#define VFIO_DMA_MAP_FLAG_WRITE (1 << 1)
172 __u64 vaddr;
Elliott Hughes8cb52b02013-11-21 13:43:23 -0800173/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -0700174 __u64 iova;
Ben Cheng655a7c02013-10-16 16:09:24 -0700175 __u64 size;
176};
177#define VFIO_IOMMU_MAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 13)
Elliott Hughes8cb52b02013-11-21 13:43:23 -0800178/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -0700179struct vfio_iommu_type1_dma_unmap {
Ben Cheng655a7c02013-10-16 16:09:24 -0700180 __u32 argsz;
181 __u32 flags;
182 __u64 iova;
Elliott Hughes8cb52b02013-11-21 13:43:23 -0800183/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -0700184 __u64 size;
Ben Cheng655a7c02013-10-16 16:09:24 -0700185};
186#define VFIO_IOMMU_UNMAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 14)
Christopher Ferris38062f92014-07-09 15:33:25 -0700187#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)
190struct 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 */
Ben Cheng655a7c02013-10-16 16:09:24 -0700199#endif