From 49513423ede836d93628a11a85b7d78dd1b827eb Mon Sep 17 00:00:00 2001 From: Kirill Artamonov Date: Fri, 10 Sep 2010 08:17:25 +0300 Subject: nvrm: single pages allocation policy corrected When user doesn't use default heap policy and selects GART or carveout allocation, automatic single-page-to-sysmem rule doesn't work. Because of broken rule many single page allocations go to GART and carveout. The fix adds sysmem bit to heap mask when allocation is single page and GART or carveout is present in heap mask. bug 730124 bug 731923 (cherry picked from commit 3ca9989c922420a57215d297189738a0464c4073) Change-Id: I2ea8018ae5ed9d31e90659479d0e44052ebf9431 Reviewed-on: http://git-master/r/6701 Reviewed-by: Kirill Artamonov Tested-by: Kirill Artamonov Reviewed-by: Bharat Nihalani --- drivers/video/tegra/nvmap.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/video/tegra/nvmap.c b/drivers/video/tegra/nvmap.c index 9b24e3ff259c..b407644a90f3 100644 --- a/drivers/video/tegra/nvmap.c +++ b/drivers/video/tegra/nvmap.c @@ -1832,6 +1832,14 @@ static int _nvmap_do_alloc(struct nvmap_file_priv *priv, heap_mask &= NVMAP_SECURE_HEAPS; if (!heap_mask) return -EINVAL; } + else if ((numpages == 1) && + (heap_mask & (NVMEM_HEAP_CARVEOUT_MASK | NVMEM_HEAP_IOVMM) != + NVMEM_HEAP_CARVEOUT_IRAM)) { + // Non-secure single page iovmm and carveout allocations + // should be allowed to go to sysmem + heap_mask |= NVMEM_HEAP_SYSMEM; + } + /* can't do greater than page size alignment with page alloc */ if (align > PAGE_SIZE) heap_mask &= NVMEM_HEAP_CARVEOUT_MASK; -- cgit v1.2.3