summaryrefslogtreecommitdiff
path: root/drivers/video/tegra/nvmap
diff options
context:
space:
mode:
authorKrishna Reddy <vdumpa@nvidia.com>2011-07-06 14:57:44 -0700
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:47:49 -0800
commit949379b4ff8c0c060d67e0c7f89d5e134685ecca (patch)
tree4b4f3530fd6f9011465828e7e9f9d9ebea2b180d /drivers/video/tegra/nvmap
parent313a5ea92d6a703fb85d506ca7979a6bf1104305 (diff)
video: tegra: nvmap: Fix cache flush issue during page alloc.
Bug 39790 Original-Change-Id: I5ce0e35501442ed1a6818aebfeae1670ebb9d08d Reviewed-on: http://git-master/r/39867 Reviewed-by: Krishna Reddy <vdumpa@nvidia.com> Tested-by: Krishna Reddy <vdumpa@nvidia.com> Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com> Rebase-Id: R5679d529af4779bde735d3055b04d368b765c620
Diffstat (limited to 'drivers/video/tegra/nvmap')
-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;