dma_direct_set_offset(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ NAME ✨

okay so bestie, this is from the Kernel API Manual β€” the function is dma_direct_set_offset, and its whole thing is assigning a scalar offset for a single DMA range. iconic behavior, honestly πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

int dma_direct_set_offset (struct device *dev , phys_addr_t cpu_start ,
       dma_addr_t dma_start , u64 size );

πŸŽ€ ARGUMENTS πŸŽ€

  • dev β€” a device pointer; it’s needed to "own" the alloced memory.
  • cpu_start β€” the beginning of the memory region covered by this offset.
  • dma_start β€” the beginning of the DMA/PCI region covered by this offset.
  • size β€” the size of the region.

🌸 DESCRIPTION 🌸

This is for the simple case of a uniform offset which cannot be discovered by "dma-ranges". lowkey straightforward, highkey specific 🫢

It returns -ENOMEM if out of memory, -EINVAL if a map already exists, 0 otherwise. periodt.


πŸ’€ NOTE πŸ’€

⚠️ bestie, listen: any call to this from a driver is a bug. The mapping needs to be described by the device tree or other firmware interfaces. not me stressing this, it’s literally in the note 😭

πŸ”₯ SEE ALSO πŸ”₯

  • Kernel file ./kernel/dma/direct.c β€” go look, iykyk πŸ‘‘

byeee 🫢 β€” source/version: ./kernel/dma, date: October 2026, page: dma_direct_set_offset(9) πŸ’–

πŸ“¦ where this page comes from