blob: 4f9bfc079ff41a5ece6264ce8d9c5b7e2b5f4c69 [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
30#define VFIO_TYPE (';')
Christopher Ferris38062f92014-07-09 15:33:25 -070031#define VFIO_BASE 100
Ben Cheng655a7c02013-10-16 16:09:24 -070032#define VFIO_GET_API_VERSION _IO(VFIO_TYPE, VFIO_BASE + 0)
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070033/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -070034#define VFIO_CHECK_EXTENSION _IO(VFIO_TYPE, VFIO_BASE + 1)
35#define VFIO_SET_IOMMU _IO(VFIO_TYPE, VFIO_BASE + 2)
Christopher Ferris38062f92014-07-09 15:33:25 -070036struct vfio_group_status {
Ben Cheng655a7c02013-10-16 16:09:24 -070037 __u32 argsz;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070038/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -070039 __u32 flags;
40#define VFIO_GROUP_FLAGS_VIABLE (1 << 0)
Christopher Ferris38062f92014-07-09 15:33:25 -070041#define VFIO_GROUP_FLAGS_CONTAINER_SET (1 << 1)
Ben Cheng655a7c02013-10-16 16:09:24 -070042};
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070043/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -070044#define VFIO_GROUP_GET_STATUS _IO(VFIO_TYPE, VFIO_BASE + 3)
45#define VFIO_GROUP_SET_CONTAINER _IO(VFIO_TYPE, VFIO_BASE + 4)
Christopher Ferris38062f92014-07-09 15:33:25 -070046#define VFIO_GROUP_UNSET_CONTAINER _IO(VFIO_TYPE, VFIO_BASE + 5)
Ben Cheng655a7c02013-10-16 16:09:24 -070047#define VFIO_GROUP_GET_DEVICE_FD _IO(VFIO_TYPE, VFIO_BASE + 6)
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070048/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -070049struct vfio_device_info {
50 __u32 argsz;
Christopher Ferris38062f92014-07-09 15:33:25 -070051 __u32 flags;
Ben Cheng655a7c02013-10-16 16:09:24 -070052#define VFIO_DEVICE_FLAGS_RESET (1 << 0)
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070053/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -070054#define VFIO_DEVICE_FLAGS_PCI (1 << 1)
55 __u32 num_regions;
Christopher Ferris38062f92014-07-09 15:33:25 -070056 __u32 num_irqs;
Ben Cheng655a7c02013-10-16 16:09:24 -070057};
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070058/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -070059#define VFIO_DEVICE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 7)
60struct vfio_region_info {
Christopher Ferris38062f92014-07-09 15:33:25 -070061 __u32 argsz;
Ben Cheng655a7c02013-10-16 16:09:24 -070062 __u32 flags;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070063/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -070064#define VFIO_REGION_INFO_FLAG_READ (1 << 0)
65#define VFIO_REGION_INFO_FLAG_WRITE (1 << 1)
Christopher Ferris38062f92014-07-09 15:33:25 -070066#define VFIO_REGION_INFO_FLAG_MMAP (1 << 2)
Ben Cheng655a7c02013-10-16 16:09:24 -070067 __u32 index;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070068/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -070069 __u32 resv;
70 __u64 size;
Christopher Ferris38062f92014-07-09 15:33:25 -070071 __u64 offset;
Ben Cheng655a7c02013-10-16 16:09:24 -070072};
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070073/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -070074#define VFIO_DEVICE_GET_REGION_INFO _IO(VFIO_TYPE, VFIO_BASE + 8)
75struct vfio_irq_info {
Christopher Ferris38062f92014-07-09 15:33:25 -070076 __u32 argsz;
Ben Cheng655a7c02013-10-16 16:09:24 -070077 __u32 flags;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070078/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -070079#define VFIO_IRQ_INFO_EVENTFD (1 << 0)
80#define VFIO_IRQ_INFO_MASKABLE (1 << 1)
Christopher Ferris38062f92014-07-09 15:33:25 -070081#define VFIO_IRQ_INFO_AUTOMASKED (1 << 2)
Ben Cheng655a7c02013-10-16 16:09:24 -070082#define VFIO_IRQ_INFO_NORESIZE (1 << 3)
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070083/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -070084 __u32 index;
85 __u32 count;
Christopher Ferris38062f92014-07-09 15:33:25 -070086};
Ben Cheng655a7c02013-10-16 16:09:24 -070087#define VFIO_DEVICE_GET_IRQ_INFO _IO(VFIO_TYPE, VFIO_BASE + 9)
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070088/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -070089struct vfio_irq_set {
90 __u32 argsz;
Christopher Ferris38062f92014-07-09 15:33:25 -070091 __u32 flags;
Ben Cheng655a7c02013-10-16 16:09:24 -070092#define VFIO_IRQ_SET_DATA_NONE (1 << 0)
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070093/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -070094#define VFIO_IRQ_SET_DATA_BOOL (1 << 1)
95#define VFIO_IRQ_SET_DATA_EVENTFD (1 << 2)
Christopher Ferris38062f92014-07-09 15:33:25 -070096#define VFIO_IRQ_SET_ACTION_MASK (1 << 3)
Ben Cheng655a7c02013-10-16 16:09:24 -070097#define VFIO_IRQ_SET_ACTION_UNMASK (1 << 4)
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070098/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -070099#define VFIO_IRQ_SET_ACTION_TRIGGER (1 << 5)
100 __u32 index;
Christopher Ferris38062f92014-07-09 15:33:25 -0700101 __u32 start;
Ben Cheng655a7c02013-10-16 16:09:24 -0700102 __u32 count;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700103/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -0700104 __u8 data[];
105};
Christopher Ferris38062f92014-07-09 15:33:25 -0700106#define VFIO_DEVICE_SET_IRQS _IO(VFIO_TYPE, VFIO_BASE + 10)
Ben Cheng655a7c02013-10-16 16:09:24 -0700107#define VFIO_IRQ_SET_DATA_TYPE_MASK (VFIO_IRQ_SET_DATA_NONE | VFIO_IRQ_SET_DATA_BOOL | VFIO_IRQ_SET_DATA_EVENTFD)
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700108/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -0700109#define VFIO_IRQ_SET_ACTION_TYPE_MASK (VFIO_IRQ_SET_ACTION_MASK | VFIO_IRQ_SET_ACTION_UNMASK | VFIO_IRQ_SET_ACTION_TRIGGER)
110#define VFIO_DEVICE_RESET _IO(VFIO_TYPE, VFIO_BASE + 11)
Christopher Ferris38062f92014-07-09 15:33:25 -0700111enum {
Ben Cheng655a7c02013-10-16 16:09:24 -0700112 VFIO_PCI_BAR0_REGION_INDEX,
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700113/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -0700114 VFIO_PCI_BAR1_REGION_INDEX,
115 VFIO_PCI_BAR2_REGION_INDEX,
Christopher Ferris38062f92014-07-09 15:33:25 -0700116 VFIO_PCI_BAR3_REGION_INDEX,
Ben Cheng655a7c02013-10-16 16:09:24 -0700117 VFIO_PCI_BAR4_REGION_INDEX,
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700118/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -0700119 VFIO_PCI_BAR5_REGION_INDEX,
120 VFIO_PCI_ROM_REGION_INDEX,
Christopher Ferris38062f92014-07-09 15:33:25 -0700121 VFIO_PCI_CONFIG_REGION_INDEX,
Ben Cheng655a7c02013-10-16 16:09:24 -0700122 VFIO_PCI_VGA_REGION_INDEX,
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700123/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -0700124 VFIO_PCI_NUM_REGIONS
125};
Christopher Ferris38062f92014-07-09 15:33:25 -0700126enum {
Ben Cheng655a7c02013-10-16 16:09:24 -0700127 VFIO_PCI_INTX_IRQ_INDEX,
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700128/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -0700129 VFIO_PCI_MSI_IRQ_INDEX,
130 VFIO_PCI_MSIX_IRQ_INDEX,
Christopher Ferris38062f92014-07-09 15:33:25 -0700131 VFIO_PCI_ERR_IRQ_INDEX,
Ben Cheng655a7c02013-10-16 16:09:24 -0700132 VFIO_PCI_NUM_IRQS
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700133/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -0700134};
Christopher Ferris38062f92014-07-09 15:33:25 -0700135struct vfio_pci_dependent_device {
Christopher Ferris38062f92014-07-09 15:33:25 -0700136 __u32 group_id;
137 __u16 segment;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700138/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -0700139 __u8 bus;
140 __u8 devfn;
Christopher Ferris38062f92014-07-09 15:33:25 -0700141};
142struct vfio_pci_hot_reset_info {
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700143/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -0700144 __u32 argsz;
145 __u32 flags;
Christopher Ferris38062f92014-07-09 15:33:25 -0700146 __u32 count;
147 struct vfio_pci_dependent_device devices[];
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700148/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -0700149};
150#define VFIO_DEVICE_GET_PCI_HOT_RESET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12)
Christopher Ferris38062f92014-07-09 15:33:25 -0700151struct vfio_pci_hot_reset {
152 __u32 argsz;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700153/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -0700154 __u32 flags;
155 __u32 count;
Christopher Ferris38062f92014-07-09 15:33:25 -0700156 __s32 group_fds[];
157};
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700158/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -0700159#define VFIO_DEVICE_PCI_HOT_RESET _IO(VFIO_TYPE, VFIO_BASE + 13)
160struct vfio_iommu_type1_info {
Christopher Ferris38062f92014-07-09 15:33:25 -0700161 __u32 argsz;
Ben Cheng655a7c02013-10-16 16:09:24 -0700162 __u32 flags;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700163/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -0700164#define VFIO_IOMMU_INFO_PGSIZES (1 << 0)
165 __u64 iova_pgsizes;
Christopher Ferris38062f92014-07-09 15:33:25 -0700166};
Ben Cheng655a7c02013-10-16 16:09:24 -0700167#define VFIO_IOMMU_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12)
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700168/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -0700169struct vfio_iommu_type1_dma_map {
170 __u32 argsz;
Christopher Ferris38062f92014-07-09 15:33:25 -0700171 __u32 flags;
Ben Cheng655a7c02013-10-16 16:09:24 -0700172#define VFIO_DMA_MAP_FLAG_READ (1 << 0)
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700173/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -0700174#define VFIO_DMA_MAP_FLAG_WRITE (1 << 1)
175 __u64 vaddr;
Christopher Ferris38062f92014-07-09 15:33:25 -0700176 __u64 iova;
Ben Cheng655a7c02013-10-16 16:09:24 -0700177 __u64 size;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700178/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -0700179};
180#define VFIO_IOMMU_MAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 13)
Christopher Ferris38062f92014-07-09 15:33:25 -0700181struct vfio_iommu_type1_dma_unmap {
Ben Cheng655a7c02013-10-16 16:09:24 -0700182 __u32 argsz;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700183/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -0700184 __u32 flags;
185 __u64 iova;
Christopher Ferris38062f92014-07-09 15:33:25 -0700186 __u64 size;
Ben Cheng655a7c02013-10-16 16:09:24 -0700187};
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700188/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -0700189#define VFIO_IOMMU_UNMAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 14)
Christopher Ferris38062f92014-07-09 15:33:25 -0700190#define VFIO_IOMMU_ENABLE _IO(VFIO_TYPE, VFIO_BASE + 15)
Christopher Ferris38062f92014-07-09 15:33:25 -0700191#define VFIO_IOMMU_DISABLE _IO(VFIO_TYPE, VFIO_BASE + 16)
192struct vfio_iommu_spapr_tce_info {
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700193/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -0700194 __u32 argsz;
195 __u32 flags;
Christopher Ferris38062f92014-07-09 15:33:25 -0700196 __u32 dma32_window_start;
197 __u32 dma32_window_size;
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700198/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris38062f92014-07-09 15:33:25 -0700199};
200#define VFIO_IOMMU_SPAPR_TCE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12)
Ben Cheng655a7c02013-10-16 16:09:24 -0700201#endif