summaryrefslogtreecommitdiff
path: root/drivers/video/tegra/nvmap/nvmap_handle.c
diff options
context:
space:
mode:
authorvdumpa <vdumpa@nvidia.com>2011-02-11 21:53:45 -0800
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:44:54 -0800
commitb603a4119e1d42d9c24c189ce33b3709f9158042 (patch)
tree6d8a2ed44483e5eee96b4a915707717b193a6742 /drivers/video/tegra/nvmap/nvmap_handle.c
parent0276bde775b680204e2f27a9764790865dc83b7a (diff)
tegra:video:nvmap: optimize cache_maint operation.
video:tegra:nvmap: Clean whole L1 instead of cleaning by MVA For large allocations, cleaning each page of the allocation can take a significant amount of time. If an allocation that nvmap needs to clean or invalidate out of the cache is significantly larger than the cache, just flush the entire cache by set/ways. bug 788967 Reviewed-on: http://git-master/r/19354 (cherry picked from commit c01c12e63b1476501204152356867aeb5091fb80) tegra:video:nvmap: optimize cache_maint operation. optimize cache_maint operation for carveout and heap memories. flush carveout memory allocations on memory free. Bug 761637 Reviewed-on: http://git-master/r/21205 Conflicts: drivers/video/tegra/nvmap/nvmap_dev.c drivers/video/tegra/nvmap/nvmap_heap.c drivers/video/tegra/nvmap/nvmap_ioctl.c (cherry picked from commit 731df4df5e895e1d4999359d6d5939fc2095f883) tegra:video:nvmap: optimize cache flush for system heap pages. optimize cache flush for pages allocated from system heap. Bug 788187 Reviewed-on: http://git-master/r/21687 (cherry picked from commit 3f318911ad91410aed53c90494210e2b8f74308b) Original-Change-Id: Ia7b90ba0b50acfef1b88dd8095219c51733e027f Reviewed-on: http://git-master/r/23465 Reviewed-by: Kirill Artamonov <kartamonov@nvidia.com> Tested-by: Kirill Artamonov <kartamonov@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Rebase-Id: R04f618f88ed1d2c7a680d51a8c5113f42de3f667
Diffstat (limited to 'drivers/video/tegra/nvmap/nvmap_handle.c')
-rw-r--r--drivers/video/tegra/nvmap/nvmap_handle.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/video/tegra/nvmap/nvmap_handle.c b/drivers/video/tegra/nvmap/nvmap_handle.c
index dc3be30ca2f5..a9150a36cf2a 100644
--- a/drivers/video/tegra/nvmap/nvmap_handle.c
+++ b/drivers/video/tegra/nvmap/nvmap_handle.c
@@ -37,6 +37,7 @@
#include "nvmap.h"
#include "nvmap_mru.h"
+#include "nvmap_common.h"
#define NVMAP_SECURE_HEAPS (NVMAP_HEAP_CARVEOUT_IRAM | NVMAP_HEAP_IOVMM)
#ifdef CONFIG_NVMAP_HIGHMEM_ONLY
@@ -107,7 +108,8 @@ out:
extern void __flush_dcache_page(struct address_space *, struct page *);
-static struct page *nvmap_alloc_pages_exact(gfp_t gfp, size_t size)
+static struct page *nvmap_alloc_pages_exact(gfp_t gfp,
+ size_t size, bool flush_inner)
{
struct page *page, *p, *e;
unsigned int order;
@@ -127,8 +129,10 @@ static struct page *nvmap_alloc_pages_exact(gfp_t gfp, size_t size)
__free_page(p);
e = page + (size >> PAGE_SHIFT);
- for (p = page; p < e; p++)
- __flush_dcache_page(page_mapping(p), p);
+ 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);
@@ -143,6 +147,7 @@ static int handle_page_alloc(struct nvmap_client *client,
pgprot_t prot;
unsigned int i = 0;
struct page **pages;
+ bool flush_inner = true;
pages = altalloc(nr_page * sizeof(*pages));
if (!pages)
@@ -155,10 +160,14 @@ 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);
+ page = nvmap_alloc_pages_exact(GFP_NVMAP, size, flush_inner);
if (!page)
goto fail;
@@ -167,7 +176,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);
+ pages[i] = nvmap_alloc_pages_exact(GFP_NVMAP, PAGE_SIZE,
+ flush_inner);
if (!pages[i])
goto fail;
}
@@ -193,6 +203,7 @@ fail:
while (i--)
__free_page(pages[i]);
altfree(pages, nr_page * sizeof(*pages));
+ wmb();
return -ENOMEM;
}