summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2016-10-11 01:16:57 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2016-10-11 01:16:57 -0700
commitf9e72fc16948a13d662d42ef80f6ce0ca32ceddb (patch)
treec915f48f05a90f944eb1262ba3767449eb5b037f
parent39de1de4212748094696600ba66eed91f2086d2e (diff)
parent4d765249313f2b46c2c19f02d76f9031e93e2bce (diff)
Merge "iommu: msm: add barrier call on coherent lazy map"
-rw-r--r--drivers/iommu/msm_dma_iommu_mapping.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/iommu/msm_dma_iommu_mapping.c b/drivers/iommu/msm_dma_iommu_mapping.c
index 0a8728ce36dc..25fe36ab6339 100644
--- a/drivers/iommu/msm_dma_iommu_mapping.c
+++ b/drivers/iommu/msm_dma_iommu_mapping.c
@@ -17,6 +17,7 @@
#include <linux/rbtree.h>
#include <linux/mutex.h>
#include <linux/err.h>
+#include <asm/barrier.h>
#include <linux/msm_dma_iommu_mapping.h>
@@ -216,10 +217,13 @@ static inline int __msm_dma_map_sg(struct device *dev, struct scatterlist *sg,
sg->dma_length = iommu_map->sgl.dma_length;
kref_get(&iommu_map->ref);
- /*
- * Need to do cache operations here based on "dir" in the
- * future if we go with coherent mappings.
- */
+ if (is_device_dma_coherent(dev))
+ /*
+ * Ensure all outstanding changes for coherent
+ * buffers are applied to the cache before any
+ * DMA occurs.
+ */
+ dmb(ish);
ret = nents;
}
mutex_unlock(&iommu_meta->lock);