vm_iomap_memory(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– vm_iomap_memory(9) β€” the Kernel API Manual, bestie edition πŸŽ€

okay so this is vm_iomap_memory(9), straight out of the Kernel API Manual, and it's genuinely one of the friendliest little functions in the whole kernel. no cap.


✨ NAME ✨

vm_iomap_memory β€” remap memory to userspace

like, it takes physical memory and goes "here bestie, have it in your address space" πŸ’…


🌸 SYNOPSIS 🌸

int vm_iomap_memory (struct vm_area_struct *vma , phys_addr_t start ,
unsigned long len );

she takes three things and returns an int, that's the whole vibe πŸ¦‹


πŸŽ€ ARGUMENTS πŸŽ€

  • vma β€” the user vma you're mapping to. this is the destination, the main character of the mapping πŸ’«
  • start β€” where the physical memory you wanna map starts. the beginning of the physical range, periodt πŸ”₯
  • len β€” the size of the area. how much we're mapping, no more no less πŸ“

πŸ’œ DESCRIPTION πŸ’œ

so this is a simplified io_remap_pfn_range for common driver use β€” think of it as the low-effort, high-reward version 🧚

the way that this works is honestly so nice: as a driver, all you gotta do is hand over the physical memory range you want mapped, and she'll figure out the rest from the vma information. that's it. that's the job. you give range, she does math. iconic behavior πŸ’…βœ¨

NOTE! ⚠️ some drivers might want to tweak vma->vm_page_prot first to get whatever write-combining details or similar. so like, if that's your situation, do that before you call this. just a heads up, bestie 😭

🌈 RETURN 🌈

0 on success β€” she ate, no crumbs πŸ‘‘

negative error code otherwise β€” she tried, it didn't work out πŸ™ˆ


πŸ¦‹ SEE ALSO πŸ¦‹

okay this list is LONG, so buckle up bestie, we're going on a little journey through Kernel file ./mm/memory.c 🫢

free_pgd_range(9), free_pgtables(9), __vm_normal_page(9), vm_normal_page(9), vm_normal_folio(9), vm_normal_page_pmd(9), vm_normal_folio_pmd(9), vm_normal_page_pud(9), restore_exclusive_pte(9), cond_install_uffd_wp_ptes(9), zap_vma_for_reaping(9), unmap_vmas(9), zap_vma_range_batched(9), zap_vma_range(9), zap_special_vma_range(9), vm_insert_pages(9), vm_insert_page(9), vm_map_pages(9), vm_map_pages_zero(9), vmf_insert_pfn_prot(9), vmf_insert_pfn(9), remap_pfn_range(9), __vmf_anon_prepare(9), finish_mkwrite_fault(9), unmap_mapping_folio(9), unmap_mapping_pages(9), unmap_mapping_range(9), set_pte_range(9), finish_fault(9), mm_account_fault(9), follow_pfnmap_start(9), follow_pfnmap_end(9), generic_access_phys(9), access_remote_vm(9), copy_remote_vm_str(9), folio_zero_user(9)

that's 36 of them fr fr, go read them all, iykyk πŸ’€πŸ“š


mwah πŸ’‹ this page lives in ./mm, and it's dated October 2026 β€” so like, she's from the future, main character energy fr. take care of her 🫢✨

πŸ“¦ where this page comes from