dma_mmap_from_dev_coherent(9)
π dma_mmap_from_dev_coherent β like, the Kernel API Manual page you didn't know you needed
okay bestie, gather round, because today we're talking about dma_mmap_from_dev_coherent(9) and honestly? she's a little niche but she serves. this is the Kernel API Manual entry, so you know it's the real deal β¨
πΈ NAME πΈ
dma_mmap_from_dev_coherent β mmap memory from the device coherent pool π«Ά
like literally, it maps memory out of the per-device coherent pool. that's the whole vibe.
β¨ SYNOPSIS β¨
int dma_mmap_from_dev_coherent (struct device *dev , struct
vm_area_struct *vma , void *vaddr , size_t size , int *ret );
five arguments, one int coming back at you. slay. no cap, that's the signature, don't @ me π
π ARGUMENTS π
devβ the device from which the memory was allocated πvmaβ thevm_areafor the userspace memory πΈvaddrβ the cpu address returned bydma_alloc_from_dev_coherentβsizeβ size of the memory buffer allocated πretβ result fromremap_pfn_rangeπ
π¦ DESCRIPTION π¦
so what does she do. okay so: this checks whether the memory was allocated from the per-device coherent memory pool, and if so, maps that memory to the provided vma. that's it. that's the whole job. iconic behavior honestly π
and then the return value, which is where it gets kinda main-character:
- it returns
1ifvaddrbelongs to the device coherent pool and the caller should returnretπ₯ - or
0if they should proceed with mapping memory from generic areas π
so like, 1 = "yeah babe it's ours, bail out with ret", 0 = "nope, not ours, keep it moving with the generic areas". vibe check complete β¨
fr fr read the return value carefully, bestie β1and0mean very different things for whoever's calling you, and getting them backwards is gonna be a whole situation π
π SEE ALSO π
- Kernel file
./kernel/dma/coherent.cπ dma_alloc_from_dev_coherent(9)π§dma_release_from_dev_coherent(9)π
the whole coherent-pool friend group, honestly. go read them together, iykyk π
and that's the page!! π source is ./kernel/dma, dated October 2026 β bookmark it, screenshot it, send it to your group chat, whatever you gotta do. bye bestie, go map some memory 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