iommu_group_for_each_dev(9)
π iommu_group_for_each_dev(9) β Kernel API Manual
okay so bestie, welcome to the Kernel API Manual page for iommu_group_for_each_dev(9). this is the one that walks every device in an IOMMU group, one at a time, very demure, very mindful. let's get into it π
β¨ NAME β¨
iommu_group_for_each_dev β iterate over each device in the group
like, every single one. no skipping. no cap. π¦
β¨ SYNOPSIS β¨
int iommu_group_for_each_dev (struct iommu_group *group , void *data ,
int (*fn)(struct device *, void *) );
that's the whole vibe right there β a group, some opaque data, and a callback. it's giving "I trust you to handle this." π«Ά
β¨ ARGUMENTS β¨
groupβ the group. that's it. that's the group you're iterating over πdataβ caller opaque data, passed straight through to the callback function. it's your stuff, the kernel is literally just holding it for you. don't make it weird πfnβ the caller supplied callback function. you write it, it gets called for each device. main character energy, tbh π
β¨ DESCRIPTION β¨
so here's what's happening: this function is called by group users to iterate over group devices. that's the whole job. it goes through the devices in the group and hits your fn for each one π₯
before you get too comfy, two things, and these are not optional:
- callers should hold a reference count to the group during the callback. like, do not let that group slip away mid-loop. hold it. π«Ά
group->mutexis held across callbacks, which will block calls toiommu_group_add_deviceandiommu_group_remove_device.
okay but for real though β that mutex thing is important. while your callback is running, anybody trying to add or remove a device in that group is just gonna wait. so don't sit in your callback doing side quests forever, bestie π
β¨ SEE ALSO β¨
Kernel file ./drivers/iommu/iommu.c β and honestly the whole friend group:
iommu_device_register(9)iommu_insert_resv_region(9)iommu_group_alloc(9)iommu_group_get_iommudata(9)iommu_group_set_iommudata(9)iommu_group_set_name(9)iommu_group_add_device(9)iommu_group_remove_device(9)iommu_group_mutex_assert(9)iommu_group_get(9)iommu_group_ref_get(9)iommu_group_put(9)iommu_group_id(9)device_iommu_capable(9)iommu_group_has_isolated_msi(9)iommu_set_fault_handler(9)iommu_paging_domain_alloc_flags(9)iommu_attach_device(9)iommu_get_domain_for_dev(9)iommu_driver_get_domain_for_dev(9)iommu_attach_group(9)iommu_unmap(9)iommu_unmap_fast(9)report_iommu_fault(9)iommu_get_resv_regions(9)iommu_put_resv_regions(9)iommu_setup_default_domain(9)iommu_device_use_default_domain(9)iommu_device_unuse_default_domain(9)iommu_group_claim_dma_owner(9)iommu_device_claim_dma_owner(9)iommu_group_release_dma_owner(9)iommu_device_release_dma_owner(9)iommu_group_dma_owner_claimed(9)iommu_replace_device_pasid(9)iommu_attach_handle_get(9)iommu_attach_group_handle(9)iommu_detach_group_handle(9)iommu_replace_group_handle(9)pci_dev_reset_iommu_prepare(9)pci_dev_reset_iommu_done(9)iommu_dma_prepare_msi(9)
and that's the page!! πΈ this lil cutie lives in ./drivers/iommu, and the manual itself is dated October 2026. mwah, go iterate responsibly π
β¨
π¦ 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