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 | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 32 | #define VFIO_UNMAP_ALL 9 |
| 33 | #define VFIO_UPDATE_VADDR 10 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 34 | #define VFIO_TYPE (';') |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 35 | #define VFIO_BASE 100 |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 36 | struct vfio_info_cap_header { |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 37 | __u16 id; |
| 38 | __u16 version; |
| 39 | __u32 next; |
| 40 | }; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 41 | #define VFIO_GET_API_VERSION _IO(VFIO_TYPE, VFIO_BASE + 0) |
| 42 | #define VFIO_CHECK_EXTENSION _IO(VFIO_TYPE, VFIO_BASE + 1) |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 43 | #define VFIO_SET_IOMMU _IO(VFIO_TYPE, VFIO_BASE + 2) |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 44 | struct vfio_group_status { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 45 | __u32 argsz; |
| 46 | __u32 flags; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 47 | #define VFIO_GROUP_FLAGS_VIABLE (1 << 0) |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 48 | #define VFIO_GROUP_FLAGS_CONTAINER_SET (1 << 1) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 49 | }; |
| 50 | #define VFIO_GROUP_GET_STATUS _IO(VFIO_TYPE, VFIO_BASE + 3) |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 51 | #define VFIO_GROUP_SET_CONTAINER _IO(VFIO_TYPE, VFIO_BASE + 4) |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 52 | #define VFIO_GROUP_UNSET_CONTAINER _IO(VFIO_TYPE, VFIO_BASE + 5) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 53 | #define VFIO_GROUP_GET_DEVICE_FD _IO(VFIO_TYPE, VFIO_BASE + 6) |
| 54 | struct vfio_device_info { |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 55 | __u32 argsz; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 56 | __u32 flags; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 57 | #define VFIO_DEVICE_FLAGS_RESET (1 << 0) |
| 58 | #define VFIO_DEVICE_FLAGS_PCI (1 << 1) |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 59 | #define VFIO_DEVICE_FLAGS_PLATFORM (1 << 2) |
| 60 | #define VFIO_DEVICE_FLAGS_AMBA (1 << 3) |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 61 | #define VFIO_DEVICE_FLAGS_CCW (1 << 4) |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 62 | #define VFIO_DEVICE_FLAGS_AP (1 << 5) |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 63 | #define VFIO_DEVICE_FLAGS_FSL_MC (1 << 6) |
| 64 | #define VFIO_DEVICE_FLAGS_CAPS (1 << 7) |
Christopher Ferris | 8666d04 | 2023-09-06 14:55:31 -0700 | [diff] [blame] | 65 | #define VFIO_DEVICE_FLAGS_CDX (1 << 8) |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 66 | __u32 num_regions; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 67 | __u32 num_irqs; |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 68 | __u32 cap_offset; |
Christopher Ferris | 67d1e5e | 2023-10-31 13:36:37 -0700 | [diff] [blame] | 69 | __u32 pad; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 70 | }; |
| 71 | #define VFIO_DEVICE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 7) |
Christopher Ferris | 48af7cb | 2017-02-21 12:35:09 -0800 | [diff] [blame] | 72 | #define VFIO_DEVICE_API_PCI_STRING "vfio-pci" |
| 73 | #define VFIO_DEVICE_API_PLATFORM_STRING "vfio-platform" |
| 74 | #define VFIO_DEVICE_API_AMBA_STRING "vfio-amba" |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 75 | #define VFIO_DEVICE_API_CCW_STRING "vfio-ccw" |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 76 | #define VFIO_DEVICE_API_AP_STRING "vfio-ap" |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 77 | #define VFIO_DEVICE_INFO_CAP_ZPCI_BASE 1 |
| 78 | #define VFIO_DEVICE_INFO_CAP_ZPCI_GROUP 2 |
| 79 | #define VFIO_DEVICE_INFO_CAP_ZPCI_UTIL 3 |
| 80 | #define VFIO_DEVICE_INFO_CAP_ZPCI_PFIP 4 |
Christopher Ferris | 8666d04 | 2023-09-06 14:55:31 -0700 | [diff] [blame] | 81 | #define VFIO_DEVICE_INFO_CAP_PCI_ATOMIC_COMP 5 |
| 82 | struct vfio_device_info_cap_pci_atomic_comp { |
| 83 | struct vfio_info_cap_header header; |
| 84 | __u32 flags; |
| 85 | #define VFIO_PCI_ATOMIC_COMP32 (1 << 0) |
| 86 | #define VFIO_PCI_ATOMIC_COMP64 (1 << 1) |
| 87 | #define VFIO_PCI_ATOMIC_COMP128 (1 << 2) |
| 88 | __u32 reserved; |
| 89 | }; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 90 | struct vfio_region_info { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 91 | __u32 argsz; |
| 92 | __u32 flags; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 93 | #define VFIO_REGION_INFO_FLAG_READ (1 << 0) |
| 94 | #define VFIO_REGION_INFO_FLAG_WRITE (1 << 1) |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 95 | #define VFIO_REGION_INFO_FLAG_MMAP (1 << 2) |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 96 | #define VFIO_REGION_INFO_FLAG_CAPS (1 << 3) |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 97 | __u32 index; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 98 | __u32 cap_offset; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 99 | __u64 size; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 100 | __u64 offset; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 101 | }; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 102 | #define VFIO_DEVICE_GET_REGION_INFO _IO(VFIO_TYPE, VFIO_BASE + 8) |
| 103 | #define VFIO_REGION_INFO_CAP_SPARSE_MMAP 1 |
| 104 | struct vfio_region_sparse_mmap_area { |
| 105 | __u64 offset; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 106 | __u64 size; |
| 107 | }; |
| 108 | struct vfio_region_info_cap_sparse_mmap { |
| 109 | struct vfio_info_cap_header header; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 110 | __u32 nr_areas; |
| 111 | __u32 reserved; |
| 112 | struct vfio_region_sparse_mmap_area areas[]; |
| 113 | }; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 114 | #define VFIO_REGION_INFO_CAP_TYPE 2 |
| 115 | struct vfio_region_info_cap_type { |
| 116 | struct vfio_info_cap_header header; |
| 117 | __u32 type; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 118 | __u32 subtype; |
| 119 | }; |
| 120 | #define VFIO_REGION_TYPE_PCI_VENDOR_TYPE (1 << 31) |
| 121 | #define VFIO_REGION_TYPE_PCI_VENDOR_MASK (0xffff) |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 122 | #define VFIO_REGION_TYPE_GFX (1) |
| 123 | #define VFIO_REGION_TYPE_CCW (2) |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 124 | #define VFIO_REGION_TYPE_MIGRATION_DEPRECATED (3) |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 125 | #define VFIO_REGION_SUBTYPE_INTEL_IGD_OPREGION (1) |
| 126 | #define VFIO_REGION_SUBTYPE_INTEL_IGD_HOST_CFG (2) |
| 127 | #define VFIO_REGION_SUBTYPE_INTEL_IGD_LPC_CFG (3) |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 128 | #define VFIO_REGION_SUBTYPE_NVIDIA_NVLINK2_RAM (1) |
| 129 | #define VFIO_REGION_SUBTYPE_IBM_NVLINK2_ATSD (1) |
Christopher Ferris | 86a4837 | 2019-01-10 14:14:59 -0800 | [diff] [blame] | 130 | #define VFIO_REGION_SUBTYPE_GFX_EDID (1) |
| 131 | struct vfio_region_gfx_edid { |
| 132 | __u32 edid_offset; |
| 133 | __u32 edid_max_size; |
| 134 | __u32 edid_size; |
| 135 | __u32 max_xres; |
| 136 | __u32 max_yres; |
| 137 | __u32 link_state; |
| 138 | #define VFIO_DEVICE_GFX_LINK_STATE_UP 1 |
| 139 | #define VFIO_DEVICE_GFX_LINK_STATE_DOWN 2 |
| 140 | }; |
Christopher Ferris | aeddbcf | 2019-07-08 12:45:46 -0700 | [diff] [blame] | 141 | #define VFIO_REGION_SUBTYPE_CCW_ASYNC_CMD (1) |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 142 | #define VFIO_REGION_SUBTYPE_CCW_SCHIB (2) |
| 143 | #define VFIO_REGION_SUBTYPE_CCW_CRW (3) |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 144 | #define VFIO_REGION_SUBTYPE_MIGRATION_DEPRECATED (1) |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 145 | struct vfio_device_migration_info { |
| 146 | __u32 device_state; |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 147 | #define VFIO_DEVICE_STATE_V1_STOP (0) |
| 148 | #define VFIO_DEVICE_STATE_V1_RUNNING (1 << 0) |
| 149 | #define VFIO_DEVICE_STATE_V1_SAVING (1 << 1) |
| 150 | #define VFIO_DEVICE_STATE_V1_RESUMING (1 << 2) |
| 151 | #define VFIO_DEVICE_STATE_MASK (VFIO_DEVICE_STATE_V1_RUNNING | VFIO_DEVICE_STATE_V1_SAVING | VFIO_DEVICE_STATE_V1_RESUMING) |
| 152 | #define VFIO_DEVICE_STATE_VALID(state) (state & VFIO_DEVICE_STATE_V1_RESUMING ? (state & VFIO_DEVICE_STATE_MASK) == VFIO_DEVICE_STATE_V1_RESUMING : 1) |
| 153 | #define VFIO_DEVICE_STATE_IS_ERROR(state) ((state & VFIO_DEVICE_STATE_MASK) == (VFIO_DEVICE_STATE_V1_SAVING | VFIO_DEVICE_STATE_V1_RESUMING)) |
| 154 | #define VFIO_DEVICE_STATE_SET_ERROR(state) ((state & ~VFIO_DEVICE_STATE_MASK) | VFIO_DEVICE_STATE_V1_SAVING | VFIO_DEVICE_STATE_V1_RESUMING) |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 155 | __u32 reserved; |
| 156 | __u64 pending_bytes; |
| 157 | __u64 data_offset; |
| 158 | __u64 data_size; |
| 159 | }; |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 160 | #define VFIO_REGION_INFO_CAP_MSIX_MAPPABLE 3 |
Christopher Ferris | d842e43 | 2019-03-07 10:21:59 -0800 | [diff] [blame] | 161 | #define VFIO_REGION_INFO_CAP_NVLINK2_SSATGT 4 |
| 162 | struct vfio_region_info_cap_nvlink2_ssatgt { |
| 163 | struct vfio_info_cap_header header; |
| 164 | __u64 tgt; |
| 165 | }; |
| 166 | #define VFIO_REGION_INFO_CAP_NVLINK2_LNKSPD 5 |
| 167 | struct vfio_region_info_cap_nvlink2_lnkspd { |
| 168 | struct vfio_info_cap_header header; |
| 169 | __u32 link_speed; |
| 170 | __u32 __pad; |
| 171 | }; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 172 | struct vfio_irq_info { |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 173 | __u32 argsz; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 174 | __u32 flags; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 175 | #define VFIO_IRQ_INFO_EVENTFD (1 << 0) |
| 176 | #define VFIO_IRQ_INFO_MASKABLE (1 << 1) |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 177 | #define VFIO_IRQ_INFO_AUTOMASKED (1 << 2) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 178 | #define VFIO_IRQ_INFO_NORESIZE (1 << 3) |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 179 | __u32 index; |
| 180 | __u32 count; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 181 | }; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 182 | #define VFIO_DEVICE_GET_IRQ_INFO _IO(VFIO_TYPE, VFIO_BASE + 9) |
| 183 | struct vfio_irq_set { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 184 | __u32 argsz; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 185 | __u32 flags; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 186 | #define VFIO_IRQ_SET_DATA_NONE (1 << 0) |
| 187 | #define VFIO_IRQ_SET_DATA_BOOL (1 << 1) |
| 188 | #define VFIO_IRQ_SET_DATA_EVENTFD (1 << 2) |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 189 | #define VFIO_IRQ_SET_ACTION_MASK (1 << 3) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 190 | #define VFIO_IRQ_SET_ACTION_UNMASK (1 << 4) |
| 191 | #define VFIO_IRQ_SET_ACTION_TRIGGER (1 << 5) |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 192 | __u32 index; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 193 | __u32 start; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 194 | __u32 count; |
| 195 | __u8 data[]; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 196 | }; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 197 | #define VFIO_DEVICE_SET_IRQS _IO(VFIO_TYPE, VFIO_BASE + 10) |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 198 | #define VFIO_IRQ_SET_DATA_TYPE_MASK (VFIO_IRQ_SET_DATA_NONE | VFIO_IRQ_SET_DATA_BOOL | VFIO_IRQ_SET_DATA_EVENTFD) |
| 199 | #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] | 200 | #define VFIO_DEVICE_RESET _IO(VFIO_TYPE, VFIO_BASE + 11) |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 201 | enum { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 202 | VFIO_PCI_BAR0_REGION_INDEX, |
| 203 | VFIO_PCI_BAR1_REGION_INDEX, |
| 204 | VFIO_PCI_BAR2_REGION_INDEX, |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 205 | VFIO_PCI_BAR3_REGION_INDEX, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 206 | VFIO_PCI_BAR4_REGION_INDEX, |
| 207 | VFIO_PCI_BAR5_REGION_INDEX, |
| 208 | VFIO_PCI_ROM_REGION_INDEX, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 209 | VFIO_PCI_CONFIG_REGION_INDEX, |
| 210 | VFIO_PCI_VGA_REGION_INDEX, |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 211 | VFIO_PCI_NUM_REGIONS = 9 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 212 | }; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 213 | enum { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 214 | VFIO_PCI_INTX_IRQ_INDEX, |
| 215 | VFIO_PCI_MSI_IRQ_INDEX, |
| 216 | VFIO_PCI_MSIX_IRQ_INDEX, |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 217 | VFIO_PCI_ERR_IRQ_INDEX, |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 218 | VFIO_PCI_REQ_IRQ_INDEX, |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 219 | VFIO_PCI_NUM_IRQS |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 220 | }; |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 221 | enum { |
| 222 | VFIO_CCW_CONFIG_REGION_INDEX, |
| 223 | VFIO_CCW_NUM_REGIONS |
| 224 | }; |
| 225 | enum { |
| 226 | VFIO_CCW_IO_IRQ_INDEX, |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 227 | VFIO_CCW_CRW_IRQ_INDEX, |
Christopher Ferris | 05667cd | 2021-02-16 16:01:34 -0800 | [diff] [blame] | 228 | VFIO_CCW_REQ_IRQ_INDEX, |
Christopher Ferris | 525ce91 | 2017-07-26 13:12:53 -0700 | [diff] [blame] | 229 | VFIO_CCW_NUM_IRQS |
| 230 | }; |
Christopher Ferris | 8666d04 | 2023-09-06 14:55:31 -0700 | [diff] [blame] | 231 | enum { |
| 232 | VFIO_AP_REQ_IRQ_INDEX, |
| 233 | VFIO_AP_NUM_IRQS |
| 234 | }; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 235 | struct vfio_pci_dependent_device { |
Christopher Ferris | 67d1e5e | 2023-10-31 13:36:37 -0700 | [diff] [blame] | 236 | union { |
| 237 | __u32 group_id; |
| 238 | __u32 devid; |
| 239 | #define VFIO_PCI_DEVID_OWNED 0 |
| 240 | #define VFIO_PCI_DEVID_NOT_OWNED - 1 |
| 241 | }; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 242 | __u16 segment; |
| 243 | __u8 bus; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 244 | __u8 devfn; |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 245 | }; |
| 246 | struct vfio_pci_hot_reset_info { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 247 | __u32 argsz; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 248 | __u32 flags; |
Christopher Ferris | 67d1e5e | 2023-10-31 13:36:37 -0700 | [diff] [blame] | 249 | #define VFIO_PCI_HOT_RESET_FLAG_DEV_ID (1 << 0) |
| 250 | #define VFIO_PCI_HOT_RESET_FLAG_DEV_ID_OWNED (1 << 1) |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 251 | __u32 count; |
| 252 | struct vfio_pci_dependent_device devices[]; |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 253 | }; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 254 | #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] | 255 | struct vfio_pci_hot_reset { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 256 | __u32 argsz; |
| 257 | __u32 flags; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 258 | __u32 count; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 259 | __s32 group_fds[]; |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 260 | }; |
| 261 | #define VFIO_DEVICE_PCI_HOT_RESET _IO(VFIO_TYPE, VFIO_BASE + 13) |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 262 | struct vfio_device_gfx_plane_info { |
| 263 | __u32 argsz; |
| 264 | __u32 flags; |
| 265 | #define VFIO_GFX_PLANE_TYPE_PROBE (1 << 0) |
| 266 | #define VFIO_GFX_PLANE_TYPE_DMABUF (1 << 1) |
| 267 | #define VFIO_GFX_PLANE_TYPE_REGION (1 << 2) |
| 268 | __u32 drm_plane_type; |
| 269 | __u32 drm_format; |
| 270 | __u64 drm_format_mod; |
| 271 | __u32 width; |
| 272 | __u32 height; |
| 273 | __u32 stride; |
| 274 | __u32 size; |
| 275 | __u32 x_pos; |
| 276 | __u32 y_pos; |
| 277 | __u32 x_hot; |
| 278 | __u32 y_hot; |
| 279 | union { |
| 280 | __u32 region_index; |
| 281 | __u32 dmabuf_id; |
| 282 | }; |
| 283 | }; |
| 284 | #define VFIO_DEVICE_QUERY_GFX_PLANE _IO(VFIO_TYPE, VFIO_BASE + 14) |
| 285 | #define VFIO_DEVICE_GET_GFX_DMABUF _IO(VFIO_TYPE, VFIO_BASE + 15) |
| 286 | struct vfio_device_ioeventfd { |
| 287 | __u32 argsz; |
| 288 | __u32 flags; |
| 289 | #define VFIO_DEVICE_IOEVENTFD_8 (1 << 0) |
| 290 | #define VFIO_DEVICE_IOEVENTFD_16 (1 << 1) |
| 291 | #define VFIO_DEVICE_IOEVENTFD_32 (1 << 2) |
| 292 | #define VFIO_DEVICE_IOEVENTFD_64 (1 << 3) |
| 293 | #define VFIO_DEVICE_IOEVENTFD_SIZE_MASK (0xf) |
| 294 | __u64 offset; |
| 295 | __u64 data; |
| 296 | __s32 fd; |
| 297 | }; |
| 298 | #define VFIO_DEVICE_IOEVENTFD _IO(VFIO_TYPE, VFIO_BASE + 16) |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 299 | struct vfio_device_feature { |
| 300 | __u32 argsz; |
| 301 | __u32 flags; |
| 302 | #define VFIO_DEVICE_FEATURE_MASK (0xffff) |
| 303 | #define VFIO_DEVICE_FEATURE_GET (1 << 16) |
| 304 | #define VFIO_DEVICE_FEATURE_SET (1 << 17) |
| 305 | #define VFIO_DEVICE_FEATURE_PROBE (1 << 18) |
| 306 | __u8 data[]; |
| 307 | }; |
| 308 | #define VFIO_DEVICE_FEATURE _IO(VFIO_TYPE, VFIO_BASE + 17) |
Christopher Ferris | 67d1e5e | 2023-10-31 13:36:37 -0700 | [diff] [blame] | 309 | struct vfio_device_bind_iommufd { |
| 310 | __u32 argsz; |
| 311 | __u32 flags; |
| 312 | __s32 iommufd; |
| 313 | __u32 out_devid; |
| 314 | }; |
| 315 | #define VFIO_DEVICE_BIND_IOMMUFD _IO(VFIO_TYPE, VFIO_BASE + 18) |
| 316 | struct vfio_device_attach_iommufd_pt { |
| 317 | __u32 argsz; |
| 318 | __u32 flags; |
| 319 | __u32 pt_id; |
| 320 | }; |
| 321 | #define VFIO_DEVICE_ATTACH_IOMMUFD_PT _IO(VFIO_TYPE, VFIO_BASE + 19) |
| 322 | struct vfio_device_detach_iommufd_pt { |
| 323 | __u32 argsz; |
| 324 | __u32 flags; |
| 325 | }; |
| 326 | #define VFIO_DEVICE_DETACH_IOMMUFD_PT _IO(VFIO_TYPE, VFIO_BASE + 20) |
Christopher Ferris | af09c70 | 2020-06-01 20:29:29 -0700 | [diff] [blame] | 327 | #define VFIO_DEVICE_FEATURE_PCI_VF_TOKEN (0) |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 328 | struct vfio_device_feature_migration { |
| 329 | __aligned_u64 flags; |
| 330 | #define VFIO_MIGRATION_STOP_COPY (1 << 0) |
| 331 | #define VFIO_MIGRATION_P2P (1 << 1) |
Christopher Ferris | 8b7fdc9 | 2023-02-21 13:36:32 -0800 | [diff] [blame] | 332 | #define VFIO_MIGRATION_PRE_COPY (1 << 2) |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 333 | }; |
| 334 | #define VFIO_DEVICE_FEATURE_MIGRATION 1 |
| 335 | struct vfio_device_feature_mig_state { |
| 336 | __u32 device_state; |
| 337 | __s32 data_fd; |
| 338 | }; |
| 339 | #define VFIO_DEVICE_FEATURE_MIG_DEVICE_STATE 2 |
| 340 | enum vfio_device_mig_state { |
| 341 | VFIO_DEVICE_STATE_ERROR = 0, |
| 342 | VFIO_DEVICE_STATE_STOP = 1, |
| 343 | VFIO_DEVICE_STATE_RUNNING = 2, |
| 344 | VFIO_DEVICE_STATE_STOP_COPY = 3, |
| 345 | VFIO_DEVICE_STATE_RESUMING = 4, |
| 346 | VFIO_DEVICE_STATE_RUNNING_P2P = 5, |
Christopher Ferris | 8b7fdc9 | 2023-02-21 13:36:32 -0800 | [diff] [blame] | 347 | VFIO_DEVICE_STATE_PRE_COPY = 6, |
| 348 | VFIO_DEVICE_STATE_PRE_COPY_P2P = 7, |
Christopher Ferris | 10a76e6 | 2022-06-08 13:31:52 -0700 | [diff] [blame] | 349 | }; |
Christopher Ferris | 8b7fdc9 | 2023-02-21 13:36:32 -0800 | [diff] [blame] | 350 | struct vfio_precopy_info { |
| 351 | __u32 argsz; |
| 352 | __u32 flags; |
| 353 | __aligned_u64 initial_bytes; |
| 354 | __aligned_u64 dirty_bytes; |
| 355 | }; |
| 356 | #define VFIO_MIG_GET_PRECOPY_INFO _IO(VFIO_TYPE, VFIO_BASE + 21) |
Christopher Ferris | 6cd53a5 | 2022-12-12 23:39:16 +0000 | [diff] [blame] | 357 | #define VFIO_DEVICE_FEATURE_LOW_POWER_ENTRY 3 |
| 358 | struct vfio_device_low_power_entry_with_wakeup { |
| 359 | __s32 wakeup_eventfd; |
| 360 | __u32 reserved; |
| 361 | }; |
| 362 | #define VFIO_DEVICE_FEATURE_LOW_POWER_ENTRY_WITH_WAKEUP 4 |
| 363 | #define VFIO_DEVICE_FEATURE_LOW_POWER_EXIT 5 |
| 364 | struct vfio_device_feature_dma_logging_control { |
| 365 | __aligned_u64 page_size; |
| 366 | __u32 num_ranges; |
| 367 | __u32 __reserved; |
| 368 | __aligned_u64 ranges; |
| 369 | }; |
| 370 | struct vfio_device_feature_dma_logging_range { |
| 371 | __aligned_u64 iova; |
| 372 | __aligned_u64 length; |
| 373 | }; |
| 374 | #define VFIO_DEVICE_FEATURE_DMA_LOGGING_START 6 |
| 375 | #define VFIO_DEVICE_FEATURE_DMA_LOGGING_STOP 7 |
| 376 | struct vfio_device_feature_dma_logging_report { |
| 377 | __aligned_u64 iova; |
| 378 | __aligned_u64 length; |
| 379 | __aligned_u64 page_size; |
| 380 | __aligned_u64 bitmap; |
| 381 | }; |
| 382 | #define VFIO_DEVICE_FEATURE_DMA_LOGGING_REPORT 8 |
Christopher Ferris | 8b7fdc9 | 2023-02-21 13:36:32 -0800 | [diff] [blame] | 383 | struct vfio_device_feature_mig_data_size { |
| 384 | __aligned_u64 stop_copy_length; |
| 385 | }; |
| 386 | #define VFIO_DEVICE_FEATURE_MIG_DATA_SIZE 9 |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 387 | struct vfio_iommu_type1_info { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 388 | __u32 argsz; |
| 389 | __u32 flags; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 390 | #define VFIO_IOMMU_INFO_PGSIZES (1 << 0) |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 391 | #define VFIO_IOMMU_INFO_CAPS (1 << 1) |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 392 | __u64 iova_pgsizes; |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 393 | __u32 cap_offset; |
Christopher Ferris | 67d1e5e | 2023-10-31 13:36:37 -0700 | [diff] [blame] | 394 | __u32 pad; |
Christopher Ferris | 9584fa4 | 2019-12-09 15:36:13 -0800 | [diff] [blame] | 395 | }; |
| 396 | #define VFIO_IOMMU_TYPE1_INFO_CAP_IOVA_RANGE 1 |
| 397 | struct vfio_iova_range { |
| 398 | __u64 start; |
| 399 | __u64 end; |
| 400 | }; |
| 401 | struct vfio_iommu_type1_info_cap_iova_range { |
| 402 | struct vfio_info_cap_header header; |
| 403 | __u32 nr_iovas; |
| 404 | __u32 reserved; |
| 405 | struct vfio_iova_range iova_ranges[]; |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 406 | }; |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 407 | #define VFIO_IOMMU_TYPE1_INFO_CAP_MIGRATION 2 |
| 408 | struct vfio_iommu_type1_info_cap_migration { |
| 409 | struct vfio_info_cap_header header; |
| 410 | __u32 flags; |
| 411 | __u64 pgsize_bitmap; |
| 412 | __u64 max_dirty_bitmap_size; |
| 413 | }; |
Christopher Ferris | 32ff3f8 | 2020-12-14 13:10:04 -0800 | [diff] [blame] | 414 | #define VFIO_IOMMU_TYPE1_INFO_DMA_AVAIL 3 |
| 415 | struct vfio_iommu_type1_info_dma_avail { |
| 416 | struct vfio_info_cap_header header; |
| 417 | __u32 avail; |
| 418 | }; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 419 | #define VFIO_IOMMU_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12) |
| 420 | struct vfio_iommu_type1_dma_map { |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 421 | __u32 argsz; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 422 | __u32 flags; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 423 | #define VFIO_DMA_MAP_FLAG_READ (1 << 0) |
| 424 | #define VFIO_DMA_MAP_FLAG_WRITE (1 << 1) |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 425 | #define VFIO_DMA_MAP_FLAG_VADDR (1 << 2) |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 426 | __u64 vaddr; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 427 | __u64 iova; |
| 428 | __u64 size; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 429 | }; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 430 | #define VFIO_IOMMU_MAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 13) |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 431 | struct vfio_bitmap { |
| 432 | __u64 pgsize; |
| 433 | __u64 size; |
Elliott Hughes | 0f0c18f | 2023-03-29 15:53:31 -0700 | [diff] [blame] | 434 | __u64 * data; |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 435 | }; |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 436 | struct vfio_iommu_type1_dma_unmap { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 437 | __u32 argsz; |
| 438 | __u32 flags; |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 439 | #define VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP (1 << 0) |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 440 | #define VFIO_DMA_UNMAP_FLAG_ALL (1 << 1) |
| 441 | #define VFIO_DMA_UNMAP_FLAG_VADDR (1 << 2) |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 442 | __u64 iova; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 443 | __u64 size; |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 444 | __u8 data[]; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 445 | }; |
| 446 | #define VFIO_IOMMU_UNMAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 14) |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 447 | #define VFIO_IOMMU_ENABLE _IO(VFIO_TYPE, VFIO_BASE + 15) |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 448 | #define VFIO_IOMMU_DISABLE _IO(VFIO_TYPE, VFIO_BASE + 16) |
Christopher Ferris | 8177cdf | 2020-08-03 11:53:55 -0700 | [diff] [blame] | 449 | struct vfio_iommu_type1_dirty_bitmap { |
| 450 | __u32 argsz; |
| 451 | __u32 flags; |
| 452 | #define VFIO_IOMMU_DIRTY_PAGES_FLAG_START (1 << 0) |
| 453 | #define VFIO_IOMMU_DIRTY_PAGES_FLAG_STOP (1 << 1) |
| 454 | #define VFIO_IOMMU_DIRTY_PAGES_FLAG_GET_BITMAP (1 << 2) |
| 455 | __u8 data[]; |
| 456 | }; |
| 457 | struct vfio_iommu_type1_dirty_bitmap_get { |
| 458 | __u64 iova; |
| 459 | __u64 size; |
| 460 | struct vfio_bitmap bitmap; |
| 461 | }; |
| 462 | #define VFIO_IOMMU_DIRTY_PAGES _IO(VFIO_TYPE, VFIO_BASE + 17) |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 463 | struct vfio_iommu_spapr_tce_ddw_info { |
| 464 | __u64 pgsizes; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 465 | __u32 max_dynamic_windows_supported; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 466 | __u32 levels; |
| 467 | }; |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 468 | struct vfio_iommu_spapr_tce_info { |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 469 | __u32 argsz; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 470 | __u32 flags; |
| 471 | #define VFIO_IOMMU_SPAPR_INFO_DDW (1 << 0) |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 472 | __u32 dma32_window_start; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 473 | __u32 dma32_window_size; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 474 | struct vfio_iommu_spapr_tce_ddw_info ddw; |
Christopher Ferris | 38062f9 | 2014-07-09 15:33:25 -0700 | [diff] [blame] | 475 | }; |
| 476 | #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] | 477 | struct vfio_eeh_pe_err { |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 478 | __u32 type; |
| 479 | __u32 func; |
| 480 | __u64 addr; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 481 | __u64 mask; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 482 | }; |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 483 | struct vfio_eeh_pe_op { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 484 | __u32 argsz; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 485 | __u32 flags; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 486 | __u32 op; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 487 | union { |
| 488 | struct vfio_eeh_pe_err err; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 489 | }; |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 490 | }; |
| 491 | #define VFIO_EEH_PE_DISABLE 0 |
| 492 | #define VFIO_EEH_PE_ENABLE 1 |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 493 | #define VFIO_EEH_PE_UNFREEZE_IO 2 |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 494 | #define VFIO_EEH_PE_UNFREEZE_DMA 3 |
| 495 | #define VFIO_EEH_PE_GET_STATE 4 |
| 496 | #define VFIO_EEH_PE_STATE_NORMAL 0 |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 497 | #define VFIO_EEH_PE_STATE_RESET 1 |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 498 | #define VFIO_EEH_PE_STATE_STOPPED 2 |
| 499 | #define VFIO_EEH_PE_STATE_STOPPED_DMA 4 |
| 500 | #define VFIO_EEH_PE_STATE_UNAVAIL 5 |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 501 | #define VFIO_EEH_PE_RESET_DEACTIVATE 5 |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 502 | #define VFIO_EEH_PE_RESET_HOT 6 |
| 503 | #define VFIO_EEH_PE_RESET_FUNDAMENTAL 7 |
| 504 | #define VFIO_EEH_PE_CONFIGURE 8 |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 505 | #define VFIO_EEH_PE_INJECT_ERR 9 |
Christopher Ferris | 82d7504 | 2015-01-26 10:57:07 -0800 | [diff] [blame] | 506 | #define VFIO_EEH_PE_OP _IO(VFIO_TYPE, VFIO_BASE + 21) |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 507 | struct vfio_iommu_spapr_register_memory { |
| 508 | __u32 argsz; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 509 | __u32 flags; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 510 | __u64 vaddr; |
| 511 | __u64 size; |
| 512 | }; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 513 | #define VFIO_IOMMU_SPAPR_REGISTER_MEMORY _IO(VFIO_TYPE, VFIO_BASE + 17) |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 514 | #define VFIO_IOMMU_SPAPR_UNREGISTER_MEMORY _IO(VFIO_TYPE, VFIO_BASE + 18) |
| 515 | struct vfio_iommu_spapr_tce_create { |
| 516 | __u32 argsz; |
| 517 | __u32 flags; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 518 | __u32 page_shift; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 519 | __u32 __resv1; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 520 | __u64 window_size; |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 521 | __u32 levels; |
| 522 | __u32 __resv2; |
| 523 | __u64 start_addr; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 524 | }; |
| 525 | #define VFIO_IOMMU_SPAPR_TCE_CREATE _IO(VFIO_TYPE, VFIO_BASE + 19) |
| 526 | struct vfio_iommu_spapr_tce_remove { |
| 527 | __u32 argsz; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 528 | __u32 flags; |
| 529 | __u64 start_addr; |
| 530 | }; |
| 531 | #define VFIO_IOMMU_SPAPR_TCE_REMOVE _IO(VFIO_TYPE, VFIO_BASE + 20) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 532 | #endif |