drivers/iommu/iommufd/io_pagetable.h
Source file repositories/reference/linux-study-clean/drivers/iommu/iommufd/io_pagetable.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/iommu/iommufd/io_pagetable.h- Extension
.h- Size
- 10421 bytes
- Lines
- 313
- Domain
- Driver Families
- Bucket
- drivers/iommu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/dma-buf.hlinux/interval_tree.hlinux/kref.hlinux/mutex.hlinux/xarray.hiommufd_private.h
Detected Declarations
struct iommu_domainstruct iopt_areastruct iopt_allowedstruct iopt_reservedstruct iopt_area_contig_iterstruct iopt_pages_dmabuf_trackstruct iopt_pages_dmabufstruct iopt_pagesstruct iopt_pages_accessstruct pfn_reader_userenum iopt_address_typefunction iopt_area_indexfunction iopt_area_last_indexfunction iopt_area_iovafunction iopt_area_last_iovafunction iopt_area_lengthfunction iopt_area_start_bytefunction iopt_area_iova_to_indexfunction iopt_area_contig_donefunction iopt_is_dmabuffunction iopt_dmabuf_revokedfunction iopt_put_pages
Annotated Snippet
struct iopt_area {
struct interval_tree_node node;
struct interval_tree_node pages_node;
struct io_pagetable *iopt;
struct iopt_pages *pages;
struct iommu_domain *storage_domain;
/* How many bytes into the first page the area starts */
unsigned int page_offset;
/* IOMMU_READ, IOMMU_WRITE, etc */
int iommu_prot;
bool prevent_access : 1;
unsigned int num_accesses;
unsigned int num_locks;
};
struct iopt_allowed {
struct interval_tree_node node;
};
struct iopt_reserved {
struct interval_tree_node node;
void *owner;
};
int iopt_area_fill_domains(struct iopt_area *area, struct iopt_pages *pages);
void iopt_area_unfill_domains(struct iopt_area *area, struct iopt_pages *pages);
int iopt_area_fill_domain(struct iopt_area *area, struct iommu_domain *domain);
void iopt_area_unfill_domain(struct iopt_area *area, struct iopt_pages *pages,
struct iommu_domain *domain);
void iopt_area_unmap_domain(struct iopt_area *area,
struct iommu_domain *domain);
int iopt_dmabuf_track_domain(struct iopt_pages *pages, struct iopt_area *area,
struct iommu_domain *domain);
void iopt_dmabuf_untrack_domain(struct iopt_pages *pages,
struct iopt_area *area,
struct iommu_domain *domain);
int iopt_dmabuf_track_all_domains(struct iopt_area *area,
struct iopt_pages *pages);
void iopt_dmabuf_untrack_all_domains(struct iopt_area *area,
struct iopt_pages *pages);
static inline unsigned long iopt_area_index(struct iopt_area *area)
{
return area->pages_node.start;
}
static inline unsigned long iopt_area_last_index(struct iopt_area *area)
{
return area->pages_node.last;
}
static inline unsigned long iopt_area_iova(struct iopt_area *area)
{
return area->node.start;
}
static inline unsigned long iopt_area_last_iova(struct iopt_area *area)
{
return area->node.last;
}
static inline size_t iopt_area_length(struct iopt_area *area)
{
return (area->node.last - area->node.start) + 1;
}
/*
* Number of bytes from the start of the iopt_pages that the iova begins.
* iopt_area_start_byte() / PAGE_SIZE encodes the starting page index
* iopt_area_start_byte() % PAGE_SIZE encodes the offset within that page
*/
static inline unsigned long iopt_area_start_byte(struct iopt_area *area,
unsigned long iova)
{
if (IS_ENABLED(CONFIG_IOMMUFD_TEST))
WARN_ON(iova < iopt_area_iova(area) ||
iova > iopt_area_last_iova(area));
return (iova - iopt_area_iova(area)) + area->page_offset +
iopt_area_index(area) * PAGE_SIZE;
}
static inline unsigned long iopt_area_iova_to_index(struct iopt_area *area,
unsigned long iova)
{
return iopt_area_start_byte(area, iova) / PAGE_SIZE;
}
#define __make_iopt_iter(name) \
Annotation
- Immediate include surface: `linux/dma-buf.h`, `linux/interval_tree.h`, `linux/kref.h`, `linux/mutex.h`, `linux/xarray.h`, `iommufd_private.h`.
- Detected declarations: `struct iommu_domain`, `struct iopt_area`, `struct iopt_allowed`, `struct iopt_reserved`, `struct iopt_area_contig_iter`, `struct iopt_pages_dmabuf_track`, `struct iopt_pages_dmabuf`, `struct iopt_pages`, `struct iopt_pages_access`, `struct pfn_reader_user`.
- Atlas domain: Driver Families / drivers/iommu.
- 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.