vm_iomap_memory(9)
π 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
- 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