summaryrefslogtreecommitdiff
path: root/drivers/staging/android/ion/ion_cma_heap.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/android/ion/ion_cma_heap.c')
-rw-r--r--drivers/staging/android/ion/ion_cma_heap.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/drivers/staging/android/ion/ion_cma_heap.c b/drivers/staging/android/ion/ion_cma_heap.c
index fa3e4b7e0c9f..8589eff9b77f 100644
--- a/drivers/staging/android/ion/ion_cma_heap.c
+++ b/drivers/staging/android/ion/ion_cma_heap.c
@@ -22,6 +22,10 @@
#include <linux/cma.h>
#include <linux/scatterlist.h>
#include <linux/highmem.h>
+#include <asm/cacheflush.h>
+#ifdef CONFIG_ARM
+#include <asm/outercache.h>
+#endif
#include "ion.h"
@@ -55,17 +59,36 @@ 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_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);
+ 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
+ __flush_dcache_area(ptr,size);
+#endif
}
table = kmalloc(sizeof(*table), GFP_KERNEL);