RE: [PATCH v4 07/17] iommu: Remove iommu_group_do_dma_first_attach() from iommu_group_add_device()

Tian, Kevin
2023-04-20T07:27:00Z

> From: Jason Gunthorpe <jgg@nvidia.com>
> Sent: Wednesday, April 12, 2023 9:52 PM
>
> This function is only used to construct the groups, it should not be
> operating the iommu driver.
>
> External callers in VFIO and POWER do not have any iommu drivers on the
> devices so group->domain will be NULL.
>
> The only internal caller is from iommu_probe_device() which already calls
> iommu_group_do_dma_first_attach(), meaning we are calling it twice in the
> only case it matters.
>
> Since iommu_probe_device() is the logical place to sort out the group's
> domain, remove the call from iommu_group_add_device().
>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

Reviewed-by: Kevin Tian <kevin.tian@intel.com>