dma_sync_sgtable_for_device(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… dma_sync_sgtable_for_device(9) πŸ’…

okay bestie, welcome to the Kernel API Manual β€” this one's a kernel-function page and it's genuinely iconic once you get the vibe, i promise 🫢


✨ NAME ✨

dma_sync_sgtable_for_device β€” synchronize the given buffer for DMA 🌈


✨ SYNOPSIS ✨

void dma_sync_sgtable_for_device (struct device *dev , struct sg_table
*sgt , enum dma_data_direction dir );

no cap, that's the whole signature β€” void, so nothing comes back to you, it just does the thing πŸ’…


✨ ARGUMENTS ✨

  • dev β€” the device you're doing the DMA operation for πŸŽ€ like, the actual hardware main character here.
  • sgt β€” the sg_table object that describes the buffer πŸ‘‘ that's the map of what memory we're talking about.
  • dir β€” the DMA direction πŸ¦‹ (an enum dma_data_direction, if you're keeping track).

✨ DESCRIPTION ✨

so what it does is: it performs the cache synchronization that's needed, and then it moves the ownership of the buffer back over to the DMA domain πŸ’« which means β€” and this is the important part β€” it's now safe to actually perform the DMA operation. slay.

ngl the ownership handoff is the whole vibe check here. it's giving "here DMA, this is yours now, don't embarrass me" 😭

and once you're finished with all that? you have to call dma_sync_sgtable_for_cpu or dma_unmap_sgtable. like, that's not optional bestie, don't just leave it hanging πŸ™ˆ


✨ SEE ALSO ✨


and that's the page fr fr πŸ’– this beauty lives over in ./include/linux and it's dated October 2026 β€” so go forth, sync those sg_tables, and remember: hand the buffer back when you're done. periodt πŸŽ€βœ¨πŸ’œ

πŸ“¦ where this page comes from