Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ea236038 authored by Liam Mark's avatar Liam Mark Committed by Gerrit - the friendly Code Review server
Browse files

iommu: msm: add barrier call on coherent lazy map



When clients of the lazy APIs enable IO coherency they will
skip their cache maintenance code.
However before passing a coherent buffer to the device for
DMA a barrier call must still be made to ensure the caches
are up to date.

Add this barrier call to the lazy map function when
IO coherency is enabled.

Change-Id: I3fc065f8aeff705283211e59bd641d81b4e74067
Signed-off-by: default avatarLiam Mark <lmark@codeaurora.org>
Signed-off-by: default avatarPatrick Daly <pdaly@codeaurora.org>
parent 2d9b2f6e
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -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>

@@ -205,10 +206,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);
		if (is_device_dma_coherent(dev))
			/*
		 * Need to do cache operations here based on "dir" in the
		 * future if we go with coherent mappings.
			 * 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);