diff options
-rw-r--r-- | drivers/staging/android/ion/ion_cma_heap.c | 26 |
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 } |