Lines Matching +full:lines +full:- +full:initial +full:- +full:states
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
96 /* -------- IOCTLs for VFIO file descriptor (/dev/vfio/vfio) -------- */
99 * VFIO_GET_API_VERSION - _IO(VFIO_TYPE, VFIO_BASE + 0)
110 * VFIO_CHECK_EXTENSION - _IOW(VFIO_TYPE, VFIO_BASE + 1, __u32)
119 * VFIO_SET_IOMMU - _IOW(VFIO_TYPE, VFIO_BASE + 2, __s32)
126 * Return: 0 on success, -errno on failure
131 /* -------- IOCTLs for GROUP file descriptors (/dev/vfio/$GROUP) -------- */
134 * VFIO_GROUP_GET_STATUS - _IOR(VFIO_TYPE, VFIO_BASE + 3,
139 * Return: 0 on succes, -errno on failure.
151 * VFIO_GROUP_SET_CONTAINER - _IOW(VFIO_TYPE, VFIO_BASE + 4, __s32)
159 * Return: 0 on success, -errno on failure.
165 * VFIO_GROUP_UNSET_CONTAINER - _IO(VFIO_TYPE, VFIO_BASE + 5)
169 * an initial state. All device file descriptors must be released
172 * effectively also returning the VFIO file descriptor to an initial
174 * Return: 0 on success, -errno on failure.
180 * VFIO_GROUP_GET_DEVICE_FD - _IOW(VFIO_TYPE, VFIO_BASE + 6, char)
186 * Return: new file descriptor on success, -errno on failure.
191 /* --------------- IOCTLs for DEVICE file descriptors --------------- */
194 * VFIO_DEVICE_GET_INFO - _IOR(VFIO_TYPE, VFIO_BASE + 7,
199 * Return: 0 on success, -errno on failure.
205 #define VFIO_DEVICE_FLAGS_PCI (1 << 1) /* vfio-pci device */
206 #define VFIO_DEVICE_FLAGS_PLATFORM (1 << 2) /* vfio-platform device */
207 #define VFIO_DEVICE_FLAGS_AMBA (1 << 3) /* vfio-amba device */
208 #define VFIO_DEVICE_FLAGS_CCW (1 << 4) /* vfio-ccw device */
209 #define VFIO_DEVICE_FLAGS_AP (1 << 5) /* vfio-ap device */
210 #define VFIO_DEVICE_FLAGS_FSL_MC (1 << 6) /* vfio-fsl-mc device */
224 #define VFIO_DEVICE_API_PCI_STRING "vfio-pci"
225 #define VFIO_DEVICE_API_PLATFORM_STRING "vfio-platform"
226 #define VFIO_DEVICE_API_AMBA_STRING "vfio-amba"
227 #define VFIO_DEVICE_API_CCW_STRING "vfio-ccw"
228 #define VFIO_DEVICE_API_AP_STRING "vfio-ap"
232 * are further-defined in vfio_zdev.h
240 * VFIO_DEVICE_GET_REGION_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 8,
249 * Return: 0 on success, -errno on failure.
269 * areas specified may fail (such as the range covering a PCI MSI-X table) or
293 * vfio-pci. For instance, if we were to go back in time, we might remove
294 * VFIO_PCI_VGA_REGION_INDEX and let vfio-pci simply define that all indexes
297 * means that non-VGA devices wouldn't need to waste this index, and thus the
299 * descriptor offsets in vfio-pci.
328 /* sub-types for VFIO_REGION_TYPE_PCI_* */
330 /* 8086 vendor PCI sub-types */
335 /* 10de vendor PCI sub-types */
343 /* 1014 vendor PCI sub-types */
352 /* sub-types for VFIO_REGION_TYPE_GFX */
356 * struct vfio_region_gfx_edid - EDID region layout.
373 * You can use the edid-decode ulility (comes with xorg-x11-utils) to
387 * (1) set link-state to down.
389 * (3) set link-state to up.
402 /* sub-types for VFIO_REGION_TYPE_CCW */
407 /* sub-types for VFIO_REGION_TYPE_MIGRATION */
440 * which allows direct access to non-MSIX registers which happened to be within
449 * Capability with compressed real address (aka SSA - small system address)
464 * the NVlink2 bridge driver from the bridge's "ibm,nvlink-speed"
480 * VFIO_DEVICE_GET_IRQ_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 9,
486 * using multiple IRQs are primarily intended to support MSI-like
501 * The NORESIZE flag indicates that the interrupt lines within the index
504 * and MSI-X where the driver may only use a subset of the available
506 * upfront. In the case of MSI-X, where the user can enable MSI-X and
524 * VFIO_DEVICE_SET_IRQS - _IOW(VFIO_TYPE, VFIO_BASE + 10, struct vfio_irq_set)
541 * A value of -1 can be used to either de-assign interrupts if already
542 * assigned or skip un-assigned interrupts. For example, to set an eventfd
545 * data = {fd1, -1, fd2}
555 * can be disabled using the -1 value for DATA_EVENTFD or the index can be
558 * Note that ACTION_[UN]MASK specify user->kernel signaling (irqfds) while
559 * ACTION_TRIGGER specifies kernel->user signaling.
584 * VFIO_DEVICE_RESET - _IO(VFIO_TYPE, VFIO_BASE + 11)
591 * The VFIO-PCI bus driver makes use of the following fixed region and
628 * The vfio-ccw bus driver makes use of the following fixed region and
646 * VFIO_DEVICE_GET_PCI_HOT_RESET_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 12,
649 * Return: 0 on success, -errno on failure:
650 * -enospc = insufficient buffer, -enodev = unsupported for device.
669 * VFIO_DEVICE_PCI_HOT_RESET - _IOW(VFIO_TYPE, VFIO_BASE + 13,
672 * Return: 0 on success, -errno on failure.
684 * VFIO_DEVICE_QUERY_GFX_PLANE - _IOW(VFIO_TYPE, VFIO_BASE + 14,
690 * - VFIO_GFX_PLANE_TYPE_PROBE and VFIO_GFX_PLANE_TYPE_DMABUF are set
691 * to ask if the mdev supports dma-buf. 0 on support, -EINVAL on no
692 * support for dma-buf.
693 * - VFIO_GFX_PLANE_TYPE_PROBE and VFIO_GFX_PLANE_TYPE_REGION are set
694 * to ask if the mdev supports region. 0 on support, -EINVAL on no
696 * - VFIO_GFX_PLANE_TYPE_DMABUF or VFIO_GFX_PLANE_TYPE_REGION is set
698 * - Others are invalid and return -EINVAL.
702 * returned with zero-initialized drm_format, size, width and height
706 * Return: 0 on success, -errno on other failure.
729 __u32 dmabuf_id; /* dma-buf id */
736 * VFIO_DEVICE_GET_GFX_DMABUF - _IOW(VFIO_TYPE, VFIO_BASE + 15, __u32)
738 * Return a new dma-buf file descriptor for an exposed guest framebuffer
746 * VFIO_DEVICE_IOEVENTFD - _IOW(VFIO_TYPE, VFIO_BASE + 16,
752 * or at all. vfio-pci currently only enables support for BAR regions,
753 * excluding the MSI-X vector table.
755 * Return: 0 on success, -errno on failure.
760 #define VFIO_DEVICE_IOEVENTFD_8 (1 << 0) /* 1-byte write */
761 #define VFIO_DEVICE_IOEVENTFD_16 (1 << 1) /* 2-byte write */
762 #define VFIO_DEVICE_IOEVENTFD_32 (1 << 2) /* 4-byte write */
763 #define VFIO_DEVICE_IOEVENTFD_64 (1 << 3) /* 8-byte write */
767 __s32 fd; /* -1 for de-assignment */
773 * VFIO_DEVICE_FEATURE - _IOWR(VFIO_TYPE, VFIO_BASE + 17,
786 * Return 0 on success, -errno on failure.
791 #define VFIO_DEVICE_FEATURE_MASK (0xffff) /* 16-bit feature index */
803 * PCI SR-IOV PF when SR-IOV is enabled on the PF and there are no existing
804 * open VFs. Data provided when setting this feature is a 16-byte array
812 * ERROR states are always supported. Support for additional states is
820 * is supported in addition to the STOP_COPY states.
857 * device, data_fd will be -1.
871 * There are 5 states to support VFIO_MIGRATION_STOP_COPY:
872 * RUNNING - The device is running normally
873 * STOP - The device does not change the internal or external state
874 * STOP_COPY - The device internal state can be read out
875 * RESUMING - The device is stopped and is loading a new internal state
876 * ERROR - The device has failed and must be reset
879 * RUNNING_P2P - RUNNING, except the device cannot do peer to peer DMA
881 * The FSM takes actions on the arcs between FSM states. The driver implements
884 * RUNNING_P2P -> STOP
885 * STOP_COPY -> STOP
890 * subsystems in the STOP state, for example PCI MSI-X and PCI config space.
896 * RESUMING -> STOP
906 * While in STOP the device has the same behavior as other STOP states
911 * RUNNING_P2P -> RUNNING
916 * RUNNING -> RUNNING_P2P
917 * STOP -> RUNNING_P2P
921 * STOP -> STOP_COPY
934 * STOP -> RESUMING
942 * any -> ERROR
952 * user context where peer-to-peer DMA between devices may be active. The
953 * RUNNING_P2P states must prevent the device from initiating
957 * FSM arc into a P2P state. For the purpose of specification the states
965 * - Select the shortest path.
972 * revisions of this protocol using new states and those states becoming
975 * The optional states cannot be used with SET_STATE if the device does not
976 * support them. The user can discover if these states are supported by using
978 * avoid knowing about these optional states if the kernel driver supports them.
991 * state with the platform-based power management. Device use of lower power
992 * states depends on factors managed by the runtime power management core,
1000 * device may re-enter the low power state. For single shot low power support
1001 * with wake-up notification, see
1011 * provides an eventfd for wake-up notification. When the device moves out of
1012 * the low power state for the wake-up, the host will not allow the device to
1013 * re-enter a low power state without a subsequent user call to one of the low
1017 * or through any other access (where the wake-up notification has been
1037 * Upon VFIO_DEVICE_FEATURE_SET, disallow use of device low power states as
1105 * bitmap[(addr - iova)/page_size] & (1ULL << (addr % 64))
1131 /* -------- API for Type1 VFIO IOMMU -------- */
1134 * VFIO_IOMMU_GET_INFO - _IOR(VFIO_TYPE, VFIO_BASE + 12, struct vfio_iommu_info)
1152 * excluding any non-relaxable reserved regions exposed by
1213 * VFIO_IOMMU_MAP_DMA - _IOW(VFIO_TYPE, VFIO_BASE + 13, struct vfio_dma_map)
1247 * VFIO_IOMMU_UNMAP_DMA - _IOWR(VFIO_TYPE, VFIO_BASE + 14,
1258 * provide a struct vfio_bitmap in data[]. User must provide zero-allocated
1263 * pages in the range of unmapped size is returned in the user-provided
1267 * must be 0. This cannot be combined with the get-dirty-bitmap flag.
1271 * iova's vaddr will block. DMA to already-mapped pages continues. This
1272 * cannot be combined with the get-dirty-bitmap flag.
1295 * VFIO_IOMMU_DIRTY_PAGES - _IOWR(VFIO_TYPE, VFIO_BASE + 17,
1345 /* -------- Additional API for SPAPR TCE (Server POWERPC) IOMMU -------- */
1354 * @levels tells the maximum number of levels in multi-level IOMMU tables;
1375 * - VFIO_IOMMU_SPAPR_INFO_DDW: informs the userspace that dynamic DMA windows
1391 * - enable/disable EEH functionality;
1392 * - unfreeze IO/DMA for frozen PE;
1393 * - read PE state;
1394 * - reset PE;
1395 * - configure PE;
1396 * - inject EEH error.
1433 …* VFIO_IOMMU_SPAPR_REGISTER_MEMORY - _IOW(VFIO_TYPE, VFIO_BASE + 17, struct vfio_iommu_spapr_regis…
1449 …* VFIO_IOMMU_SPAPR_UNREGISTER_MEMORY - _IOW(VFIO_TYPE, VFIO_BASE + 18, struct vfio_iommu_spapr_reg…
1458 …* VFIO_IOMMU_SPAPR_TCE_CREATE - _IOWR(VFIO_TYPE, VFIO_BASE + 19, struct vfio_iommu_spapr_tce_creat…
1481 * VFIO_IOMMU_SPAPR_TCE_REMOVE - _IOW(VFIO_TYPE, VFIO_BASE + 20, struct vfio_iommu_spapr_tce_remove)