swiotlb_align_offset(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

bestie, welcome to swiotlb_align_offset(9) from the Kernel API Manual ✨ β€” this is the function that gets the required offset into an IO TLB allocation. it does exactly what it says on the tin, no cap πŸ’…


🌸 SYNOPSIS 🌸

the signature is literally this, copied with love:

unsigned int swiotlb_align_offset (struct device *dev , unsigned int
       align_mask , u64 addr );

πŸŽ€ ARGUMENTS πŸŽ€

  • dev β€” the owning device πŸ‘‘
  • align_mask β€” the allocation alignment mask 🧚
  • addr β€” the DMA address πŸ“¬

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so what this returns is the minimum offset from the start of an IO TLB allocation that you need for a given buffer address and allocation alignment to keep the device happy πŸ’–

first up: the address bits covered by min_align_mask must be identical in the original address and the bounce buffer address. high bits are preserved by choosing a suitable IO TLB slot, but bits below IO_TLB_SHIFT require extra padding bytes before the bounce buffer. that part is giving very precise, very necessary energy πŸ”₯

second: align_mask specifies which bits of the first allocated slot must be zero. this may require allocating additional padding slots, and then the offset (in bytes) from the first such padding slot is returned. periodt πŸ’…


🌈 SEE ALSO 🌈

if you wanna fall down the extended-universe rabbit hole, start with the kernel file ./kernel/dma/swiotlb.c and then check out these icons 🫢:


cute lil sign-off: source/version is ./kernel/dma, date is October 2026, and the page is swiotlb_align_offset(9) β€” bye bestie, go slay those DMA alignments πŸ’‹πŸ«Άβœ¨

πŸ“¦ where this page comes from