Lines Matching +full:container +full:- +full:rules

1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
37 /* Two-stage IOMMU */
43 * The No-IOMMU IOMMU offers no translation or isolation for devices and
44 * supports no ioctls outside of VFIO_CHECK_EXTENSION. Use of VFIO's No-IOMMU
100 /* -------- IOCTLs for VFIO file descriptor (/dev/vfio/vfio) -------- */
103 * VFIO_GET_API_VERSION - _IO(VFIO_TYPE, VFIO_BASE + 0)
114 * VFIO_CHECK_EXTENSION - _IOW(VFIO_TYPE, VFIO_BASE + 1, __u32)
123 * VFIO_SET_IOMMU - _IOW(VFIO_TYPE, VFIO_BASE + 2, __s32)
130 * Return: 0 on success, -errno on failure
135 /* -------- IOCTLs for GROUP file descriptors (/dev/vfio/$GROUP) -------- */
138 * VFIO_GROUP_GET_STATUS - _IOR(VFIO_TYPE, VFIO_BASE + 3,
143 * Return: 0 on succes, -errno on failure.
155 * VFIO_GROUP_SET_CONTAINER - _IOW(VFIO_TYPE, VFIO_BASE + 4, __s32)
157 * Set the container for the VFIO group to the open VFIO file
159 * container. Containers may, at their discretion, support multiple
160 * groups. Only when a container is set are all of the interfaces
163 * Return: 0 on success, -errno on failure.
169 * VFIO_GROUP_UNSET_CONTAINER - _IO(VFIO_TYPE, VFIO_BASE + 5)
171 * Remove the group from the attached container. This is the
175 * from a container, the IOMMU will be disabled and all state lost,
178 * Return: 0 on success, -errno on failure.
179 * Availability: When attached to container
184 * VFIO_GROUP_GET_DEVICE_FD - _IOW(VFIO_TYPE, VFIO_BASE + 6, char)
190 * Return: new file descriptor on success, -errno on failure.
191 * Availability: When attached to container
195 /* --------------- IOCTLs for DEVICE file descriptors --------------- */
198 * VFIO_DEVICE_GET_INFO - _IOR(VFIO_TYPE, VFIO_BASE + 7,
203 * Return: 0 on success, -errno on failure.
209 #define VFIO_DEVICE_FLAGS_PCI (1 << 1) /* vfio-pci device */
210 #define VFIO_DEVICE_FLAGS_PLATFORM (1 << 2) /* vfio-platform device */
211 #define VFIO_DEVICE_FLAGS_AMBA (1 << 3) /* vfio-amba device */
212 #define VFIO_DEVICE_FLAGS_CCW (1 << 4) /* vfio-ccw device */
213 #define VFIO_DEVICE_FLAGS_AP (1 << 5) /* vfio-ap device */
214 #define VFIO_DEVICE_FLAGS_FSL_MC (1 << 6) /* vfio-fsl-mc device */
216 #define VFIO_DEVICE_FLAGS_CDX (1 << 8) /* vfio-cdx device */
230 #define VFIO_DEVICE_API_PCI_STRING "vfio-pci"
231 #define VFIO_DEVICE_API_PLATFORM_STRING "vfio-platform"
232 #define VFIO_DEVICE_API_AMBA_STRING "vfio-amba"
233 #define VFIO_DEVICE_API_CCW_STRING "vfio-ccw"
234 #define VFIO_DEVICE_API_AP_STRING "vfio-ap"
238 * are further-defined in vfio_zdev.h
260 * VFIO_DEVICE_GET_REGION_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 8,
269 * Return: 0 on success, -errno on failure.
289 * areas specified may fail (such as the range covering a PCI MSI-X table) or
313 * vfio-pci. For instance, if we were to go back in time, we might remove
314 * VFIO_PCI_VGA_REGION_INDEX and let vfio-pci simply define that all indexes
317 * means that non-VGA devices wouldn't need to waste this index, and thus the
319 * descriptor offsets in vfio-pci.
348 /* sub-types for VFIO_REGION_TYPE_PCI_* */
350 /* 8086 vendor PCI sub-types */
355 /* 10de vendor PCI sub-types */
363 /* 1014 vendor PCI sub-types */
372 /* sub-types for VFIO_REGION_TYPE_GFX */
376 * struct vfio_region_gfx_edid - EDID region layout.
393 * You can use the edid-decode ulility (comes with xorg-x11-utils) to
407 * (1) set link-state to down.
409 * (3) set link-state to up.
422 /* sub-types for VFIO_REGION_TYPE_CCW */
427 /* sub-types for VFIO_REGION_TYPE_MIGRATION */
460 * which allows direct access to non-MSIX registers which happened to be within
469 * Capability with compressed real address (aka SSA - small system address)
484 * the NVlink2 bridge driver from the bridge's "ibm,nvlink-speed"
500 * VFIO_DEVICE_GET_IRQ_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 9,
506 * using multiple IRQs are primarily intended to support MSI-like
524 * and MSI-X where the driver may only use a subset of the available
526 * upfront. In the case of MSI-X, where the user can enable MSI-X and
547 * VFIO_DEVICE_SET_IRQS - _IOW(VFIO_TYPE, VFIO_BASE + 10, struct vfio_irq_set)
564 * A value of -1 can be used to either de-assign interrupts if already
565 * assigned or skip un-assigned interrupts. For example, to set an eventfd
568 * data = {fd1, -1, fd2}
578 * can be disabled using the -1 value for DATA_EVENTFD or the index can be
581 * Note that ACTION_[UN]MASK specify user->kernel signaling (irqfds) while
582 * ACTION_TRIGGER specifies kernel->user signaling.
607 * VFIO_DEVICE_RESET - _IO(VFIO_TYPE, VFIO_BASE + 11)
614 * The VFIO-PCI bus driver makes use of the following fixed region and
651 * The vfio-ccw bus driver makes use of the following fixed region and
669 * The vfio-ap bus driver makes use of the following IRQ index mapping.
678 * VFIO_DEVICE_GET_PCI_HOT_RESET_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 12,
688 * - If the calling device is opened via the traditional group/container
693 * - If the calling device is opened as a cdev, devid is reported.
700 * the cdev calling conventions do not support a proof-of-ownership
715 * of VFIO_DEVICE_PCI_HOT_RESET ioctl outside of the proof-of-ownership
725 * Return: 0 on success, -errno on failure:
726 * -enospc = insufficient buffer, -enodev = unsupported for device.
733 #define VFIO_PCI_DEVID_NOT_OWNED -1
752 * VFIO_DEVICE_PCI_HOT_RESET - _IOW(VFIO_TYPE, VFIO_BASE + 13,
773 * Return: 0 on success, -errno on failure.
785 * VFIO_DEVICE_QUERY_GFX_PLANE - _IOW(VFIO_TYPE, VFIO_BASE + 14,
791 * - VFIO_GFX_PLANE_TYPE_PROBE and VFIO_GFX_PLANE_TYPE_DMABUF are set
792 * to ask if the mdev supports dma-buf. 0 on support, -EINVAL on no
793 * support for dma-buf.
794 * - VFIO_GFX_PLANE_TYPE_PROBE and VFIO_GFX_PLANE_TYPE_REGION are set
795 * to ask if the mdev supports region. 0 on support, -EINVAL on no
797 * - VFIO_GFX_PLANE_TYPE_DMABUF or VFIO_GFX_PLANE_TYPE_REGION is set
799 * - Others are invalid and return -EINVAL.
803 * returned with zero-initialized drm_format, size, width and height
807 * Return: 0 on success, -errno on other failure.
830 __u32 dmabuf_id; /* dma-buf id */
837 * VFIO_DEVICE_GET_GFX_DMABUF - _IOW(VFIO_TYPE, VFIO_BASE + 15, __u32)
839 * Return a new dma-buf file descriptor for an exposed guest framebuffer
847 * VFIO_DEVICE_IOEVENTFD - _IOW(VFIO_TYPE, VFIO_BASE + 16,
853 * or at all. vfio-pci currently only enables support for BAR regions,
854 * excluding the MSI-X vector table.
856 * Return: 0 on success, -errno on failure.
861 #define VFIO_DEVICE_IOEVENTFD_8 (1 << 0) /* 1-byte write */
862 #define VFIO_DEVICE_IOEVENTFD_16 (1 << 1) /* 2-byte write */
863 #define VFIO_DEVICE_IOEVENTFD_32 (1 << 2) /* 4-byte write */
864 #define VFIO_DEVICE_IOEVENTFD_64 (1 << 3) /* 8-byte write */
868 __s32 fd; /* -1 for de-assignment */
874 * VFIO_DEVICE_FEATURE - _IOWR(VFIO_TYPE, VFIO_BASE + 17,
887 * Return 0 on success, -errno on failure.
892 #define VFIO_DEVICE_FEATURE_MASK (0xffff) /* 16-bit feature index */
902 * VFIO_DEVICE_BIND_IOMMUFD - _IOR(VFIO_TYPE, VFIO_BASE + 18,
917 * Return: 0 on success, -errno on failure.
929 * VFIO_DEVICE_ATTACH_IOMMUFD_PT - _IOW(VFIO_TYPE, VFIO_BASE + 19,
949 * Return: 0 on success, -errno on failure.
960 * VFIO_DEVICE_DETACH_IOMMUFD_PT - _IOW(VFIO_TYPE, VFIO_BASE + 20,
969 * Return: 0 on success, -errno on failure.
981 * PCI SR-IOV PF when SR-IOV is enabled on the PF and there are no existing
982 * open VFs. Data provided when setting this feature is a 16-byte array
1043 * device, data_fd will be -1.
1058 * RUNNING - The device is running normally
1059 * STOP - The device does not change the internal or external state
1060 * STOP_COPY - The device internal state can be read out
1061 * RESUMING - The device is stopped and is loading a new internal state
1062 * ERROR - The device has failed and must be reset
1065 * RUNNING_P2P - RUNNING, except the device cannot do peer to peer DMA
1067 * PRE_COPY - The device is running normally but tracking internal state
1070 * PRE_COPY_P2P - PRE_COPY, except the device cannot do peer to peer DMA
1075 * RUNNING_P2P -> STOP
1076 * STOP_COPY -> STOP
1081 * subsystems in the STOP state, for example PCI MSI-X and PCI config space.
1087 * RESUMING -> STOP
1102 * PRE_COPY -> RUNNING
1103 * RUNNING_P2P -> RUNNING
1110 * PRE_COPY_P2P -> RUNNING_P2P
1111 * RUNNING -> RUNNING_P2P
1112 * STOP -> RUNNING_P2P
1118 * RUNNING -> PRE_COPY
1119 * RUNNING_P2P -> PRE_COPY_P2P
1120 * STOP -> STOP_COPY
1132 * in PRE_COPY_P2P -> STOP_COPY.
1134 * PRE_COPY -> PRE_COPY_P2P
1139 * PRE_COPY_P2P -> PRE_COPY
1143 * PRE_COPY_P2P -> STOP_COPY
1153 * STOP -> RESUMING
1161 * STOP_COPY -> PRE_COPY
1162 * STOP_COPY -> PRE_COPY_P2P
1168 * any -> ERROR
1178 * user context where peer-to-peer DMA between devices may be active. The
1190 * should be selected based on the following rules:
1191 * - Select the shortest path.
1192 * - The path cannot have saving group states as interior arcs, only
1223 * VFIO_MIG_GET_PRECOPY_INFO - _IO(VFIO_TYPE, VFIO_BASE + 21)
1231 * return -EINVAL from any other migration state.
1239 * data available from the device. This field should have a non-zero initial
1258 * During pre-copy the migration data FD has a temporary "end of stream" that is
1271 * Return: 0 on success, -1 and errno set on failure.
1284 * state with the platform-based power management. Device use of lower power
1293 * device may re-enter the low power state. For single shot low power support
1294 * with wake-up notification, see
1304 * provides an eventfd for wake-up notification. When the device moves out of
1305 * the low power state for the wake-up, the host will not allow the device to
1306 * re-enter a low power state without a subsequent user call to one of the low
1310 * or through any other access (where the wake-up notification has been
1398 * bitmap[(addr - iova)/page_size] & (1ULL << (addr % 64))
1437 /* -------- API for Type1 VFIO IOMMU -------- */
1440 * VFIO_IOMMU_GET_INFO - _IOR(VFIO_TYPE, VFIO_BASE + 12, struct vfio_iommu_info)
1459 * excluding any non-relaxable reserved regions exposed by
1460 * devices attached to the container. Any DMA map attempt
1520 * VFIO_IOMMU_MAP_DMA - _IOW(VFIO_TYPE, VFIO_BASE + 13, struct vfio_dma_map)
1553 * VFIO_IOMMU_UNMAP_DMA - _IOWR(VFIO_TYPE, VFIO_BASE + 14,
1564 * provide a struct vfio_bitmap in data[]. User must provide zero-allocated
1569 * pages in the range of unmapped size is returned in the user-provided
1573 * must be 0. This cannot be combined with the get-dirty-bitmap flag.
1576 * virtual addresses in the iova range. DMA to already-mapped pages continues.
1577 * Groups may not be added to the container while any addresses are invalid.
1578 * This cannot be combined with the get-dirty-bitmap flag.
1594 * IOCTLs to enable/disable IOMMU container usage.
1601 * VFIO_IOMMU_DIRTY_PAGES - _IOWR(VFIO_TYPE, VFIO_BASE + 17,
1617 * returns the dirty pages bitmap for IOMMU container for a given IOVA range.
1651 /* -------- Additional API for SPAPR TCE (Server POWERPC) IOMMU -------- */
1660 * @levels tells the maximum number of levels in multi-level IOMMU tables;
1681 * - VFIO_IOMMU_SPAPR_INFO_DDW: informs the userspace that dynamic DMA windows
1697 * - enable/disable EEH functionality;
1698 * - unfreeze IO/DMA for frozen PE;
1699 * - read PE state;
1700 * - reset PE;
1701 * - configure PE;
1702 * - inject EEH error.
1739 …* VFIO_IOMMU_SPAPR_REGISTER_MEMORY - _IOW(VFIO_TYPE, VFIO_BASE + 17, struct vfio_iommu_spapr_regis…
1755 …* VFIO_IOMMU_SPAPR_UNREGISTER_MEMORY - _IOW(VFIO_TYPE, VFIO_BASE + 18, struct vfio_iommu_spapr_reg…
1764 …* VFIO_IOMMU_SPAPR_TCE_CREATE - _IOWR(VFIO_TYPE, VFIO_BASE + 19, struct vfio_iommu_spapr_tce_creat…
1767 * to every IOMMU group in the container. It receives page shift, window
1787 * VFIO_IOMMU_SPAPR_TCE_REMOVE - _IOW(VFIO_TYPE, VFIO_BASE + 20, struct vfio_iommu_spapr_tce_remove)
1789 * Unprograms a TCE table from all groups in the container and destroys it.