| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 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> | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 23 | #define VFIO_API_VERSION 0 | 
 | 24 | #define VFIO_TYPE1_IOMMU 1 | 
| Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 25 | #define VFIO_SPAPR_TCE_IOMMU 2 | 
| Christopher Ferris | ba8d4f4 | 2014-09-03 19:56:49 -0700 | [diff] [blame] | 26 | #define VFIO_TYPE1v2_IOMMU 3 | 
| Christopher Ferris | ba8d4f4 | 2014-09-03 19:56:49 -0700 | [diff] [blame] | 27 | #define VFIO_DMA_CC_IOMMU 4 | 
| Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 28 | #define VFIO_EEH 5 | 
 | 29 | #define VFIO_TYPE1_NESTING_IOMMU 6 | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 30 | #define VFIO_SPAPR_TCE_v2_IOMMU 7 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 31 | #define VFIO_NOIOMMU_IOMMU 8 | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 32 | #define VFIO_TYPE (';') | 
| Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 33 | #define VFIO_BASE 100 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 34 | struct vfio_info_cap_header { | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 35 |   __u16 id; | 
 | 36 |   __u16 version; | 
 | 37 |   __u32 next; | 
 | 38 | }; | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 39 | #define VFIO_GET_API_VERSION _IO(VFIO_TYPE, VFIO_BASE + 0) | 
 | 40 | #define VFIO_CHECK_EXTENSION _IO(VFIO_TYPE, VFIO_BASE + 1) | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 41 | #define VFIO_SET_IOMMU _IO(VFIO_TYPE, VFIO_BASE + 2) | 
| Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 42 | struct vfio_group_status { | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 43 |   __u32 argsz; | 
 | 44 |   __u32 flags; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 45 | #define VFIO_GROUP_FLAGS_VIABLE (1 << 0) | 
| Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 46 | #define VFIO_GROUP_FLAGS_CONTAINER_SET (1 << 1) | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 47 | }; | 
 | 48 | #define VFIO_GROUP_GET_STATUS _IO(VFIO_TYPE, VFIO_BASE + 3) | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 49 | #define VFIO_GROUP_SET_CONTAINER _IO(VFIO_TYPE, VFIO_BASE + 4) | 
| Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 50 | #define VFIO_GROUP_UNSET_CONTAINER _IO(VFIO_TYPE, VFIO_BASE + 5) | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 51 | #define VFIO_GROUP_GET_DEVICE_FD _IO(VFIO_TYPE, VFIO_BASE + 6) | 
 | 52 | struct vfio_device_info { | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 53 |   __u32 argsz; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 54 |   __u32 flags; | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 55 | #define VFIO_DEVICE_FLAGS_RESET (1 << 0) | 
 | 56 | #define VFIO_DEVICE_FLAGS_PCI (1 << 1) | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 57 | #define VFIO_DEVICE_FLAGS_PLATFORM (1 << 2) | 
 | 58 | #define VFIO_DEVICE_FLAGS_AMBA (1 << 3) | 
| Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 59 | #define VFIO_DEVICE_FLAGS_CCW (1 << 4) | 
| Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 60 | #define VFIO_DEVICE_FLAGS_AP (1 << 5) | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 61 |   __u32 num_regions; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 62 |   __u32 num_irqs; | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 63 | }; | 
 | 64 | #define VFIO_DEVICE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 7) | 
| Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 65 | #define VFIO_DEVICE_API_PCI_STRING "vfio-pci" | 
 | 66 | #define VFIO_DEVICE_API_PLATFORM_STRING "vfio-platform" | 
 | 67 | #define VFIO_DEVICE_API_AMBA_STRING "vfio-amba" | 
| Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 68 | #define VFIO_DEVICE_API_CCW_STRING "vfio-ccw" | 
| Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 69 | #define VFIO_DEVICE_API_AP_STRING "vfio-ap" | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 70 | struct vfio_region_info { | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 71 |   __u32 argsz; | 
 | 72 |   __u32 flags; | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 73 | #define VFIO_REGION_INFO_FLAG_READ (1 << 0) | 
 | 74 | #define VFIO_REGION_INFO_FLAG_WRITE (1 << 1) | 
| Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 75 | #define VFIO_REGION_INFO_FLAG_MMAP (1 << 2) | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 76 | #define VFIO_REGION_INFO_FLAG_CAPS (1 << 3) | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 77 |   __u32 index; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 78 |   __u32 cap_offset; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 79 |   __u64 size; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 80 |   __u64 offset; | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 81 | }; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 82 | #define VFIO_DEVICE_GET_REGION_INFO _IO(VFIO_TYPE, VFIO_BASE + 8) | 
 | 83 | #define VFIO_REGION_INFO_CAP_SPARSE_MMAP 1 | 
 | 84 | struct vfio_region_sparse_mmap_area { | 
 | 85 |   __u64 offset; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 86 |   __u64 size; | 
 | 87 | }; | 
 | 88 | struct vfio_region_info_cap_sparse_mmap { | 
 | 89 |   struct vfio_info_cap_header header; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 90 |   __u32 nr_areas; | 
 | 91 |   __u32 reserved; | 
 | 92 |   struct vfio_region_sparse_mmap_area areas[]; | 
 | 93 | }; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 94 | #define VFIO_REGION_INFO_CAP_TYPE 2 | 
 | 95 | struct vfio_region_info_cap_type { | 
 | 96 |   struct vfio_info_cap_header header; | 
 | 97 |   __u32 type; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 98 |   __u32 subtype; | 
 | 99 | }; | 
 | 100 | #define VFIO_REGION_TYPE_PCI_VENDOR_TYPE (1 << 31) | 
 | 101 | #define VFIO_REGION_TYPE_PCI_VENDOR_MASK (0xffff) | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 102 | #define VFIO_REGION_SUBTYPE_INTEL_IGD_OPREGION (1) | 
 | 103 | #define VFIO_REGION_SUBTYPE_INTEL_IGD_HOST_CFG (2) | 
 | 104 | #define VFIO_REGION_SUBTYPE_INTEL_IGD_LPC_CFG (3) | 
| Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 105 | #define VFIO_REGION_TYPE_GFX (1) | 
 | 106 | #define VFIO_REGION_SUBTYPE_GFX_EDID (1) | 
 | 107 | struct vfio_region_gfx_edid { | 
 | 108 |   __u32 edid_offset; | 
 | 109 |   __u32 edid_max_size; | 
 | 110 |   __u32 edid_size; | 
 | 111 |   __u32 max_xres; | 
 | 112 |   __u32 max_yres; | 
 | 113 |   __u32 link_state; | 
 | 114 | #define VFIO_DEVICE_GFX_LINK_STATE_UP 1 | 
 | 115 | #define VFIO_DEVICE_GFX_LINK_STATE_DOWN 2 | 
 | 116 | }; | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 117 | #define VFIO_REGION_INFO_CAP_MSIX_MAPPABLE 3 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 118 | struct vfio_irq_info { | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 119 |   __u32 argsz; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 120 |   __u32 flags; | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 121 | #define VFIO_IRQ_INFO_EVENTFD (1 << 0) | 
 | 122 | #define VFIO_IRQ_INFO_MASKABLE (1 << 1) | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 123 | #define VFIO_IRQ_INFO_AUTOMASKED (1 << 2) | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 124 | #define VFIO_IRQ_INFO_NORESIZE (1 << 3) | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 125 |   __u32 index; | 
 | 126 |   __u32 count; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 127 | }; | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 128 | #define VFIO_DEVICE_GET_IRQ_INFO _IO(VFIO_TYPE, VFIO_BASE + 9) | 
 | 129 | struct vfio_irq_set { | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 130 |   __u32 argsz; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 131 |   __u32 flags; | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 132 | #define VFIO_IRQ_SET_DATA_NONE (1 << 0) | 
 | 133 | #define VFIO_IRQ_SET_DATA_BOOL (1 << 1) | 
 | 134 | #define VFIO_IRQ_SET_DATA_EVENTFD (1 << 2) | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 135 | #define VFIO_IRQ_SET_ACTION_MASK (1 << 3) | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 136 | #define VFIO_IRQ_SET_ACTION_UNMASK (1 << 4) | 
 | 137 | #define VFIO_IRQ_SET_ACTION_TRIGGER (1 << 5) | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 138 |   __u32 index; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 139 |   __u32 start; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 140 |   __u32 count; | 
 | 141 |   __u8 data[]; | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 142 | }; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 143 | #define VFIO_DEVICE_SET_IRQS _IO(VFIO_TYPE, VFIO_BASE + 10) | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 144 | #define VFIO_IRQ_SET_DATA_TYPE_MASK (VFIO_IRQ_SET_DATA_NONE | VFIO_IRQ_SET_DATA_BOOL | VFIO_IRQ_SET_DATA_EVENTFD) | 
 | 145 | #define VFIO_IRQ_SET_ACTION_TYPE_MASK (VFIO_IRQ_SET_ACTION_MASK | VFIO_IRQ_SET_ACTION_UNMASK | VFIO_IRQ_SET_ACTION_TRIGGER) | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 146 | #define VFIO_DEVICE_RESET _IO(VFIO_TYPE, VFIO_BASE + 11) | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 147 | enum { | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 148 |   VFIO_PCI_BAR0_REGION_INDEX, | 
 | 149 |   VFIO_PCI_BAR1_REGION_INDEX, | 
 | 150 |   VFIO_PCI_BAR2_REGION_INDEX, | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 151 |   VFIO_PCI_BAR3_REGION_INDEX, | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 152 |   VFIO_PCI_BAR4_REGION_INDEX, | 
 | 153 |   VFIO_PCI_BAR5_REGION_INDEX, | 
 | 154 |   VFIO_PCI_ROM_REGION_INDEX, | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 155 |   VFIO_PCI_CONFIG_REGION_INDEX, | 
 | 156 |   VFIO_PCI_VGA_REGION_INDEX, | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 157 |   VFIO_PCI_NUM_REGIONS = 9 | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 158 | }; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 159 | enum { | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 160 |   VFIO_PCI_INTX_IRQ_INDEX, | 
 | 161 |   VFIO_PCI_MSI_IRQ_INDEX, | 
 | 162 |   VFIO_PCI_MSIX_IRQ_INDEX, | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 163 |   VFIO_PCI_ERR_IRQ_INDEX, | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 164 |   VFIO_PCI_REQ_IRQ_INDEX, | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 165 |   VFIO_PCI_NUM_IRQS | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 166 | }; | 
| Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 167 | enum { | 
 | 168 |   VFIO_CCW_CONFIG_REGION_INDEX, | 
 | 169 |   VFIO_CCW_NUM_REGIONS | 
 | 170 | }; | 
 | 171 | enum { | 
 | 172 |   VFIO_CCW_IO_IRQ_INDEX, | 
 | 173 |   VFIO_CCW_NUM_IRQS | 
 | 174 | }; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 175 | struct vfio_pci_dependent_device { | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 176 |   __u32 group_id; | 
 | 177 |   __u16 segment; | 
 | 178 |   __u8 bus; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 179 |   __u8 devfn; | 
| Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 180 | }; | 
 | 181 | struct vfio_pci_hot_reset_info { | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 182 |   __u32 argsz; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 183 |   __u32 flags; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 184 |   __u32 count; | 
 | 185 |   struct vfio_pci_dependent_device devices[]; | 
| Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 186 | }; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 187 | #define VFIO_DEVICE_GET_PCI_HOT_RESET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12) | 
| Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 188 | struct vfio_pci_hot_reset { | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 189 |   __u32 argsz; | 
 | 190 |   __u32 flags; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 191 |   __u32 count; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 192 |   __s32 group_fds[]; | 
| Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 193 | }; | 
 | 194 | #define VFIO_DEVICE_PCI_HOT_RESET _IO(VFIO_TYPE, VFIO_BASE + 13) | 
| Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 195 | struct vfio_device_gfx_plane_info { | 
 | 196 |   __u32 argsz; | 
 | 197 |   __u32 flags; | 
 | 198 | #define VFIO_GFX_PLANE_TYPE_PROBE (1 << 0) | 
 | 199 | #define VFIO_GFX_PLANE_TYPE_DMABUF (1 << 1) | 
 | 200 | #define VFIO_GFX_PLANE_TYPE_REGION (1 << 2) | 
 | 201 |   __u32 drm_plane_type; | 
 | 202 |   __u32 drm_format; | 
 | 203 |   __u64 drm_format_mod; | 
 | 204 |   __u32 width; | 
 | 205 |   __u32 height; | 
 | 206 |   __u32 stride; | 
 | 207 |   __u32 size; | 
 | 208 |   __u32 x_pos; | 
 | 209 |   __u32 y_pos; | 
 | 210 |   __u32 x_hot; | 
 | 211 |   __u32 y_hot; | 
 | 212 |   union { | 
 | 213 |     __u32 region_index; | 
 | 214 |     __u32 dmabuf_id; | 
 | 215 |   }; | 
 | 216 | }; | 
 | 217 | #define VFIO_DEVICE_QUERY_GFX_PLANE _IO(VFIO_TYPE, VFIO_BASE + 14) | 
 | 218 | #define VFIO_DEVICE_GET_GFX_DMABUF _IO(VFIO_TYPE, VFIO_BASE + 15) | 
 | 219 | struct vfio_device_ioeventfd { | 
 | 220 |   __u32 argsz; | 
 | 221 |   __u32 flags; | 
 | 222 | #define VFIO_DEVICE_IOEVENTFD_8 (1 << 0) | 
 | 223 | #define VFIO_DEVICE_IOEVENTFD_16 (1 << 1) | 
 | 224 | #define VFIO_DEVICE_IOEVENTFD_32 (1 << 2) | 
 | 225 | #define VFIO_DEVICE_IOEVENTFD_64 (1 << 3) | 
 | 226 | #define VFIO_DEVICE_IOEVENTFD_SIZE_MASK (0xf) | 
 | 227 |   __u64 offset; | 
 | 228 |   __u64 data; | 
 | 229 |   __s32 fd; | 
 | 230 | }; | 
 | 231 | #define VFIO_DEVICE_IOEVENTFD _IO(VFIO_TYPE, VFIO_BASE + 16) | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 232 | struct vfio_iommu_type1_info { | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 233 |   __u32 argsz; | 
 | 234 |   __u32 flags; | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 235 | #define VFIO_IOMMU_INFO_PGSIZES (1 << 0) | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 236 |   __u64 iova_pgsizes; | 
| Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 237 | }; | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 238 | #define VFIO_IOMMU_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12) | 
 | 239 | struct vfio_iommu_type1_dma_map { | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 240 |   __u32 argsz; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 241 |   __u32 flags; | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 242 | #define VFIO_DMA_MAP_FLAG_READ (1 << 0) | 
 | 243 | #define VFIO_DMA_MAP_FLAG_WRITE (1 << 1) | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 244 |   __u64 vaddr; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 245 |   __u64 iova; | 
 | 246 |   __u64 size; | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 247 | }; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 248 | #define VFIO_IOMMU_MAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 13) | 
| Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 249 | struct vfio_iommu_type1_dma_unmap { | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 250 |   __u32 argsz; | 
 | 251 |   __u32 flags; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 252 |   __u64 iova; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 253 |   __u64 size; | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 254 | }; | 
 | 255 | #define VFIO_IOMMU_UNMAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 14) | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 256 | #define VFIO_IOMMU_ENABLE _IO(VFIO_TYPE, VFIO_BASE + 15) | 
| Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 257 | #define VFIO_IOMMU_DISABLE _IO(VFIO_TYPE, VFIO_BASE + 16) | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 258 | struct vfio_iommu_spapr_tce_ddw_info { | 
 | 259 |   __u64 pgsizes; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 260 |   __u32 max_dynamic_windows_supported; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 261 |   __u32 levels; | 
 | 262 | }; | 
| Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 263 | struct vfio_iommu_spapr_tce_info { | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 264 |   __u32 argsz; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 265 |   __u32 flags; | 
 | 266 | #define VFIO_IOMMU_SPAPR_INFO_DDW (1 << 0) | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 267 |   __u32 dma32_window_start; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 268 |   __u32 dma32_window_size; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 269 |   struct vfio_iommu_spapr_tce_ddw_info ddw; | 
| Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 270 | }; | 
 | 271 | #define VFIO_IOMMU_SPAPR_TCE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12) | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 272 | struct vfio_eeh_pe_err { | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 273 |   __u32 type; | 
 | 274 |   __u32 func; | 
 | 275 |   __u64 addr; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 276 |   __u64 mask; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 277 | }; | 
| Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 278 | struct vfio_eeh_pe_op { | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 279 |   __u32 argsz; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 280 |   __u32 flags; | 
| Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 281 |   __u32 op; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 282 |   union { | 
 | 283 |     struct vfio_eeh_pe_err err; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 284 |   }; | 
| Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 285 | }; | 
 | 286 | #define VFIO_EEH_PE_DISABLE 0 | 
 | 287 | #define VFIO_EEH_PE_ENABLE 1 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 288 | #define VFIO_EEH_PE_UNFREEZE_IO 2 | 
| Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 289 | #define VFIO_EEH_PE_UNFREEZE_DMA 3 | 
 | 290 | #define VFIO_EEH_PE_GET_STATE 4 | 
 | 291 | #define VFIO_EEH_PE_STATE_NORMAL 0 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 292 | #define VFIO_EEH_PE_STATE_RESET 1 | 
| Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 293 | #define VFIO_EEH_PE_STATE_STOPPED 2 | 
 | 294 | #define VFIO_EEH_PE_STATE_STOPPED_DMA 4 | 
 | 295 | #define VFIO_EEH_PE_STATE_UNAVAIL 5 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 296 | #define VFIO_EEH_PE_RESET_DEACTIVATE 5 | 
| Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 297 | #define VFIO_EEH_PE_RESET_HOT 6 | 
 | 298 | #define VFIO_EEH_PE_RESET_FUNDAMENTAL 7 | 
 | 299 | #define VFIO_EEH_PE_CONFIGURE 8 | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 300 | #define VFIO_EEH_PE_INJECT_ERR 9 | 
| Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 301 | #define VFIO_EEH_PE_OP _IO(VFIO_TYPE, VFIO_BASE + 21) | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 302 | struct vfio_iommu_spapr_register_memory { | 
 | 303 |   __u32 argsz; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 304 |   __u32 flags; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 305 |   __u64 vaddr; | 
 | 306 |   __u64 size; | 
 | 307 | }; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 308 | #define VFIO_IOMMU_SPAPR_REGISTER_MEMORY _IO(VFIO_TYPE, VFIO_BASE + 17) | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 309 | #define VFIO_IOMMU_SPAPR_UNREGISTER_MEMORY _IO(VFIO_TYPE, VFIO_BASE + 18) | 
 | 310 | struct vfio_iommu_spapr_tce_create { | 
 | 311 |   __u32 argsz; | 
 | 312 |   __u32 flags; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 313 |   __u32 page_shift; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 314 |   __u32 __resv1; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 315 |   __u64 window_size; | 
| Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 316 |   __u32 levels; | 
 | 317 |   __u32 __resv2; | 
 | 318 |   __u64 start_addr; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 319 | }; | 
 | 320 | #define VFIO_IOMMU_SPAPR_TCE_CREATE _IO(VFIO_TYPE, VFIO_BASE + 19) | 
 | 321 | struct vfio_iommu_spapr_tce_remove { | 
 | 322 |   __u32 argsz; | 
| Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 323 |   __u32 flags; | 
 | 324 |   __u64 start_addr; | 
 | 325 | }; | 
 | 326 | #define VFIO_IOMMU_SPAPR_TCE_REMOVE _IO(VFIO_TYPE, VFIO_BASE + 20) | 
| Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 327 | #endif |