summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2014-08-11 14:25:20 -0700
committerWinnie Hsu <whsu@nvidia.com>2015-05-12 13:27:58 -0700
commit4a3a5bb3cb51bcd55d0695fcb4d6d28b4b2f2461 (patch)
tree08bd3090e7c64ad6c355bf98d714381b3e8d9a9a
parent2078fc6edf484960131403f1708118a48875e29f (diff)
nvmap: combine two methods of requesting zeroed memory
Combine CONFIG_NVMAP_FORCE_ZEROED_USER_PAGES and the zero_memory modparam into a single option by forcing zero_memory=1 when CONFIG_NVMAP_FORCE_ZEROED_USER_PAGES is set, and always using zero_memory to decided whether to zero or not. Change-Id: I9ce0106cfaea950bd9494b697916fbc2a03329ea Signed-off-by: Colin Cross <ccross@android.com> Signed-off-by: Krishna Reddy <vdumpa@nvidia.com> Reviewed-on: http://git-master/r/664672 GVS: Gerrit_Virtual_Submit Reviewed-on: http://git-master/r/736426 Reviewed-by: Alex Waterman <alexw@nvidia.com> Tested-by: Alex Waterman <alexw@nvidia.com>
-rw-r--r--drivers/video/tegra/nvmap/nvmap_handle.c8
-rw-r--r--drivers/video/tegra/nvmap/nvmap_priv.h10
2 files changed, 8 insertions, 10 deletions
diff --git a/drivers/video/tegra/nvmap/nvmap_handle.c b/drivers/video/tegra/nvmap/nvmap_handle.c
index 3dd2c3c4f44f..59bb6db2b835 100644
--- a/drivers/video/tegra/nvmap/nvmap_handle.c
+++ b/drivers/video/tegra/nvmap/nvmap_handle.c
@@ -40,7 +40,13 @@
#include "nvmap_priv.h"
#include "nvmap_ioctl.h"
+#ifdef CONFIG_NVMAP_FORCE_ZEROED_USER_PAGES
+bool zero_memory = true;
+#define ZERO_MEMORY_PERMS 0444
+#else
bool zero_memory;
+#define ZERO_MEMORY_PERMS 0644
+#endif
static int zero_memory_set(const char *arg, const struct kernel_param *kp)
{
@@ -54,7 +60,7 @@ static struct kernel_param_ops zero_memory_ops = {
.set = zero_memory_set,
};
-module_param_cb(zero_memory, &zero_memory_ops, &zero_memory, 0644);
+module_param_cb(zero_memory, &zero_memory_ops, &zero_memory, ZERO_MEMORY_PERMS);
u32 nvmap_max_handle_count;
diff --git a/drivers/video/tegra/nvmap/nvmap_priv.h b/drivers/video/tegra/nvmap/nvmap_priv.h
index f6060e86e281..27cb3290a599 100644
--- a/drivers/video/tegra/nvmap/nvmap_priv.h
+++ b/drivers/video/tegra/nvmap/nvmap_priv.h
@@ -55,15 +55,7 @@
#define __GFP_NVMAP (GFP_KERNEL | __GFP_HIGHMEM)
#endif
-#ifdef CONFIG_NVMAP_FORCE_ZEROED_USER_PAGES
-#define NVMAP_ZEROED_PAGES __GFP_ZERO
-#else
-#define NVMAP_ZEROED_PAGES 0
-#endif
-
-#define GFP_NVMAP (__GFP_NVMAP | __GFP_NOWARN | NVMAP_ZEROED_PAGES)
-
-extern bool zero_memory;
+#define GFP_NVMAP (__GFP_NVMAP | __GFP_NOWARN)
#ifdef CONFIG_64BIT
#define NVMAP_LAZY_VFREE