iopt_map_user_pages(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 β€” the iommufd_ctx that the iopt is part of. she's the context, she belongs to somebody πŸ’–
  • iopt β€” the io_pagetable we're acting on. this is the main character of the operation πŸ‘‘
  • iova β€” okay so this one's spicy 🌢️: if IOPT_ALLOC_IOVA is 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 of IOMMU_READ/WRITE/etc bits for the mapping. mix and match, slay ✨
  • flags β€” either IOPT_ALLOC_IOVA or 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_iova must be called to undo this before the io_pagetable can be destroyed. do not skip this step, I am begging 😭

πŸ’œ SEE ALSO πŸ’œ


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