summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Daly <pdaly@codeaurora.org>2016-03-10 15:06:42 -0800
committerJeevan Shriram <jshriram@codeaurora.org>2016-04-05 11:30:35 -0700
commit5c84634ca59ace0ba16bfd8a9741b359ea601536 (patch)
treee415be1af8d069a4474fc1320031bdc06a591db3
parent2a0c9c9dee97747b66fb51b525e5d6e9050e3b7f (diff)
arm64: dma_mapping: Support DOMAIN_ATTR_S1_BYPASS
For iommus which do not use stage1 translation, stage2 may not be aware of the device's dma_mask requirements. Choose the dma_ops such that allocations are made within the dma_mask region and bounce buffers are used as necessary. Change-Id: If2ae2021ae9ce10bd22f424967cfcd9c3f94534e Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
-rw-r--r--arch/arm64/mm/dma-mapping.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index 1a665e04d139..e6777606a934 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -2112,14 +2112,19 @@ int arm_iommu_attach_device(struct device *dev,
struct dma_iommu_mapping *mapping)
{
int err;
+ int s1_bypass = 0;
err = iommu_attach_device(mapping->domain, dev);
if (err)
return err;
+ iommu_domain_get_attr(mapping->domain, DOMAIN_ATTR_S1_BYPASS,
+ &s1_bypass);
+
kref_get(&mapping->kref);
dev->archdata.mapping = mapping;
- set_dma_ops(dev, &iommu_ops);
+ if (!s1_bypass)
+ set_dma_ops(dev, &iommu_ops);
pr_debug("Attached IOMMU controller to %s device.\n", dev_name(dev));
return 0;