summaryrefslogtreecommitdiff
path: root/drivers/iommu
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2015-05-28 18:41:38 +0200
committerJoerg Roedel <jroedel@suse.de>2015-06-11 09:42:21 +0200
commit063071dff53858027e95d3cfcedb1780952302ad (patch)
tree7c41f67ea59d828fd83562d856f588e8ec7aa382 /drivers/iommu
parent35cf248f8860b8d2956516d6cdf7e57ff4ed4cbb (diff)
iommu/amd: Use default domain if available for DMA-API
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/amd_iommu.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 22d38e3cdc7a..ae7d636d3099 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -2495,12 +2495,19 @@ void amd_iommu_init_notifier(void)
static struct protection_domain *get_domain(struct device *dev)
{
struct protection_domain *domain;
+ struct iommu_domain *io_domain;
struct dma_ops_domain *dma_dom;
u16 devid = get_device_id(dev);
if (!check_device(dev))
return ERR_PTR(-EINVAL);
+ io_domain = iommu_get_domain_for_dev(dev);
+ if (io_domain) {
+ domain = to_pdomain(io_domain);
+ return domain;
+ }
+
domain = domain_for_device(dev);
if (domain != NULL && !dma_ops_domain(domain))
return ERR_PTR(-EBUSY);