iommu_replace_device_pasid(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… iommu_replace_device_pasid πŸ’…

okay so this is a page from the Kernel API Manual, and honestly? it's giving "small function, big responsibilities" and we're gonna get into it 🫢


🌸 NAME 🌸

iommu_replace_device_pasid β€” swap out the domain that one specific pasid of the device is attached to. that's the whole gig. slay ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

int iommu_replace_device_pasid (struct iommu_domain *domain , struct
       device *dev , ioasid_t pasid , struct iommu_attach_handle *handle );

πŸŽ€ ARGUMENTS πŸŽ€

  • domain β€” the new iommu domain. the fresh fit the pasid is gonna be wearing πŸ’–
  • dev β€” the attached device. like, the device in question, bestie.
  • pasid β€” the pasid of the device. yes that exact one.
  • handle β€” the attach handle.

✨ DESCRIPTION ✨

so this API lets the pasid switch domains. iconic behaviour, truly.

but β€” and this is the important part β€” the pasid should have already been attached. if it hasn't been? this fails. no cap, it's just not gonna work πŸ™ˆ

and the pasid will keep the old configuration if the replacement failed. so like, no messy half-swapped situation, it just stays exactly as it was. we love a clean rollback πŸ’…

caller note, listen up: the caller should always provide a new handle to avoid a race with the paths that have lockless reference to handle, if it intends to pass a valid handle. like, always. new handle. don't reuse. big deal πŸ”₯

Returns 0 on success, or an error. that's it, that's the vibe check.


πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./drivers/iommu/iommu.c and these absolutely iconic siblings:


okay that's the whole page, mwah πŸ’‹ it lives in ./drivers/iommu, it's dated October 2026, and it's part of the Kernel API Manual β€” go forth and switch those domains responsibly, bestie πŸŒˆβ­πŸ’œ

πŸ“¦ where this page comes from