include/linux/iommufd.h
Source file repositories/reference/linux-study-clean/include/linux/iommufd.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/iommufd.h- Extension
.h- Size
- 14854 bytes
- Lines
- 401
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/err.hlinux/errno.hlinux/iommu.hlinux/refcount.hlinux/types.hlinux/xarray.huapi/linux/iommufd.h
Detected Declarations
struct devicestruct filestruct iommu_groupstruct iommu_user_datastruct iommu_user_data_arraystruct iommufd_accessstruct iommufd_ctxstruct iommufd_devicestruct iommufd_viommu_opsstruct pagestruct iommufd_objectstruct iommufd_access_opsstruct iommufd_viommustruct iommufd_vdevicestruct iommufd_hw_queuestruct iommufd_viommu_opsenum iommufd_object_typefunction iommufd_ctx_putfunction iommufd_access_unpin_pagesfunction iommufd_vfio_compat_ioas_createfunction iommufd_vfio_compat_set_no_iommufunction _iommufd_object_dependfunction _iommufd_object_undependfunction _iommufd_destroy_mmapfunction iommufd_viommu_find_devfunction iommufd_viommu_get_vdev_idfunction iommufd_viommu_report_eventfunction iommufd_viommu_alloc_mmapfunction iommufd_viommu_destroy_mmap
Annotated Snippet
struct iommufd_object {
/*
* Destroy will sleep and wait for wait_cnt to go to zero. This allows
* concurrent users of the ID to reliably avoid causing a spurious
* destroy failure. Incrementing this count should either be short
* lived or be revoked and blocked during pre_destroy().
*/
refcount_t wait_cnt;
refcount_t users;
enum iommufd_object_type type;
unsigned int id;
};
struct iommufd_device *iommufd_device_bind(struct iommufd_ctx *ictx,
struct device *dev, u32 *id);
void iommufd_device_unbind(struct iommufd_device *idev);
int iommufd_device_attach(struct iommufd_device *idev, ioasid_t pasid,
u32 *pt_id);
int iommufd_device_replace(struct iommufd_device *idev, ioasid_t pasid,
u32 *pt_id);
void iommufd_device_detach(struct iommufd_device *idev, ioasid_t pasid);
struct iommufd_ctx *iommufd_device_to_ictx(struct iommufd_device *idev);
u32 iommufd_device_to_id(struct iommufd_device *idev);
struct iommufd_access_ops {
u8 needs_pin_pages : 1;
void (*unmap)(void *data, unsigned long iova, unsigned long length);
};
enum {
IOMMUFD_ACCESS_RW_READ = 0,
IOMMUFD_ACCESS_RW_WRITE = 1 << 0,
/* Set if the caller is in a kthread then rw will use kthread_use_mm() */
IOMMUFD_ACCESS_RW_KTHREAD = 1 << 1,
/* Only for use by selftest */
__IOMMUFD_ACCESS_RW_SLOW_PATH = 1 << 2,
};
struct iommufd_access *
iommufd_access_create(struct iommufd_ctx *ictx,
const struct iommufd_access_ops *ops, void *data, u32 *id);
void iommufd_access_destroy(struct iommufd_access *access);
int iommufd_access_attach(struct iommufd_access *access, u32 ioas_id);
int iommufd_access_replace(struct iommufd_access *access, u32 ioas_id);
void iommufd_access_detach(struct iommufd_access *access);
void iommufd_ctx_get(struct iommufd_ctx *ictx);
struct iommufd_viommu {
struct iommufd_object obj;
struct iommufd_ctx *ictx;
struct iommu_device *iommu_dev;
struct iommufd_hwpt_paging *hwpt;
const struct iommufd_viommu_ops *ops;
struct xarray vdevs;
struct list_head veventqs;
struct rw_semaphore veventqs_rwsem;
enum iommu_viommu_type type;
};
struct iommufd_vdevice {
struct iommufd_object obj;
struct iommufd_viommu *viommu;
struct iommufd_device *idev;
/*
* Virtual device ID per vIOMMU, e.g. vSID of ARM SMMUv3, vDeviceID of
* AMD IOMMU, and vRID of Intel VT-d
*/
u64 virt_id;
/* Clean up all driver-specific parts of an iommufd_vdevice */
void (*destroy)(struct iommufd_vdevice *vdev);
};
struct iommufd_hw_queue {
struct iommufd_object obj;
struct iommufd_viommu *viommu;
struct iommufd_access *access;
u64 base_addr; /* in guest physical address space */
size_t length;
enum iommu_hw_queue_type type;
Annotation
- Immediate include surface: `linux/err.h`, `linux/errno.h`, `linux/iommu.h`, `linux/refcount.h`, `linux/types.h`, `linux/xarray.h`, `uapi/linux/iommufd.h`.
- Detected declarations: `struct device`, `struct file`, `struct iommu_group`, `struct iommu_user_data`, `struct iommu_user_data_array`, `struct iommufd_access`, `struct iommufd_ctx`, `struct iommufd_device`, `struct iommufd_viommu_ops`, `struct page`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
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.