dma_alloc_from_dev_coherent(9)
π dma_alloc_from_dev_coherent(9) π
okay so bestie, welcome to the Kernel API Manual β this one's called dma_alloc_from_dev_coherent, and it's literally about allocating memory from a device coherent pool. no cap. let's get into it π«Ά
β¨ NAME β¨
dma_alloc_from_dev_coherent β allocate memory from device coherent pool π
β¨ SYNOPSIS β¨
int dma_alloc_from_dev_coherent (struct device *dev , ssize_t size ,
dma_addr_t *dma_handle , void **ret );
πΈ ARGUMENTS πΈ
devβ the device from which we allocate memory. like, this is the main character here, the device we're pulling memory out of πsizeβ size of requested memory area. how much you askin' for, bestie πdma_handleβ this will be filled with the correct dma handle. it's an output, so it gets filled in for you, you don't fill it β¨retβ this pointer will be filled with the virtual address to allocated area. again: output param, the function does the work, you just receive the virtual address of the allocated area π¦
π DESCRIPTION π
okay so the rules here: this function should only be called from per-arch dma_alloc_coherent. it's there to support allocation from per-device coherent memory pools. that's the whole vibe, iykyk.
now the return value, and this is important so listen up π₯:
- it returns
0ifdma_alloc_coherentshould continue with allocating from generic memory areas. - it returns
!0(that's "not zero", bestie) ifdma_alloc_coherentshould returnret.
like, the return value is literally a vibe check that tells the caller whether to keep going or to bail with ret. periodt π
π¦ SEE ALSO π¦
- Kernel file
./kernel/dma/coherent.c dma_release_from_dev_coherent(9)dma_mmap_from_dev_coherent(9)
and that's the whole page, bestie, you ate that π. this lil gem lives in ./kernel/dma and it's dated October 2026 β go forth and allocate responsibly, mwah ππ§ββοΈ
π¦ 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