aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu/iommu.c
diff options
context:
space:
mode:
authorBaoquan He <bhe@redhat.com>2017-08-09 16:33:40 +0800
committerJoerg Roedel <jroedel@suse.de>2017-08-15 18:14:39 +0200
commite01d1913b0d0817191418381a6fcebaa01abde2a (patch)
tree462e79ba6c2b8b9c590e392b8f4fbb508f52dc4b /drivers/iommu/iommu.c
parentiommu/amd: Do sanity check for address translation and irq remap of old dev table entry (diff)
downloadlinux-dev-e01d1913b0d0817191418381a6fcebaa01abde2a.tar.xz
linux-dev-e01d1913b0d0817191418381a6fcebaa01abde2a.zip
iommu: Add is_attach_deferred call-back to iommu-ops
This new call-back will be used to check if the domain attach need be deferred for now. If yes, the domain attach/detach will return directly. Signed-off-by: Baoquan He <bhe@redhat.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/iommu.c')
-rw-r--r--drivers/iommu/iommu.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 3f6ea160afed..86581b115b92 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -1283,6 +1283,10 @@ 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;
@@ -1324,6 +1328,10 @@ EXPORT_SYMBOL_GPL(iommu_attach_device);
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))
+ return;
+
if (unlikely(domain->ops->detach_dev == NULL))
return;