iommu_get_msi_cookie(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

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:

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