summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorKrishna Reddy <vdumpa@nvidia.com>2011-08-30 10:15:44 -0700
committerVarun Colbert <vcolbert@nvidia.com>2011-09-20 17:06:51 -0700
commite4862709dd7fb9799072576569fd532e0a597f31 (patch)
treef8aeaf1d2e505d1975a90d682f05ae52a27d3600 /drivers
parent30b7915965ae4ea1a65a43f4d2545a8f3ac861f3 (diff)
video: tegra: nvmap: Set page attributes as per request.
After allocating pages, Set page attributes as per mem type requested. Change-Id: I972ec3613e529b64ba7d1d417c06c235fe1d3633 Reviewed-on: http://git-master/r/49882 Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Tested-by: Varun Colbert <vcolbert@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/tegra/nvmap/nvmap_handle.c31
-rw-r--r--drivers/video/tegra/nvmap/nvmap_ioctl.c7
2 files changed, 24 insertions, 14 deletions
diff --git a/drivers/video/tegra/nvmap/nvmap_handle.c b/drivers/video/tegra/nvmap/nvmap_handle.c
index d06c948f6bd5..4ab419f5bbf7 100644
--- a/drivers/video/tegra/nvmap/nvmap_handle.c
+++ b/drivers/video/tegra/nvmap/nvmap_handle.c
@@ -105,6 +105,12 @@ void _nvmap_handle_free(struct nvmap_handle *h)
nvmap_mru_remove(nvmap_get_share_from_dev(dev), h);
+ // Restore page attributes.
+ if (h->flags == NVMAP_HANDLE_WRITE_COMBINE ||
+ h->flags == NVMAP_HANDLE_UNCACHEABLE ||
+ h->flags == NVMAP_HANDLE_INNER_CACHEABLE)
+ set_pages_array_wb(h->pgalloc.pages, nr_page);
+
if (h->pgalloc.area)
tegra_iovmm_free_vm(h->pgalloc.area);
@@ -147,7 +153,6 @@ static int handle_page_alloc(struct nvmap_client *client,
pgprot_t prot;
unsigned int i = 0;
struct page **pages;
- bool flush_inner = true;
unsigned long base;
pages = altalloc(nr_page * sizeof(*pages));
@@ -190,18 +195,26 @@ 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;
- }
+ // Update the pages mapping in kernel page table.
+ if (h->flags == NVMAP_HANDLE_WRITE_COMBINE)
+ set_pages_array_wc(pages, nr_page);
+ else if (h->flags == NVMAP_HANDLE_UNCACHEABLE)
+ set_pages_array_uc(pages, nr_page);
+ else if (h->flags == NVMAP_HANDLE_INNER_CACHEABLE)
+ set_pages_array_iwb(pages, nr_page);
+ else
+ goto skip_cache_flush;
+
+ /* Flush the cache for allocated high mem pages only */
for (i = 0; i < nr_page; i++) {
- if (flush_inner)
+ if (PageHighMem(pages[i])) {
__flush_dcache_page(page_mapping(pages[i]), pages[i]);
- base = page_to_phys(pages[i]);
- outer_flush_range(base, base + PAGE_SIZE);
+ base = page_to_phys(pages[i]);
+ outer_flush_range(base, base + PAGE_SIZE);
+ }
}
+skip_cache_flush:
h->size = size;
h->pgalloc.pages = pages;
h->pgalloc.contig = contiguous;
diff --git a/drivers/video/tegra/nvmap/nvmap_ioctl.c b/drivers/video/tegra/nvmap/nvmap_ioctl.c
index 44cd7b72fe27..26ff0818b124 100644
--- a/drivers/video/tegra/nvmap/nvmap_ioctl.c
+++ b/drivers/video/tegra/nvmap/nvmap_ioctl.c
@@ -582,11 +582,8 @@ static int cache_maint(struct nvmap_client *client, struct nvmap_handle *h,
}
wmb();
-#if defined(CONFIG_ARCH_TEGRA_2x_SOC)
- if (h->flags == NVMAP_HANDLE_WRITE_COMBINE)
- goto out;
-#endif
- if (h->flags == NVMAP_HANDLE_UNCACHEABLE || start == end)
+ if (h->flags == NVMAP_HANDLE_UNCACHEABLE ||
+ h->flags == NVMAP_HANDLE_WRITE_COMBINE || start == end)
goto out;
if (fast_cache_maint(client, h, start, end, op))