summaryrefslogtreecommitdiff
path: root/drivers/video/tegra/nvmap/nvmap_heap.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_heap.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_heap.c')
-rw-r--r--drivers/video/tegra/nvmap/nvmap_heap.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/video/tegra/nvmap/nvmap_heap.c b/drivers/video/tegra/nvmap/nvmap_heap.c
index c920048db82b..a0a574d78944 100644
--- a/drivers/video/tegra/nvmap/nvmap_heap.c
+++ b/drivers/video/tegra/nvmap/nvmap_heap.c
@@ -3,7 +3,7 @@
*
* GPU heap allocator.
*
- * Copyright (c) 2010, NVIDIA Corporation.
+ * Copyright (c) 2011, NVIDIA Corporation.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -31,6 +31,7 @@
#include <mach/nvmap.h>
#include "nvmap.h"
#include "nvmap_heap.h"
+#include "nvmap_common.h"
#include <asm/tlbflush.h>
#include <asm/cacheflush.h>
@@ -887,6 +888,9 @@ struct nvmap_heap_block *nvmap_heap_alloc(struct nvmap_heap *h, size_t len,
struct nvmap_heap *nvmap_block_to_heap(struct nvmap_heap_block *b)
{
+ struct buddy_heap *bh = NULL;
+ struct nvmap_heap *h;
+
if (b->type == BLOCK_BUDDY) {
struct buddy_block *bb;
bb = container_of(b, struct buddy_block, block);
@@ -898,17 +902,24 @@ struct nvmap_heap *nvmap_block_to_heap(struct nvmap_heap_block *b)
}
}
+int nvmap_flush_heap_block(struct nvmap_client *client,
+ struct nvmap_heap_block *block, size_t len, unsigned int prot);
+
/* nvmap_heap_free: frees block b*/
void nvmap_heap_free(struct nvmap_heap_block *b)
{
struct buddy_heap *bh = NULL;
struct nvmap_heap *h = nvmap_block_to_heap(b);
+ struct list_block *lb;
mutex_lock(&h->lock);
if (b->type == BLOCK_BUDDY)
bh = do_buddy_free(b);
- else
+ else {
+ lb = container_of(b, struct list_block, block);
+ nvmap_flush_heap_block(NULL, b, lb->size, lb->mem_prot);
do_heap_free(b);
+ }
if (bh) {
list_del(&bh->buddy_list);
@@ -1008,6 +1019,10 @@ struct nvmap_heap *nvmap_heap_create(struct device *parent, const char *name,
l->orig_addr = base;
list_add_tail(&l->free_list, &h->free_list);
list_add_tail(&l->all_list, &h->all_list);
+
+ inner_flush_cache_all();
+ outer_flush_range(base, base + len);
+ wmb();
return h;
fail_register: