include/uapi/linux/vfio.h
Source file repositories/reference/linux-study-clean/include/uapi/linux/vfio.h
File Facts
- System
- Linux kernel
- Corpus path
include/uapi/linux/vfio.h- Extension
.h- Size
- 75039 bytes
- Lines
- 1903
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/ioctl.hlinux/stddef.h
Detected Declarations
struct vfio_info_cap_headerstruct vfio_group_statusstruct vfio_device_infostruct vfio_device_info_cap_pci_atomic_compstruct vfio_region_infostruct vfio_region_sparse_mmap_areastruct vfio_region_info_cap_sparse_mmapstruct vfio_region_info_cap_typestruct vfio_region_gfx_edidstruct vfio_device_migration_infostruct vfio_region_info_cap_nvlink2_ssatgtstruct vfio_region_info_cap_nvlink2_lnkspdstruct vfio_irq_infostruct vfio_irq_setstruct vfio_pci_dependent_devicestruct vfio_pci_hot_reset_infostruct vfio_pci_hot_resetstruct vfio_device_gfx_plane_infostruct vfio_device_ioeventfdstruct vfio_device_featurestruct vfio_device_bind_iommufdstruct vfio_device_attach_iommufd_ptstruct vfio_device_detach_iommufd_ptstruct vfio_device_feature_migrationstruct vfio_device_feature_mig_statestruct vfio_precopy_infostruct vfio_device_low_power_entry_with_wakeupstruct vfio_device_feature_dma_logging_controlstruct vfio_device_feature_dma_logging_rangestruct vfio_device_feature_dma_logging_reportstruct vfio_device_feature_mig_data_sizestruct vfio_device_feature_bus_masterstruct vfio_region_dma_rangestruct vfio_device_feature_dma_bufstruct vfio_iommu_type1_infostruct vfio_iova_rangestruct vfio_iommu_type1_info_cap_iova_rangestruct vfio_iommu_type1_info_cap_migrationstruct vfio_iommu_type1_info_dma_availstruct vfio_iommu_type1_dma_mapstruct vfio_bitmapstruct vfio_iommu_type1_dma_unmapstruct vfio_iommu_type1_dirty_bitmapstruct vfio_iommu_type1_dirty_bitmap_getstruct vfio_iommu_spapr_tce_ddw_infostruct vfio_iommu_spapr_tce_infostruct vfio_eeh_pe_errstruct vfio_eeh_pe_op
Annotated Snippet
struct vfio_info_cap_header {
__u16 id; /* Identifies capability */
__u16 version; /* Version specific to the capability ID */
__u32 next; /* Offset of next capability */
};
/*
* Callers of INFO ioctls passing insufficiently sized buffers will see
* the capability chain flag bit set, a zero value for the first capability
* offset (if available within the provided argsz), and argsz will be
* updated to report the necessary buffer size. For compatibility, the
* INFO ioctl will not report error in this case, but the capability chain
* will not be available.
*/
/* -------- IOCTLs for VFIO file descriptor (/dev/vfio/vfio) -------- */
/**
* VFIO_GET_API_VERSION - _IO(VFIO_TYPE, VFIO_BASE + 0)
*
* Report the version of the VFIO API. This allows us to bump the entire
* API version should we later need to add or change features in incompatible
* ways.
* Return: VFIO_API_VERSION
* Availability: Always
*/
#define VFIO_GET_API_VERSION _IO(VFIO_TYPE, VFIO_BASE + 0)
/**
* VFIO_CHECK_EXTENSION - _IOW(VFIO_TYPE, VFIO_BASE + 1, __u32)
*
* Check whether an extension is supported.
* Return: 0 if not supported, 1 (or some other positive integer) if supported.
* Availability: Always
*/
#define VFIO_CHECK_EXTENSION _IO(VFIO_TYPE, VFIO_BASE + 1)
/**
* VFIO_SET_IOMMU - _IOW(VFIO_TYPE, VFIO_BASE + 2, __s32)
*
* Set the iommu to the given type. The type must be supported by an
* iommu driver as verified by calling CHECK_EXTENSION using the same
* type. A group must be set to this file descriptor before this
* ioctl is available. The IOMMU interfaces enabled by this call are
* specific to the value set.
* Return: 0 on success, -errno on failure
* Availability: When VFIO group attached
*/
#define VFIO_SET_IOMMU _IO(VFIO_TYPE, VFIO_BASE + 2)
/* -------- IOCTLs for GROUP file descriptors (/dev/vfio/$GROUP) -------- */
/**
* VFIO_GROUP_GET_STATUS - _IOR(VFIO_TYPE, VFIO_BASE + 3,
* struct vfio_group_status)
*
* Retrieve information about the group. Fills in provided
* struct vfio_group_info. Caller sets argsz.
* Return: 0 on success, -errno on failure.
* Availability: Always
*/
struct vfio_group_status {
__u32 argsz;
__u32 flags;
#define VFIO_GROUP_FLAGS_VIABLE (1 << 0)
#define VFIO_GROUP_FLAGS_CONTAINER_SET (1 << 1)
};
#define VFIO_GROUP_GET_STATUS _IO(VFIO_TYPE, VFIO_BASE + 3)
/**
* VFIO_GROUP_SET_CONTAINER - _IOW(VFIO_TYPE, VFIO_BASE + 4, __s32)
*
* Set the container for the VFIO group to the open VFIO file
* descriptor provided. Groups may only belong to a single
* container. Containers may, at their discretion, support multiple
* groups. Only when a container is set are all of the interfaces
* of the VFIO file descriptor and the VFIO group file descriptor
* available to the user.
* Return: 0 on success, -errno on failure.
* Availability: Always
*/
#define VFIO_GROUP_SET_CONTAINER _IO(VFIO_TYPE, VFIO_BASE + 4)
/**
* VFIO_GROUP_UNSET_CONTAINER - _IO(VFIO_TYPE, VFIO_BASE + 5)
*
* Remove the group from the attached container. This is the
* opposite of the SET_CONTAINER call and returns the group to
* an initial state. All device file descriptors must be released
* prior to calling this interface. When removing the last group
Annotation
- Immediate include surface: `linux/types.h`, `linux/ioctl.h`, `linux/stddef.h`.
- Detected declarations: `struct vfio_info_cap_header`, `struct vfio_group_status`, `struct vfio_device_info`, `struct vfio_device_info_cap_pci_atomic_comp`, `struct vfio_region_info`, `struct vfio_region_sparse_mmap_area`, `struct vfio_region_info_cap_sparse_mmap`, `struct vfio_region_info_cap_type`, `struct vfio_region_gfx_edid`, `struct vfio_device_migration_info`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.