dma_sync_sgtable_for_device(9)
π 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β thesg_tableobject that describes the buffer π that's the map of what memory we're talking about.dirβ the DMA direction π¦ (anenum 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 β¨
- Kernel file
./include/linux/dma-mapping.hπ dma_use_iova(9)dma_unmap_sgtable(9)dma_sync_sgtable_for_cpu(9)dma_get_seg_boundary_nr_pages(9)
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
- 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