summaryrefslogtreecommitdiffstats
path: root/arch/arc/mm/dma.c
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2015-04-03 12:37:07 +0300
committerVineet Gupta <vgupta@synopsys.com>2015-06-25 06:00:19 +0530
commit795f4558562fd5318260d5d8144a2f8612aeda7b (patch)
treeb4cb8211acf56f2f8acc7ef1429cee4e667f2834 /arch/arc/mm/dma.c
parenta5c8b52abe677977883655166796f167ef1e0084 (diff)
downloadop-kernel-dev-795f4558562fd5318260d5d8144a2f8612aeda7b.zip
op-kernel-dev-795f4558562fd5318260d5d8144a2f8612aeda7b.tar.gz
ARCv2: SLC: Handle explcit flush for DMA ops (w/o IO-coherency)
L2 cache on ARCHS processors is called SLC (System Level Cache) For working DMA (in absence of hardware assisted IO Coherency) we need to manage SLC explicitly when buffers transition between cpu and controllers. Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Diffstat (limited to 'arch/arc/mm/dma.c')
-rw-r--r--arch/arc/mm/dma.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/arc/mm/dma.c b/arch/arc/mm/dma.c
index 2cfe81d..74a637a 100644
--- a/arch/arc/mm/dma.c
+++ b/arch/arc/mm/dma.c
@@ -66,6 +66,18 @@ void *dma_alloc_coherent(struct device *dev, size_t size,
/* This is bus address, platform dependent */
*dma_handle = (dma_addr_t)paddr;
+ /*
+ * Evict any existing L1 and/or L2 lines for the backing page
+ * in case it was used earlier as a normal "cached" page.
+ * Yeah this bit us - STAR 9000898266
+ *
+ * Although core does call flush_cache_vmap(), it gets kvaddr hence
+ * can't be used to efficiently flush L1 and/or L2 which need paddr
+ * Currently flush_cache_vmap nukes the L1 cache completely which
+ * will be optimized as a separate commit
+ */
+ dma_cache_wback_inv((unsigned long)paddr, size);
+
return kvaddr;
}
EXPORT_SYMBOL(dma_alloc_coherent);
OpenPOWER on IntegriCloud