summaryrefslogtreecommitdiff
path: root/drivers/iommu/iommu.c
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2014-09-03 20:47:25 +0400
committerJoerg Roedel <jroedel@suse.de>2014-09-25 17:44:49 +0400
commit3c0e0ca0a4e757159d868c4870556515d66b6c97 (patch)
tree2edcb98cf5ab39daa4423054870030c81dd399ec /drivers/iommu/iommu.c
parent1aed074869a9cbe0a846ea7b254d8fd9a4a4d31f (diff)
downloadlinux-3c0e0ca0a4e757159d868c4870556515d66b6c97.tar.xz
iommu: Introduce iommu_capable API function
This function will replace the current iommu_domain_has_cap function and clean up the interface while at it. Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/iommu.c')
-rw-r--r--drivers/iommu/iommu.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index bc45478e26db..aeb243f46332 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -817,6 +817,15 @@ bool iommu_present(struct bus_type *bus)
}
EXPORT_SYMBOL_GPL(iommu_present);
+bool iommu_capable(struct bus_type *bus, enum iommu_cap cap)
+{
+ if (!bus->iommu_ops || !bus->iommu_ops->capable)
+ return false;
+
+ return bus->iommu_ops->capable(cap);
+}
+EXPORT_SYMBOL_GPL(iommu_capable);
+
/**
* iommu_set_fault_handler() - set a fault handler for an iommu domain
* @domain: iommu domain
@@ -950,10 +959,13 @@ EXPORT_SYMBOL_GPL(iommu_iova_to_phys);
int iommu_domain_has_cap(struct iommu_domain *domain,
enum iommu_cap cap)
{
- if (unlikely(domain->ops->domain_has_cap == NULL))
- return 0;
+ if (domain->ops->domain_has_cap != NULL)
+ return domain->ops->domain_has_cap(domain, cap);
+
+ if (domain->ops->capable != NULL)
+ return domain->ops->capable(cap);
- return domain->ops->domain_has_cap(domain, cap);
+ return 0;
}
EXPORT_SYMBOL_GPL(iommu_domain_has_cap);