diff options
author | Joerg Roedel <jroedel@suse.de> | 2020-05-29 18:10:09 +0300 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2020-05-29 18:10:09 +0300 |
commit | 4c201d58cfee8631350888bad9e8bae33e628605 (patch) | |
tree | a49a020d48af561d030b7d4869d193148b5a8088 /drivers/iommu/iommu.c | |
parent | 555fb5ae0f39962417d35e02d77ee9b2c14a5428 (diff) | |
parent | 9cb1fd0efd195590b828b9b865421ad345a4a145 (diff) | |
download | linux-4c201d58cfee8631350888bad9e8bae33e628605.tar.xz |
Merge tag 'v5.7-rc7' into x86/amd
Linux 5.7-rc7
Diffstat (limited to 'drivers/iommu/iommu.c')
-rw-r--r-- | drivers/iommu/iommu.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 4050569188be..629d209b8e88 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -769,6 +769,15 @@ out: return ret; } +static bool iommu_is_attach_deferred(struct iommu_domain *domain, + struct device *dev) +{ + if (domain->ops->is_attach_deferred) + return domain->ops->is_attach_deferred(domain, dev); + + return false; +} + /** * iommu_group_add_device - add a device to an iommu group * @group: the group into which to add the device (reference should be held) @@ -821,7 +830,7 @@ rename: mutex_lock(&group->mutex); list_add_tail(&device->list, &group->devices); - if (group->domain) + if (group->domain && !iommu_is_attach_deferred(group->domain, dev)) ret = __iommu_attach_device(group->domain, dev); mutex_unlock(&group->mutex); if (ret) @@ -1893,9 +1902,6 @@ static int __iommu_attach_device(struct iommu_domain *domain, struct device *dev) { int ret; - if ((domain->ops->is_attach_deferred != NULL) && - domain->ops->is_attach_deferred(domain, dev)) - return 0; if (unlikely(domain->ops->attach_dev == NULL)) return -ENODEV; @@ -1967,8 +1973,7 @@ EXPORT_SYMBOL_GPL(iommu_sva_unbind_gpasid); static void __iommu_detach_device(struct iommu_domain *domain, struct device *dev) { - if ((domain->ops->is_attach_deferred != NULL) && - domain->ops->is_attach_deferred(domain, dev)) + if (iommu_is_attach_deferred(domain, dev)) return; if (unlikely(domain->ops->detach_dev == NULL)) |