iommu: Split iommu_group_add_device()
authorJason Gunthorpe <jgg@nvidia.com>
Tue, 6 Jun 2023 00:59:47 +0000 (21:59 -0300)
committerJoerg Roedel <jroedel@suse.de>
Fri, 14 Jul 2023 14:14:16 +0000 (16:14 +0200)
commitfa08280364882c42993dc5d8394c467d76803fdb
tree686b27338825043a71d9eb10ce57e10ad70de5b1
parentcfb6ee65f7603a0605fa8f5fe5b0782f0731c81c
iommu: Split iommu_group_add_device()

Move the list_add_tail() for the group_device into the critical region
that immediately follows in __iommu_probe_device(). This avoids one case
of unlocking and immediately re-locking the group->mutex.

Consistently make the caller responsible for setting dev->iommu_group,
prior patches moved this into iommu_init_device(), make the no-driver path
do this in iommu_group_add_device().

This completes making __iommu_group_free_device() and
iommu_group_alloc_device() into pair'd functions.

Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/9-v3-328044aa278c+45e49-iommu_probe_jgg@nvidia.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/iommu.c