Lines Matching +full:application +full:- +full:specific
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
72 * while the version field is specific to the capability id. The
73 * contents following the header are specific to the capability id.
77 __u16 version; /* Version specific to the capability ID */
90 /* -------- IOCTLs for VFIO file descriptor (/dev/vfio/vfio) -------- */
93 * VFIO_GET_API_VERSION - _IO(VFIO_TYPE, VFIO_BASE + 0)
104 * VFIO_CHECK_EXTENSION - _IOW(VFIO_TYPE, VFIO_BASE + 1, __u32)
113 * VFIO_SET_IOMMU - _IOW(VFIO_TYPE, VFIO_BASE + 2, __s32)
119 * specific to the value set.
120 * Return: 0 on success, -errno on failure
125 /* -------- IOCTLs for GROUP file descriptors (/dev/vfio/$GROUP) -------- */
128 * VFIO_GROUP_GET_STATUS - _IOR(VFIO_TYPE, VFIO_BASE + 3,
133 * Return: 0 on succes, -errno on failure.
145 * VFIO_GROUP_SET_CONTAINER - _IOW(VFIO_TYPE, VFIO_BASE + 4, __s32)
153 * Return: 0 on success, -errno on failure.
159 * VFIO_GROUP_UNSET_CONTAINER - _IO(VFIO_TYPE, VFIO_BASE + 5)
168 * Return: 0 on success, -errno on failure.
174 * VFIO_GROUP_GET_DEVICE_FD - _IOW(VFIO_TYPE, VFIO_BASE + 6, char)
180 * Return: new file descriptor on success, -errno on failure.
185 /* --------------- IOCTLs for DEVICE file descriptors --------------- */
188 * VFIO_DEVICE_GET_INFO - _IOR(VFIO_TYPE, VFIO_BASE + 7,
193 * Return: 0 on success, -errno on failure.
199 #define VFIO_DEVICE_FLAGS_PCI (1 << 1) /* vfio-pci device */
200 #define VFIO_DEVICE_FLAGS_PLATFORM (1 << 2) /* vfio-platform device */
201 #define VFIO_DEVICE_FLAGS_AMBA (1 << 3) /* vfio-amba device */
202 #define VFIO_DEVICE_FLAGS_CCW (1 << 4) /* vfio-ccw device */
203 #define VFIO_DEVICE_FLAGS_AP (1 << 5) /* vfio-ap device */
204 #define VFIO_DEVICE_FLAGS_FSL_MC (1 << 6) /* vfio-fsl-mc device */
218 #define VFIO_DEVICE_API_PCI_STRING "vfio-pci"
219 #define VFIO_DEVICE_API_PLATFORM_STRING "vfio-platform"
220 #define VFIO_DEVICE_API_AMBA_STRING "vfio-amba"
221 #define VFIO_DEVICE_API_CCW_STRING "vfio-ccw"
222 #define VFIO_DEVICE_API_AP_STRING "vfio-ap"
226 * are further-defined in vfio_zdev.h
234 * VFIO_DEVICE_GET_REGION_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 8,
239 * Implementation of region mapping is bus driver specific. This is
240 * intended to describe MMIO, I/O port, as well as bus specific
243 * Return: 0 on success, -errno on failure.
263 * areas specified may fail (such as the range covering a PCI MSI-X table) or
283 * The device specific type capability allows regions unique to a specific
287 * vfio-pci. For instance, if we were to go back in time, we might remove
288 * VFIO_PCI_VGA_REGION_INDEX and let vfio-pci simply define that all indexes
289 * greater than or equal to VFIO_PCI_NUM_REGIONS are device specific and we'd
290 * make a "VGA" device specific type to describe the VGA access space. This
291 * means that non-VGA devices wouldn't need to waste this index, and thus the
293 * descriptor offsets in vfio-pci.
307 __u32 subtype; /* type specific */
322 /* sub-types for VFIO_REGION_TYPE_PCI_* */
324 /* 8086 vendor PCI sub-types */
329 /* 10de vendor PCI sub-types */
335 /* 1014 vendor PCI sub-types */
342 /* sub-types for VFIO_REGION_TYPE_GFX */
346 * struct vfio_region_gfx_edid - EDID region layout.
363 * You can use the edid-decode ulility (comes with xorg-x11-utils) to
377 * (1) set link-state to down.
379 * (3) set link-state to up.
392 /* sub-types for VFIO_REGION_TYPE_CCW */
397 /* sub-types for VFIO_REGION_TYPE_MIGRATION */
408 * - The user application writes to this field to inform the vendor driver
410 * - The vendor driver should take the necessary actions to change the
414 * should return an appropriate -errno for the fault condition.
415 * - On the user application side, if the device state transition fails,
419 * - The vendor driver should return previous state of the device unless
422 * - The user application must use the device reset ioctl to recover the
425 * user application may attempt to transition the device to any valid
429 * - If bit 0 is set, it indicates the _RUNNING state. If bit 0 is clear,
432 * - If bit 1 is set, it indicates the _SAVING state, which means that the
434 * provided to the VFIO user application to save the device's state.
435 * - If bit 2 is set, it indicates the _RESUMING state, which means that
438 * Bits 3 - 31 are reserved for future use. To preserve them, the user
439 * application should perform a read-modify-write operation on this
442 * +------- _RESUMING
443 * |+------ _SAVING
444 * ||+----- _RUNNING
448 * 010b => Stop the device & save the device state, stop-and-copy state
449 * 011b => Device running and save the device state, pre-copy state
457 * _RESUMING _RUNNING Pre-copy Stop-and-copy _STOP
463 * |------------------------------------->|
466 * |------------------------->|---------->|
469 * |----------->|------------>|---------->|
472 * |<---------|
475 * |--------->|
477 * 0. Default state of VFIO device is _RUNNING when the user application starts.
478 * 1. During normal shutdown of the user application, the user application may
482 * 2. When the user application saves state or suspends the application, the
483 * device state transitions from _RUNNING to stop-and-copy and then to _STOP.
484 * On state transition from _RUNNING to stop-and-copy, driver must stop the
485 * device, save the device state and send it to the application through the
488 * 3. In live migration of user application, the state transitions from _RUNNING
489 * to pre-copy, to stop-and-copy, and to _STOP.
490 * On state transition from _RUNNING to pre-copy, the driver should start
491 * gathering the device state while the application is still running and send
492 * the device state data to application through the migration region.
493 * On state transition from pre-copy to stop-and-copy, the driver must stop
494 * the device, save the device state and send it to the user application
496 * Vendor drivers must support the pre-copy state even for implementations
497 * where no data is provided to the user before the stop-and-copy state. The
499 * transitions to a new state, including the stop-and-copy state.
505 * 5. After providing saved device data to the driver, the application should
515 * The user application should read data_offset field from the migration
516 * region. The user application should read the device data from this
522 * The user application should read data_size to get the size in bytes of
528 * ------------------------------------------------------------------
531 * ------------------------------------------------------------------
533 * offset 0-trapped part data_offset
548 * The sequence to be followed while in pre-copy state and stop-and-copy state
553 * If pending_bytes == 0, the user application should not iterate to get data
563 * the current buffer if the user application reads data_offset and
571 * The user application can transition from the _SAVING|_RUNNING
572 * (pre-copy state) to the _SAVING (stop-and-copy) state regardless of the
573 * number of pending bytes. The user application should iterate in _SAVING
574 * (stop-and-copy) until pending_bytes is 0.
578 * a. Read data_offset from where the user application should write data.
584 * user-provided migration region data to the device resume state.
588 * loop. The user application should then take the next necessary action, for
589 * example, failing migration or terminating the user application.
591 * For the user application, data is opaque. The user application should write
626 * which allows direct access to non-MSIX registers which happened to be within
635 * Capability with compressed real address (aka SSA - small system address)
648 * the NVlink2 bridge driver from the bridge's "ibm,nvlink-speed"
662 * VFIO_DEVICE_GET_IRQ_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 9,
667 * Implementation of IRQ mapping is bus driver specific. Indexes
668 * using multiple IRQs are primarily intended to support MSI-like
686 * and MSI-X where the driver may only use a subset of the available
687 * indexes, but VFIO needs to enable a specific number of vectors
688 * upfront. In the case of MSI-X, where the user can enable MSI-X and
706 * VFIO_DEVICE_SET_IRQS - _IOW(VFIO_TYPE, VFIO_BASE + 10, struct vfio_irq_set)
723 * A value of -1 can be used to either de-assign interrupts if already
724 * assigned or skip un-assigned interrupts. For example, to set an eventfd
727 * data = {fd1, -1, fd2}
737 * can be disabled using the -1 value for DATA_EVENTFD or the index can be
740 * Note that ACTION_[UN]MASK specify user->kernel signaling (irqfds) while
741 * ACTION_TRIGGER specifies kernel->user signaling.
766 * VFIO_DEVICE_RESET - _IO(VFIO_TYPE, VFIO_BASE + 11)
773 * The VFIO-PCI bus driver makes use of the following fixed region and
797 /* device specific cap to define content. */
810 * The vfio-ccw bus driver makes use of the following fixed region and
827 * VFIO_DEVICE_GET_PCI_HOT_RESET_INFO - _IORW(VFIO_TYPE, VFIO_BASE + 12,
830 * Return: 0 on success, -errno on failure:
831 * -enospc = insufficient buffer, -enodev = unsupported for device.
850 * VFIO_DEVICE_PCI_HOT_RESET - _IOW(VFIO_TYPE, VFIO_BASE + 13,
853 * Return: 0 on success, -errno on failure.
865 * VFIO_DEVICE_QUERY_GFX_PLANE - _IOW(VFIO_TYPE, VFIO_BASE + 14,
871 * - VFIO_GFX_PLANE_TYPE_PROBE and VFIO_GFX_PLANE_TYPE_DMABUF are set
872 * to ask if the mdev supports dma-buf. 0 on support, -EINVAL on no
873 * support for dma-buf.
874 * - VFIO_GFX_PLANE_TYPE_PROBE and VFIO_GFX_PLANE_TYPE_REGION are set
875 * to ask if the mdev supports region. 0 on support, -EINVAL on no
877 * - VFIO_GFX_PLANE_TYPE_DMABUF or VFIO_GFX_PLANE_TYPE_REGION is set
879 * - Others are invalid and return -EINVAL.
883 * returned with zero-initialized drm_format, size, width and height
887 * Return: 0 on success, -errno on other failure.
910 __u32 dmabuf_id; /* dma-buf id */
917 * VFIO_DEVICE_GET_GFX_DMABUF - _IOW(VFIO_TYPE, VFIO_BASE + 15, __u32)
919 * Return a new dma-buf file descriptor for an exposed guest framebuffer
927 * VFIO_DEVICE_IOEVENTFD - _IOW(VFIO_TYPE, VFIO_BASE + 16,
933 * or at all. vfio-pci currently only enables support for BAR regions,
934 * excluding the MSI-X vector table.
936 * Return: 0 on success, -errno on failure.
941 #define VFIO_DEVICE_IOEVENTFD_8 (1 << 0) /* 1-byte write */
942 #define VFIO_DEVICE_IOEVENTFD_16 (1 << 1) /* 2-byte write */
943 #define VFIO_DEVICE_IOEVENTFD_32 (1 << 2) /* 4-byte write */
944 #define VFIO_DEVICE_IOEVENTFD_64 (1 << 3) /* 8-byte write */
948 __s32 fd; /* -1 for de-assignment */
954 * VFIO_DEVICE_FEATURE - _IORW(VFIO_TYPE, VFIO_BASE + 17,
964 * specific to the given feature. The data portion is not required for
967 * Return 0 on success, -errno on failure.
972 #define VFIO_DEVICE_FEATURE_MASK (0xffff) /* 16-bit feature index */
984 * PCI SR-IOV PF when SR-IOV is enabled on the PF and there are no existing
985 * open VFs. Data provided when setting this feature is a 16-byte array
990 /* -------- API for Type1 VFIO IOMMU -------- */
993 * VFIO_IOMMU_GET_INFO - _IOR(VFIO_TYPE, VFIO_BASE + 12, struct vfio_iommu_info)
1011 * excluding any non-relaxable reserved regions exposed by
1072 * VFIO_IOMMU_MAP_DMA - _IOW(VFIO_TYPE, VFIO_BASE + 13, struct vfio_dma_map)
1096 * VFIO_IOMMU_UNMAP_DMA - _IOWR(VFIO_TYPE, VFIO_BASE + 14,
1106 * provide a struct vfio_bitmap in data[]. User must provide zero-allocated
1111 * pages in the range of unmapped size is returned in the user-provided
1133 * VFIO_IOMMU_DIRTY_PAGES - _IOWR(VFIO_TYPE, VFIO_BASE + 17,
1142 * are logged until logging is disabled by user application by calling the IOCTL
1183 /* -------- Additional API for SPAPR TCE (Server POWERPC) IOMMU -------- */
1192 * @levels tells the maximum number of levels in multi-level IOMMU tables;
1213 * - VFIO_IOMMU_SPAPR_INFO_DDW: informs the userspace that dynamic DMA windows
1229 * - enable/disable EEH functionality;
1230 * - unfreeze IO/DMA for frozen PE;
1231 * - read PE state;
1232 * - reset PE;
1233 * - configure PE;
1234 * - inject EEH error.
1271 …* VFIO_IOMMU_SPAPR_REGISTER_MEMORY - _IOW(VFIO_TYPE, VFIO_BASE + 17, struct vfio_iommu_spapr_regis…
1287 …* VFIO_IOMMU_SPAPR_UNREGISTER_MEMORY - _IOW(VFIO_TYPE, VFIO_BASE + 18, struct vfio_iommu_spapr_reg…
1296 …* VFIO_IOMMU_SPAPR_TCE_CREATE - _IOWR(VFIO_TYPE, VFIO_BASE + 19, struct vfio_iommu_spapr_tce_creat…
1319 * VFIO_IOMMU_SPAPR_TCE_REMOVE - _IOW(VFIO_TYPE, VFIO_BASE + 20, struct vfio_iommu_spapr_tce_remove)