#include <linux/scatterlist.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
+
+#include <asm/cacheflush.h>
+
#include "ion.h"
#define ION_CARVEOUT_ALLOCATE_FAIL -1
phys_addr_t paddr = PFN_PHYS(page_to_pfn(page));
ion_heap_buffer_zero(buffer);
+ /* the free pages in carveout pool should be cache cold */
+ if ((buffer->flags & ION_FLAG_CACHED) != 0)
+ __flush_dcache_area(page_to_virt(page), buffer->size);
ion_carveout_free(heap, paddr, buffer->size);
sg_free_table(table);
page = pfn_to_page(PFN_DOWN(heap_data->base));
size = heap_data->size;
- ret = ion_heap_pages_zero(page, size, pgprot_writecombine(PAGE_KERNEL));
+ ret = ion_heap_pages_zero(page, size, PAGE_KERNEL);
if (ret)
return ERR_PTR(ret);
+ __flush_dcache_area(page_to_virt(page), size);
+
carveout_heap = kzalloc(sizeof(*carveout_heap), GFP_KERNEL);
if (!carveout_heap)
return ERR_PTR(-ENOMEM);
#include <linux/scatterlist.h>
#include <linux/highmem.h>
+#include <asm/cacheflush.h>
+
#include "ion.h"
struct ion_cma_heap {
buffer->priv_virt = pages;
buffer->sg_table = table;
+
+ if (!(flags & ION_FLAG_CACHED))
+ __flush_dcache_area(page_to_virt(pages), len);
+
return 0;
free_mem:
#include <linux/slab.h>
#include <linux/swap.h>
+#include <asm/cacheflush.h>
+
#include "ion.h"
static void *ion_page_pool_alloc_pages(struct ion_page_pool *pool)
page = ion_page_pool_remove(pool, false);
mutex_unlock(&pool->mutex);
- if (!page)
+ if (!page) {
page = ion_page_pool_alloc_pages(pool);
+ if (!pool->cached)
+ __flush_dcache_area(page_to_virt(page),
+ 1 << (PAGE_SHIFT + pool->order));
+ }
return page;
}
pool->order = order;
mutex_init(&pool->mutex);
plist_node_init(&pool->list, order);
- if (cached)
- pool->cached = true;
+ pool->cached = cached;
return pool;
}