summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/video/tegra/nvmap/nvmap_handle.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/drivers/video/tegra/nvmap/nvmap_handle.c b/drivers/video/tegra/nvmap/nvmap_handle.c
index 1aed64050430..2aa971430dbc 100644
--- a/drivers/video/tegra/nvmap/nvmap_handle.c
+++ b/drivers/video/tegra/nvmap/nvmap_handle.c
@@ -119,12 +119,10 @@ out:
extern void __flush_dcache_page(struct address_space *, struct page *);
-static struct page *nvmap_alloc_pages_exact(gfp_t gfp,
- size_t size, bool flush_inner)
+static struct page *nvmap_alloc_pages_exact(gfp_t gfp, size_t size)
{
struct page *page, *p, *e;
unsigned int order;
- unsigned long base;
size = PAGE_ALIGN(size);
order = get_order(size);
@@ -134,19 +132,10 @@ static struct page *nvmap_alloc_pages_exact(gfp_t gfp,
return NULL;
split_page(page, order);
-
e = page + (1 << order);
for (p = page + (size >> PAGE_SHIFT); p < e; p++)
__free_page(p);
- e = page + (size >> PAGE_SHIFT);
- if (flush_inner) {
- for (p = page; p < e; p++)
- __flush_dcache_page(page_mapping(p), p);
- }
-
- base = page_to_phys(page);
- outer_flush_range(base, base + size);
return page;
}
@@ -159,6 +148,7 @@ static int handle_page_alloc(struct nvmap_client *client,
unsigned int i = 0;
struct page **pages;
bool flush_inner = true;
+ unsigned long base;
pages = altalloc(nr_page * sizeof(*pages));
if (!pages)
@@ -171,14 +161,10 @@ static int handle_page_alloc(struct nvmap_client *client,
contiguous = true;
#endif
- if (size >= FLUSH_CLEAN_BY_SET_WAY_THRESHOLD) {
- inner_flush_cache_all();
- flush_inner = false;
- }
h->pgalloc.area = NULL;
if (contiguous) {
struct page *page;
- page = nvmap_alloc_pages_exact(GFP_NVMAP, size, flush_inner);
+ page = nvmap_alloc_pages_exact(GFP_NVMAP, size);
if (!page)
goto fail;
@@ -187,8 +173,8 @@ static int handle_page_alloc(struct nvmap_client *client,
} else {
for (i = 0; i < nr_page; i++) {
- pages[i] = nvmap_alloc_pages_exact(GFP_NVMAP, PAGE_SIZE,
- flush_inner);
+ pages[i] = nvmap_alloc_pages_exact(GFP_NVMAP,
+ PAGE_SIZE);
if (!pages[i])
goto fail;
}
@@ -204,6 +190,17 @@ static int handle_page_alloc(struct nvmap_client *client,
#endif
}
+ /* Flush the cache for allocated pages*/
+ if (size >= FLUSH_CLEAN_BY_SET_WAY_THRESHOLD) {
+ inner_flush_cache_all();
+ flush_inner = false;
+ }
+ for (i = 0; i < nr_page; i++) {
+ if (flush_inner)
+ __flush_dcache_page(page_mapping(pages[i]), pages[i]);
+ base = page_to_phys(pages[i]);
+ outer_flush_range(base, base + PAGE_SIZE);
+ }
h->size = size;
h->pgalloc.pages = pages;