summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Liu <xuegang.liu@nxp.com>2020-03-23 17:08:08 +0000
committerYong Gan <yong.gan@nxp.com>2020-04-23 17:47:43 +0800
commit52635c5ba1ff8a4c7b4469e85db4f87c337a354b (patch)
tree56891d2df405d25f8d30b7ada32c6021c3d68261
parent03cfd33c5f341370509952e7d8f06bd60fdc92b5 (diff)
MGS-5565-1 staging: android: ion: Flush outer cache after zero CMA allocated memory
Need flush outer cache after zero CMA allocated memory on arm32 platform. Change-Id: Ieaa7c62bf65e4490f904d68bed1fa16fb7c5d8fa Signed-off-by: Richard Liu <xuegang.liu@nxp.com> Reviewed-by: Bing Song <bing.song@nxp.com> (cherry picked from commit 9e51da339eb290f35eb79d9acc0ea147d8bdf0cf)
-rw-r--r--drivers/staging/android/ion/ion_cma_heap.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/drivers/staging/android/ion/ion_cma_heap.c b/drivers/staging/android/ion/ion_cma_heap.c
index 80df813372e4..8589eff9b77f 100644
--- a/drivers/staging/android/ion/ion_cma_heap.c
+++ b/drivers/staging/android/ion/ion_cma_heap.c
@@ -23,6 +23,9 @@
#include <linux/scatterlist.h>
#include <linux/highmem.h>
#include <asm/cacheflush.h>
+#ifdef CONFIG_ARM
+#include <asm/outercache.h>
+#endif
#include "ion.h"
@@ -56,26 +59,35 @@ static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
if (PageHighMem(pages)) {
unsigned long nr_clear_pages = nr_pages;
struct page *page = pages;
+#ifdef CONFIG_ARM
+ phys_addr_t base = __pfn_to_phys(page_to_pfn(pages));
+ phys_addr_t end = base + size;
+#endif
while (nr_clear_pages > 0) {
void *vaddr = kmap_atomic(page);
memset(vaddr, 0, PAGE_SIZE);
-#ifdef CONFIG_ARM64
- __flush_dcache_area(vaddr,PAGE_SIZE);
-#else
+#ifdef CONFIG_ARM
__cpuc_flush_dcache_area(vaddr,PAGE_SIZE);
+#else
+ __flush_dcache_area(vaddr,PAGE_SIZE);
#endif
kunmap_atomic(vaddr);
page++;
nr_clear_pages--;
}
+#ifdef CONFIG_ARM
+ outer_flush_range(base, end);
+#endif
} else {
- memset(page_address(pages), 0, size);
-#ifdef CONFIG_ARM64
- __flush_dcache_area(page_address(pages),size);
+ void *ptr = page_address(pages);
+ memset(ptr, 0, size);
+#ifdef CONFIG_ARM
+ __cpuc_flush_dcache_area(ptr,size);
+ outer_flush_range(__pa(ptr), __pa(ptr) + size);
#else
- __cpuc_flush_dcache_area(page_address(pages),size);
+ __flush_dcache_area(ptr,size);
#endif
}