iommu_get_msi_cookie(9)
π iommu_get_msi_cookie(9) π
okay bestie, welcome to the Kernel API Manual, we're doing IOMMU stuff today and honestly? it's giving niche-but-iconic. this one is all about grabbing just the MSI remapping goodies and nothing else π
β¨ NAME β¨
iommu_get_msi_cookie β acquire just the MSI remapping resources. that's it, that's the whole vibe. no extra baggage, no surprise features, just the MSI remapping and nothing more π
πΈ SYNOPSIS πΈ
int iommu_get_msi_cookie (struct iommu_domain *domain , dma_addr_t base
);
yep, it hands you back an int, and it wants two things: your domain and your base. that's the whole ass function signature, bestie, copy it exactly π«Ά
π¦ ARGUMENTS π¦
domainβ the IOMMU domain you're prepping. this is the thing getting the glow-up β¨baseβ the start address of the IOVA region you're dedicating to MSI mappings. like, the front door of the MSI neighbourhood π‘
π DESCRIPTION π
okay so picture this: you're a user who manages your own IOVA allocation, right? you do not want DMA API support (thanks, but no thanks π ββοΈ), but you still lowkey want the automatic MSI remapping because automatic anything is a slay. that's literally exactly who this function is for β use it to initialise your own domain appropriately. main character energy for your domain, fr fr π
and here's the part you cannot skip, no cap: you should reserve a contiguous IOVA region, starting at base, and it needs to be large enough to accommodate the number of PAGE_SIZE mappings necessary to cover every MSI doorbell address used by the devices attached to domain. every single one. don't be out here under-reserving and then acting surprised π
β so like... count your doorbells, do your math, size your region. the kernel is not gonna do the vibes-check for you on this one.
π SEE ALSO π
the kernel file ./drivers/iommu/dma-iommu.c, plus the whole friend group:
iommu_get_dma_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_try_alloc(9)dma_iova_free(9)dma_iova_link(9)dma_iova_sync(9)dma_iova_unlink(9)dma_iova_destroy(9)
go read them, iykyk ππ
and that's the page, bestie!! this absolute icon lives in ./drivers/iommu, it's stamped October 2026, and it comes to you courtesy of the Kernel API Manual π§ββοΈπ don't forget to put your MSI cookie back when you're done (that's iommu_put_msi_cookie, obviously) β mwah, periodt π
β¨
π¦ 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