include/linux/iommu.h
Source file repositories/reference/linux-study-clean/include/linux/iommu.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/iommu.h- Extension
.h- Size
- 58086 bytes
- Lines
- 1754
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/scatterlist.hlinux/device.hlinux/types.hlinux/errno.hlinux/err.hlinux/of.hlinux/iova_bitmap.huapi/linux/iommufd.h
Detected Declarations
struct iommu_opsstruct iommu_groupstruct bus_typestruct devicestruct iommu_domainstruct iommu_domain_opsstruct iommu_dirty_opsstruct notifier_blockstruct iommu_svastruct iommu_dma_cookiestruct iommu_dma_msi_cookiestruct iommu_fault_paramstruct iommufd_ctxstruct iommufd_viommustruct msi_descstruct msi_msgstruct iommu_fault_page_requeststruct iommu_faultstruct iommu_page_responsestruct iopf_faultstruct iopf_groupstruct iopf_queuestruct iommu_domain_geometrystruct iommu_domainstruct iommu_resv_regionstruct iommu_iort_rmr_datastruct iommu_pages_liststruct iommu_iotlb_gatherstruct iommu_dirty_bitmapstruct iommu_dirty_opsstruct iommu_user_datastruct iommu_user_data_arraystruct iommu_opsstruct iommu_domain_opsstruct iommu_devicestruct iommu_fault_paramstruct dev_iommustruct iommu_fwspecstruct iommu_attach_handlestruct iommu_svastruct iommu_mm_datastruct iommu_opsstruct iommu_groupstruct iommu_fwspecstruct iommu_devicestruct iommu_fault_paramstruct iommu_iotlb_gatherstruct iommu_dirty_bitmap
Annotated Snippet
struct bus_type;
struct device;
struct iommu_domain;
struct iommu_domain_ops;
struct iommu_dirty_ops;
struct notifier_block;
struct iommu_sva;
struct iommu_dma_cookie;
struct iommu_dma_msi_cookie;
struct iommu_fault_param;
struct iommufd_ctx;
struct iommufd_viommu;
struct msi_desc;
struct msi_msg;
#define IOMMU_FAULT_PERM_READ (1 << 0) /* read */
#define IOMMU_FAULT_PERM_WRITE (1 << 1) /* write */
#define IOMMU_FAULT_PERM_EXEC (1 << 2) /* exec */
#define IOMMU_FAULT_PERM_PRIV (1 << 3) /* privileged */
/* Generic fault types, can be expanded IRQ remapping fault */
enum iommu_fault_type {
IOMMU_FAULT_PAGE_REQ = 1, /* page request fault */
};
/**
* struct iommu_fault_page_request - Page Request data
* @flags: encodes whether the corresponding fields are valid and whether this
* is the last page in group (IOMMU_FAULT_PAGE_REQUEST_* values).
* When IOMMU_FAULT_PAGE_RESPONSE_NEEDS_PASID is set, the page response
* must have the same PASID value as the page request. When it is clear,
* the page response should not have a PASID.
* @pasid: Process Address Space ID
* @grpid: Page Request Group Index
* @perm: requested page permissions (IOMMU_FAULT_PERM_* values)
* @addr: page address
* @private_data: device-specific private information
*/
struct iommu_fault_page_request {
#define IOMMU_FAULT_PAGE_REQUEST_PASID_VALID (1 << 0)
#define IOMMU_FAULT_PAGE_REQUEST_LAST_PAGE (1 << 1)
#define IOMMU_FAULT_PAGE_RESPONSE_NEEDS_PASID (1 << 2)
u32 flags;
u32 pasid;
u32 grpid;
u32 perm;
u64 addr;
u64 private_data[2];
};
/**
* struct iommu_fault - Generic fault data
* @type: fault type from &enum iommu_fault_type
* @prm: Page Request message, when @type is %IOMMU_FAULT_PAGE_REQ
*/
struct iommu_fault {
u32 type;
struct iommu_fault_page_request prm;
};
/**
* enum iommu_page_response_code - Return status of fault handlers
* @IOMMU_PAGE_RESP_SUCCESS: Fault has been handled and the page tables
* populated, retry the access. This is "Success" in PCI PRI.
* @IOMMU_PAGE_RESP_FAILURE: General error. Drop all subsequent faults from
* this device if possible. This is "Response Failure" in PCI PRI.
* @IOMMU_PAGE_RESP_INVALID: Could not handle this fault, don't retry the
* access. This is "Invalid Request" in PCI PRI.
*/
enum iommu_page_response_code {
IOMMU_PAGE_RESP_SUCCESS = 0,
IOMMU_PAGE_RESP_INVALID,
IOMMU_PAGE_RESP_FAILURE,
};
/**
* struct iommu_page_response - Generic page response information
* @pasid: Process Address Space ID
* @grpid: Page Request Group Index
* @code: response code from &enum iommu_page_response_code
*/
struct iommu_page_response {
u32 pasid;
u32 grpid;
u32 code;
};
struct iopf_fault {
struct iommu_fault fault;
/* node for pending lists */
Annotation
- Immediate include surface: `linux/scatterlist.h`, `linux/device.h`, `linux/types.h`, `linux/errno.h`, `linux/err.h`, `linux/of.h`, `linux/iova_bitmap.h`, `uapi/linux/iommufd.h`.
- Detected declarations: `struct iommu_ops`, `struct iommu_group`, `struct bus_type`, `struct device`, `struct iommu_domain`, `struct iommu_domain_ops`, `struct iommu_dirty_ops`, `struct notifier_block`, `struct iommu_sva`, `struct iommu_dma_cookie`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.