dma_iova_try_alloc(9)
β¨ dma_iova_try_alloc(9) β¨
okay so bestie, welcome to the dma_iova_try_alloc page from the Kernel API Manual β yes that's the manual name, and yes we're covering it, because this little function is literally the vibes check for whether your device can do the whole IOVA-based DMA thing or whether you gotta slum it with the regular DMA API. π
πΈ NAME πΈ
dma_iova_try_alloc β bestie's honest attempt at allocating an IOVA space π
π¦ SYNOPSIS π¦
bool dma_iova_try_alloc (struct device *dev , struct dma_iova_state
*state , phys_addr_t phys , size_t size );
like, that's the whole signature, no cap. returns a bool and everything π₯
π ARGUMENTS π
devβ the device you're allocating the IOVA space for. it's the main character here πstateβ the IOVA state. yes, it's just called state. slay π«Άphysβ a physical address. hold that thought, there's a note about it below πsizeβ the IOVA size. how much space we're claiming, periodt β¨
π DESCRIPTION π
so what this does is: it checks if dev actually supports the IOVA-based DMA API, and if it does β icon behaviour β it allocates IOVA space for the given base address and size. that's it, that's the function π§
β NOTE β
heads up bestie:physis only used to calculate the IOVA alignment. so if your callers always doPAGE_SIZEaligned transfers, you can safely pass0here. no stress π
and the return value, because this matters: it returns true if the IOVA-based DMA API can be used and IOVA space has been allocated β or false if you should use the regular DMA API instead. basically a glow-up vs. staying home situation π
π SEE ALSO π
kernel file ./drivers/iommu/dma-iommu.c, plus the whole friend group:
iommu_get_dma_cookie(9)iommu_get_msi_cookie(9)iommu_put_dma_cookie(9)iommu_put_msi_cookie(9)iommu_dma_get_resv_regions(9)iommu_dma_init_options(9)iommu_dma_init_domain(9)dma_info_to_prot(9)dma_iova_free(9)dma_iova_link(9)dma_iova_sync(9)dma_iova_unlink(9)dma_iova_destroy(9)
okay that's the whole page, ily, go allocate something π β¨
source: ./drivers/iommu Β· version/date: October 2026 Β· that's the sign-off bestie, mwah π«Άπ
π¦ 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