summaryrefslogtreecommitdiff
path: root/arch/arm64/mm/dma-mapping.c
diff options
context:
space:
mode:
authorMitchel Humpherys <mitchelh@codeaurora.org>2015-10-08 15:03:09 -0700
committerJeevan Shriram <jshriram@codeaurora.org>2016-05-20 19:24:00 -0700
commit66bd3185331d065428e9279085322ceb8adced85 (patch)
treedd99f8f585470a4a725a43f04116d325da17051a /arch/arm64/mm/dma-mapping.c
parentd740dc5f65964350fbe1c084b1e752240930110c (diff)
iommu: Add DMA mapper for io-pgtable-fast
io-pgtable-fast does some underhanded tricks to achieve performance. One of those tricks is that it expects clients to call its map function directly, rather than going through the IOMMU framework. Add a DMA API implementation that goes through io-pgtable-fast. CRs-Fixed: 997751 Change-Id: Iebcafeb630d9023f666078604898069e9f26dfdd Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Diffstat (limited to 'arch/arm64/mm/dma-mapping.c')
-rw-r--r--arch/arm64/mm/dma-mapping.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index e6777606a934..760874c2fb45 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -33,6 +33,7 @@
#include <asm/tlbflush.h>
#include <linux/io.h>
#include <asm/dma-iommu.h>
+#include <linux/dma-mapping-fast.h>
#include "mm.h"
@@ -2112,7 +2113,11 @@ int arm_iommu_attach_device(struct device *dev,
struct dma_iommu_mapping *mapping)
{
int err;
- int s1_bypass = 0;
+ int s1_bypass = 0, is_fast = 0;
+
+ iommu_domain_get_attr(mapping->domain, DOMAIN_ATTR_FAST, &is_fast);
+ if (is_fast)
+ return fast_smmu_attach_device(dev, mapping);
err = iommu_attach_device(mapping->domain, dev);
if (err)
@@ -2141,6 +2146,7 @@ EXPORT_SYMBOL(arm_iommu_attach_device);
void arm_iommu_detach_device(struct device *dev)
{
struct dma_iommu_mapping *mapping;
+ int is_fast;
mapping = to_dma_iommu_mapping(dev);
if (!mapping) {
@@ -2148,6 +2154,12 @@ void arm_iommu_detach_device(struct device *dev)
return;
}
+ iommu_domain_get_attr(mapping->domain, DOMAIN_ATTR_FAST, &is_fast);
+ if (is_fast) {
+ fast_smmu_detach_device(dev, mapping);
+ return;
+ }
+
iommu_detach_device(mapping->domain, dev);
kref_put(&mapping->kref, release_iommu_mapping);
dev->archdata.mapping = NULL;