include/linux/generic_pt/iommu.h
Source file repositories/reference/linux-study-clean/include/linux/generic_pt/iommu.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/generic_pt/iommu.h- Extension
.h- Size
- 10826 bytes
- Lines
- 352
- 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/generic_pt/common.hlinux/iommu.hlinux/mm_types.h
Detected Declarations
struct iommu_iotlb_gatherstruct pt_iommu_opsstruct pt_iommu_driver_opsstruct iommu_dirty_bitmapstruct pt_iommustruct pt_iommu_infostruct pt_iommu_opsstruct pt_iommu_driver_opsstruct pt_iommu_cfgstruct pt_iommu_amdv1_cfgstruct pt_iommu_amdv1_hw_infostruct pt_iommu_amdv1_mock_hw_infostruct pt_iommu_vtdss_cfgstruct pt_iommu_vtdss_hw_infostruct pt_iommu_riscv_64_cfgstruct pt_iommu_riscv_64_hw_infostruct pt_iommu_x86_64_cfgstruct pt_iommu_x86_64_hw_infofunction pt_iommu_deinit
Annotated Snippet
struct pt_iommu {
/**
* @domain: The core IOMMU domain. The driver should use a union to
* overlay this memory with its previously existing domain struct to
* create an alias.
*/
struct iommu_domain domain;
/**
* @ops: Function pointers to access the API
*/
const struct pt_iommu_ops *ops;
/**
* @driver_ops: Function pointers provided by the HW driver to help
* manage HW details like caches.
*/
const struct pt_iommu_driver_ops *driver_ops;
/**
* @nid: Node ID to use for table memory allocations. The IOMMU driver
* may want to set the NID to the device's NID, if there are multiple
* table walkers.
*/
int nid;
/**
* @iommu_device: Device pointer used for any DMA cache flushing when
* PT_FEAT_DMA_INCOHERENT. This is the iommu device that created the
* page table which must have dma ops that perform cache flushing.
*/
struct device *iommu_device;
};
static inline struct pt_iommu *iommupt_from_domain(struct iommu_domain *domain)
{
if (!IS_ENABLED(CONFIG_IOMMU_PT) || !domain->is_iommupt)
return NULL;
return container_of(domain, struct pt_iommu, domain);
}
/**
* struct pt_iommu_info - Details about the IOMMU page table
*
* Returned from pt_iommu_ops->get_info()
*/
struct pt_iommu_info {
/**
* @pgsize_bitmap: A bitmask where each set bit indicates
* a page size that can be natively stored in the page table.
*/
u64 pgsize_bitmap;
};
struct pt_iommu_ops {
/**
* @map_range: Install translation for an IOVA range
* @iommu_table: Table to manipulate
* @iova: IO virtual address to start
* @paddr: Physical/Output address to start
* @len: Length of the range starting from @iova
* @prot: A bitmap of IOMMU_READ/WRITE/CACHE/NOEXEC/MMIO
* @gfp: GFP flags for any memory allocations
*
* The range starting at IOVA will have paddr installed into it. The
* rage is automatically segmented into optimally sized table entries,
* and can have any valid alignment.
*
* On error the caller will probably want to invoke unmap on the range
* from iova up to the amount indicated by @mapped to return the table
* back to an unchanged state.
*
* Context: The caller must hold a write range lock that includes
* the whole range.
*
* Returns: -ERRNO on failure, 0 on success. The number of bytes of VA
* that were mapped are added to @mapped, @mapped is not zerod first.
*/
int (*map_range)(struct pt_iommu *iommu_table, dma_addr_t iova,
phys_addr_t paddr, dma_addr_t len, unsigned int prot,
gfp_t gfp, size_t *mapped);
/**
* @unmap_range: Make a range of IOVA empty/not present
* @iommu_table: Table to manipulate
* @iova: IO virtual address to start
* @len: Length of the range starting from @iova
* @iotlb_gather: Gather struct that must be flushed on return
*
* unmap_range() will remove a translation created by map_range(). It
Annotation
- Immediate include surface: `linux/generic_pt/common.h`, `linux/iommu.h`, `linux/mm_types.h`.
- Detected declarations: `struct iommu_iotlb_gather`, `struct pt_iommu_ops`, `struct pt_iommu_driver_ops`, `struct iommu_dirty_bitmap`, `struct pt_iommu`, `struct pt_iommu_info`, `struct pt_iommu_ops`, `struct pt_iommu_driver_ops`, `struct pt_iommu_cfg`, `struct pt_iommu_amdv1_cfg`.
- 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.