diff options
author | Jason Gunthorpe <jgg@nvidia.com> | 2023-05-11 07:42:06 +0300 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2023-05-23 09:15:54 +0300 |
commit | 2f74198ae006c50a4188ae02c10e2c7b0b8142da (patch) | |
tree | 87935a10f9d9044aa2dcf93c56c37f82552842bd /drivers/iommu | |
parent | 0046a4337eae148510173680f82b483f7c3b7ded (diff) | |
download | linux-2f74198ae006c50a4188ae02c10e2c7b0b8142da.tar.xz |
iommu: Replace iommu_group_do_dma_first_attach with __iommu_device_set_domain
Since __iommu_device_set_domain() now knows how to handle deferred attach
we can just call it directly from the only call site.
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/8-v5-1b99ae392328+44574-iommu_err_unwind_jgg@nvidia.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu')
-rw-r--r-- | drivers/iommu/iommu.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index fa2b669ecf4b..ea61a81c0006 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -106,6 +106,10 @@ enum { IOMMU_SET_DOMAIN_MUST_SUCCEED = 1 << 0, }; +static int __iommu_device_set_domain(struct iommu_group *group, + struct device *dev, + struct iommu_domain *new_domain, + unsigned int flags); static int __iommu_group_set_domain_internal(struct iommu_group *group, struct iommu_domain *new_domain, unsigned int flags); @@ -401,17 +405,6 @@ err_unlock: return ret; } -static int iommu_group_do_dma_first_attach(struct device *dev, void *data) -{ - struct iommu_domain *domain = data; - - lockdep_assert_held(&dev->iommu_group->mutex); - - if (dev->iommu->attach_deferred) - return 0; - return __iommu_attach_device(domain, dev); -} - int iommu_probe_device(struct device *dev) { const struct iommu_ops *ops; @@ -442,7 +435,7 @@ int iommu_probe_device(struct device *dev) * attach the default domain. */ if (group->default_domain && !group->owner) { - ret = iommu_group_do_dma_first_attach(dev, group->default_domain); + ret = __iommu_device_set_domain(group, dev, group->domain, 0); if (ret) { mutex_unlock(&group->mutex); iommu_group_put(group); |