diff options
author | Bharat Bhushan <Bharat.Bhushan@freescale.com> | 2013-04-15 09:23:46 (GMT) |
---|---|---|
committer | Fleming Andrew-AFLEMING <AFLEMING@freescale.com> | 2013-04-19 23:10:20 (GMT) |
commit | 21b92314a5a8c5457a61f01122fc388f61b44145 (patch) | |
tree | 60cd3dc2f631d7a817186d709357443d5bfb91d3 /drivers/iommu | |
parent | db6d844077c0ccfab1a1e6daac1b2dce9e08a3be (diff) | |
download | linux-fsl-qoriq-21b92314a5a8c5457a61f01122fc388f61b44145.tar.xz |
iommu: add api to get iommu_domain of a device
This api return the iommu domain to which the device is attached.
The iommu_domain is required for making API calls related to iommu.
Follow up patches which use this API to know iommu maping.
Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
Change-Id: Ib4ff98b9e12f32bdbd8ecbe8379b102f7b10efa7
Reviewed-on: http://git.am.freescale.net:8181/1490
Reviewed-by: Yoder Stuart-B08248 <stuart.yoder@freescale.com>
Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
Tested-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
Diffstat (limited to 'drivers/iommu')
-rw-r--r-- | drivers/iommu/iommu.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index af6efd8..d1317b0 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -667,6 +667,16 @@ void iommu_detach_device(struct iommu_domain *domain, struct device *dev) } EXPORT_SYMBOL_GPL(iommu_detach_device); +struct iommu_domain *iommu_get_dev_domain(struct device *dev) +{ + struct iommu_ops *ops = dev->bus->iommu_ops; + + if (unlikely(ops == NULL || ops->get_dev_iommu_domain == NULL)) + return NULL; + + return ops->get_dev_iommu_domain(dev); +} +EXPORT_SYMBOL_GPL(iommu_get_dev_domain); /* * IOMMU groups are really the natrual working unit of the IOMMU, but * the IOMMU API works on domains and devices. Bridge that gap by |