dma_alloc_from_dev_coherent(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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 0 if dma_alloc_coherent should continue with allocating from generic memory areas.
  • it returns !0 (that's "not zero", bestie) if dma_alloc_coherent should return ret.

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 πŸ¦‹


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