Lines Matching +full:dma +full:- +full:byte +full:- +full:en
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
29 * IOMMU enforces DMA cache coherence (ex. PCIe NoSnoop stripping). This
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
53 * Supports the vaddr flag for DMA map and unmap. Not supported for mediated
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)
163 * Return: 0 on success, -errno on failure.
169 * VFIO_GROUP_UNSET_CONTAINER - _IO(VFIO_TYPE, VFIO_BASE + 5)
178 * Return: 0 on success, -errno on failure.
184 * VFIO_GROUP_GET_DEVICE_FD - _IOW(VFIO_TYPE, VFIO_BASE + 6, char)
190 * Return: new file descriptor on success, -errno on failure.
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.
388 * https://en.wikipedia.org/wiki/Extended_Display_Identification_Data
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)
470 * where GPU RAM is mapped on a system bus. Used by a GPU for DMA routing
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
708 * for devices within the same DMA isolation context. In this case
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 */
838 * VFIO_DEVICE_GET_GFX_DMABUF - _IOW(VFIO_TYPE, VFIO_BASE + 15, __u32)
840 * Return a new dma-buf file descriptor for an exposed guest framebuffer
848 * VFIO_DEVICE_IOEVENTFD - _IOW(VFIO_TYPE, VFIO_BASE + 16,
854 * or at all. vfio-pci currently only enables support for BAR regions,
855 * excluding the MSI-X vector table.
857 * Return: 0 on success, -errno on failure.
862 #define VFIO_DEVICE_IOEVENTFD_8 (1 << 0) /* 1-byte write */
863 #define VFIO_DEVICE_IOEVENTFD_16 (1 << 1) /* 2-byte write */
864 #define VFIO_DEVICE_IOEVENTFD_32 (1 << 2) /* 4-byte write */
865 #define VFIO_DEVICE_IOEVENTFD_64 (1 << 3) /* 8-byte write */
869 __s32 fd; /* -1 for de-assignment */
876 * VFIO_DEVICE_FEATURE - _IOWR(VFIO_TYPE, VFIO_BASE + 17,
889 * Return 0 on success, -errno on failure.
894 #define VFIO_DEVICE_FEATURE_MASK (0xffff) /* 16-bit feature index */
904 * VFIO_DEVICE_BIND_IOMMUFD - _IOR(VFIO_TYPE, VFIO_BASE + 18,
919 * Return: 0 on success, -errno on failure.
931 * VFIO_DEVICE_ATTACH_IOMMUFD_PT - _IOW(VFIO_TYPE, VFIO_BASE + 19,
951 * Return: 0 on success, -errno on failure.
962 * VFIO_DEVICE_DETACH_IOMMUFD_PT - _IOW(VFIO_TYPE, VFIO_BASE + 20,
968 * space. After it, the device should be in a blocking DMA state. This is only
971 * Return: 0 on success, -errno on failure.
983 * PCI SR-IOV PF when SR-IOV is enabled on the PF and there are no existing
984 * open VFs. Data provided when setting this feature is a 16-byte array
1040 * carried over the FD to be opaque and must preserve the byte order of the
1045 * device, data_fd will be -1.
1060 * RUNNING - The device is running normally
1061 * STOP - The device does not change the internal or external state
1062 * STOP_COPY - The device internal state can be read out
1063 * RESUMING - The device is stopped and is loading a new internal state
1064 * ERROR - The device has failed and must be reset
1067 * RUNNING_P2P - RUNNING, except the device cannot do peer to peer DMA
1069 * PRE_COPY - The device is running normally but tracking internal state
1072 * PRE_COPY_P2P - PRE_COPY, except the device cannot do peer to peer DMA
1077 * RUNNING_P2P -> STOP
1078 * STOP_COPY -> STOP
1080 * must not generate interrupts, DMA, or any other change to external state.
1083 * subsystems in the STOP state, for example PCI MSI-X and PCI config space.
1089 * RESUMING -> STOP
1104 * PRE_COPY -> RUNNING
1105 * RUNNING_P2P -> RUNNING
1107 * interrupts, DMA, respond to MMIO, all vfio device regions are functional,
1112 * PRE_COPY_P2P -> RUNNING_P2P
1113 * RUNNING -> RUNNING_P2P
1114 * STOP -> RUNNING_P2P
1120 * RUNNING -> PRE_COPY
1121 * RUNNING_P2P -> PRE_COPY_P2P
1122 * STOP -> STOP_COPY
1134 * in PRE_COPY_P2P -> STOP_COPY.
1136 * PRE_COPY -> PRE_COPY_P2P
1141 * PRE_COPY_P2P -> PRE_COPY
1145 * PRE_COPY_P2P -> STOP_COPY
1155 * STOP -> RESUMING
1163 * STOP_COPY -> PRE_COPY
1164 * STOP_COPY -> PRE_COPY_P2P
1170 * any -> ERROR
1180 * user context where peer-to-peer DMA between devices may be active. The
1182 * any new P2P DMA transactions. If the device can identify P2P transactions
1183 * then it can stop only P2P DMA, otherwise it must stop all DMA. The migration
1193 * - Select the shortest path.
1194 * - The path cannot have saving group states as interior arcs, only
1226 * VFIO_MIG_GET_PRECOPY_INFO - _IO(VFIO_TYPE, VFIO_BASE + 21)
1234 * return -EINVAL from any other migration state.
1242 * data available from the device. This field should have a non-zero initial
1261 * During pre-copy the migration data FD has a temporary "end of stream" that is
1274 * Return: 0 on success, -1 and errno set on failure.
1287 * state with the platform-based power management. Device use of lower power
1296 * device may re-enter the low power state. For single shot low power support
1297 * with wake-up notification, see
1307 * provides an eventfd for wake-up notification. When the device moves out of
1308 * the low power state for the wake-up, the host will not allow the device to
1309 * re-enter a low power state without a subsequent user call to one of the low
1313 * or through any other access (where the wake-up notification has been
1342 * Upon VFIO_DEVICE_FEATURE_SET start/stop device DMA logging.
1344 * DMA logging.
1346 * DMA logging allows a device to internally record what DMAs the device is
1349 * during the pre copy phase of live migration. Only DMA WRITEs are logged,
1352 * When DMA logging is started a range of IOVAs to monitor is provided and the
1354 * DMA that the device initiates inside the range will be logged by the device
1369 * A single call to start device DMA logging can be issued and a matching stop
1387 * Upon VFIO_DEVICE_FEATURE_SET stop device DMA logging that was started
1393 * Upon VFIO_DEVICE_FEATURE_GET read back and clear the device DMA log
1395 * Query the device's DMA log for written pages within the given IOVA range.
1401 * bitmap[(addr - iova)/page_size] & (1ULL << (addr % 64))
1415 * If DMA logging is not enabled, an error will be returned.
1445 * but the in-band device interface lacks the support. Consequently, it is not
1447 * in-band through the configuration space. At present, this feature is supported
1450 * blocking all incoming DMA requests from the device. On the other hand, configuring
1452 * capability to perform DMA to the host memory.
1461 /* -------- API for Type1 VFIO IOMMU -------- */
1464 * VFIO_IOMMU_GET_INFO - _IOR(VFIO_TYPE, VFIO_BASE + 12, struct vfio_iommu_info)
1483 * excluding any non-relaxable reserved regions exposed by
1484 * devices attached to the container. Any DMA map attempt
1527 * The DMA available capability allows to report the current number of
1528 * simultaneously outstanding DMA mappings that are allowed.
1532 * avail: specifies the current number of outstanding DMA mappings allowed.
1544 * VFIO_IOMMU_MAP_DMA - _IOW(VFIO_TYPE, VFIO_BASE + 13, struct vfio_dma_map)
1577 * VFIO_IOMMU_UNMAP_DMA - _IOWR(VFIO_TYPE, VFIO_BASE + 14,
1588 * provide a struct vfio_bitmap in data[]. User must provide zero-allocated
1593 * pages in the range of unmapped size is returned in the user-provided
1597 * must be 0. This cannot be combined with the get-dirty-bitmap flag.
1600 * virtual addresses in the iova range. DMA to already-mapped pages continues.
1602 * This cannot be combined with the get-dirty-bitmap flag.
1625 * VFIO_IOMMU_DIRTY_PAGES - _IOWR(VFIO_TYPE, VFIO_BASE + 17,
1675 /* -------- Additional API for SPAPR TCE (Server POWERPC) IOMMU -------- */
1679 * the details of Dynamic DMA window capability.
1684 * @levels tells the maximum number of levels in multi-level IOMMU tables;
1696 * address ranges available for DMA, these values are programmed into
1699 * The DMA 32 bit window start is an absolute PCI bus address.
1705 * - VFIO_IOMMU_SPAPR_INFO_DDW: informs the userspace that dynamic DMA windows
1721 * - enable/disable EEH functionality;
1722 * - unfreeze IO/DMA for frozen PE;
1723 * - read PE state;
1724 * - reset PE;
1725 * - configure PE;
1726 * - inject EEH error.
1747 #define VFIO_EEH_PE_UNFREEZE_DMA 3 /* Enable DMA for frozen PE */
1751 #define VFIO_EEH_PE_STATE_STOPPED 2 /* Stopped DMA and IO */
1752 #define VFIO_EEH_PE_STATE_STOPPED_DMA 4 /* Stopped DMA only */
1763 …* VFIO_IOMMU_SPAPR_REGISTER_MEMORY - _IOW(VFIO_TYPE, VFIO_BASE + 17, struct vfio_iommu_spapr_regis…
1765 * Registers user space memory where DMA is allowed. It pins
1779 …* VFIO_IOMMU_SPAPR_UNREGISTER_MEMORY - _IOW(VFIO_TYPE, VFIO_BASE + 18, struct vfio_iommu_spapr_reg…
1788 …* VFIO_IOMMU_SPAPR_TCE_CREATE - _IOWR(VFIO_TYPE, VFIO_BASE + 19, struct vfio_iommu_spapr_tce_creat…
1790 * Creates an additional TCE table and programs it (sets a new DMA window)
1794 * It allocates and returns an offset on a PCI bus of the new DMA window.
1811 * VFIO_IOMMU_SPAPR_TCE_REMOVE - _IOW(VFIO_TYPE, VFIO_BASE + 20, struct vfio_iommu_spapr_tce_remove)