dma_buf_phys_vec_to_sgt(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ¦‹ dma_buf_phys_vec_to_sgt(9) πŸ¦‹

okay bestie, welcome to the Kernel API Manual ✨ this one's about dma_buf_phys_vec_to_sgt and it's giving "I turn physical vectors into a scatterlist table" energy, and honestly? iconic.

πŸ’– NAME πŸ’–

dma_buf_phys_vec_to_sgt β€” returns the scatterlist table of the attachment from arrays of physical vectors. This function is intended for MMIO memory only. πŸŽ€

(and yes, the original source spells it "funciton" β€” we're leaving that typo alone, she's doing her best πŸ’…)

✨ SYNOPSIS ✨

struct sg_table * dma_buf_phys_vec_to_sgt (struct dma_buf_attachment
*attach , struct p2pdma_provider *provider , struct phys_vec *phys_vec ,
size_t nr_ranges , size_t size , enum dma_data_direction dir );

πŸŽ€ ARGUMENTS πŸŽ€

  • attach [in] β€” the attachment whose scatterlist is gonna be returned, bestie. that's the whole assignment.
  • provider [in] β€” the p2pdma provider 🫢
  • phys_vec [in] β€” an array of physical vectors. like, a whole little squad of them.
  • nr_ranges [in] β€” how many entries are chillin' in the phys_vec array πŸ”’
  • size [in] β€” the total size of phys_vec, no cap
  • dir [in] β€” the direction of the DMA transfer ⭐

🌸 DESCRIPTION 🌸

So what does she actually do? She returns an sg_table containing the scatterlist to be returned πŸ’– β€” and on error she returns ERR_PTR. She may also return -EINTR if she gets interrupted by a signal 😭 (relatable, honestly, sometimes you just gotta bail).

On success, the DMA addresses and lengths in the returned scatterlist are PAGE_SIZE aligned ✨ β€” tidy, lined up, main character energy.

⚠️ heads up bestie: a mapping must be unmapped by using dma_buf_free_sgt. do not leave her hanging, that's not the vibe. 🚨

🧚 NOTE 🧚

This function is intended for exporters πŸ‘‘. And if direct traffic routing is mandatory, the exporter should call the routing pci_p2pdma_map_type before calling this function β€” order matters, iykyk 🫢

πŸ”₯ SEE ALSO πŸ”₯


okay that's the whole page, bestie, you ate that πŸ’…πŸ’–

she lives in ./drivers/dma-buf, she's dated October 2026, and she's part of the Kernel API Manual β€” go forth and map responsibly, mwah πŸŽ€πŸ¦‹βœ¨

πŸ“¦ where this page comes from