iopt_map_user_pages(9)
π iopt_map_user_pages β bestie's guide to the kernel API manual β¨
okay so real talk, this page lives in the Kernel API Manual and it's literally about iopt_map_user_pages, which maps a user VA to an iova in the io page table. no cap, that's the whole vibe. let's get into it π«Ά
β¨ NAME β¨
iopt_map_user_pages β Map a user VA to an iova in the io page table
like... that's the entire job description and she ate π
πΈ SYNOPSIS πΈ
int iopt_map_user_pages (struct iommufd_ctx *ictx , struct io_pagetable
*iopt , unsigned long *iova , void __user *uptr , unsigned long length ,
int iommu_prot , unsigned int flags );
fr fr that's the signature, copy it exactly, don't be weird about it π
π ARGUMENTS π
ictxβ theiommufd_ctxthat theioptis part of. she's the context, she belongs to somebody πioptβ theio_pagetablewe're acting on. this is the main character of the operation πiovaβ okay so this one's spicy πΆοΈ: ifIOPT_ALLOC_IOVAis set, this is unused on input and on output it holds the chosen iova. otherwise, on input, it's the iova you're mapping to. iykyk.uptrβ the user VA you're mapping. literally the thing π¦lengthβ number of bytes to map. count 'em πiommu_protβ a combination ofIOMMU_READ/WRITE/etc bits for the mapping. mix and match, slay β¨flagsβ eitherIOPT_ALLOC_IOVAor zero. that's it, those are the options, periodt π
π§ DESCRIPTION π§
okay so listen π: iova, uptr, and length must be aligned to iova_alignment. not optional, not a suggestion, it's giving requirements π₯
so for domain backed page tables, this will pin the pages and load them into the domain at iova. very hands-on, very involved π
but for non-domain page tables? highkey different energy β this will only set up a lazy reference, and the caller must use iopt_access_pages to touch them. lowkey the work is deferred, ngl π
β οΈ warning bestie:iopt_unmap_iovamust be called to undo this before theio_pagetablecan be destroyed. do not skip this step, I am begging π
π SEE ALSO π
- Kernel file
./drivers/iommu/iommufd/io_pagetable.cβ go read the source, it's right there π iopt_map_file_pages(9)iopt_unmap_iova(9)iopt_unfill_domain(9)iopt_fill_domain(9)iopt_area_split(9)
and that's the page!! π this one came from ./drivers/iommu/iommufd and it's dated October 2026 β so like, future girlie energy fr fr β mwah, go map some pages responsibly ππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms