swiotlb_search_area(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’« swiotlb_search_area(9) πŸ’«

okay so this is a page from the Kernel API Manual and honestly? it's a little baddie. it's called swiotlb_search_area and its whole personality is searching one memory area in all pools. one area. all pools. she's thorough. πŸ’…


✨ SYNOPSIS ✨

int swiotlb_search_area (struct device *dev , int start_cpu , int
cpu_offset , phys_addr_t orig_addr , size_t alloc_size , unsigned int
alloc_align_mask , struct io_tlb_pool **retpool );

seven arguments bestie. seven. she's high-maintenance but she's worth it πŸŽ€


🌸 ARGUMENTS 🌸

  • dev β€” the device that's mapping the buffer. it's giving "who do you belong to" energy.
  • start_cpu β€” the CPU number you're starting from. your little launchpad πŸš€
  • cpu_offset β€” how far you're offset from start_cpu. yes it's relative, yes it matters.
  • orig_addr β€” the original (non-bounced) IO buffer address. the real one, before the bounce glow-up ✨
  • alloc_size β€” total requested size of the bounce buffer, including the initial alignment padding. don't forget the padding, she counts it, fr fr.
  • alloc_align_mask β€” the required alignment of the allocated buffer. the vibe check for where things can sit πŸ¦‹
  • retpool β€” the used memory pool, updated on return. she writes back to you, that's the whole point πŸ’–

πŸ”₯ DESCRIPTION πŸ”₯

so what does she actually do? she searches one memory area across all pools, hunting for a sequence of slots that match the allocation constraints. that's it. that's the whole job. no cap. πŸ‘‘

like, imagine you need a run of slots that fit certain rules, and you're checking one specific area in every pool until something matches. iconic behavior honestly. 🌈


πŸŽ€ RETURN πŸŽ€

  • the index of the first allocated slot β€” slay, you found one 🫢
  • or -1 on error β€” not slay, something went wrong 😭
heads up bestie: -1 is the failure signal here, so don't go treating it like a valid index. that would be a bad time. πŸ’€

πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file ./kernel/dma/swiotlb.c, plus the whole friend group: struct io_tlb_slot(9), struct io_tlb_area(9), swiotlb_adjust_nareas(9), limit_nareas(9), add_mem_pool(9), alloc_dma_pages(9), swiotlb_alloc_tlb(9), swiotlb_free_tlb(9), swiotlb_alloc_pool(9), swiotlb_dyn_alloc(9), __swiotlb_find_pool(9), swiotlb_del_pool(9), swiotlb_dev_init(9), swiotlb_align_offset(9), swiotlb_search_pool_area(9), swiotlb_find_slots(9), mem_pool_used(9), mem_used(9), swiotlb_tbl_map_single(9), swiotlb_del_transient(9), is_swiotlb_allocated(9), default_swiotlb_base(9), default_swiotlb_limit(9). go read them, they're literally all right there πŸ’œ


okay and for the cute sign-off: this little masterpiece lives in ./kernel/dma and it's stamped October 2026. future-coded of her. see you in the pools bestie πŸ§šβ€β™€οΈβ­πŸ“

πŸ“¦ where this page comes from