summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLajos Molnar <molnar@ti.com>2011-04-07 08:41:55 +0100
committerAndy Green <andy.green@linaro.org>2011-04-07 08:41:55 +0100
commit8098da93346c8720aabc983cda70f1c2bed6eb2b (patch)
treeb1eadd746dda06a3c156da2830ba9fd8fc9344d8 /drivers
parentf51ac520372aec47b66c63d00acd36052cfb7e90 (diff)
TILER: Add menuconfig and memparse support for cache_limit setting.
tiler.cache now can be specified as a memory, such as "40M". Also added TILER_CACHE_LIMIT config to set cache limit in MB. Signed-off-by: Lajos Molnar <molnar@ti.com> Signed-off-by: David Sin <davidsin@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/tiler/Kconfig18
-rw-r--r--drivers/media/video/tiler/tmm-pat.c29
2 files changed, 45 insertions, 2 deletions
diff --git a/drivers/media/video/tiler/Kconfig b/drivers/media/video/tiler/Kconfig
index 13570ed9f88..8ff8ede9164 100644
--- a/drivers/media/video/tiler/Kconfig
+++ b/drivers/media/video/tiler/Kconfig
@@ -46,6 +46,24 @@ config TILER_ALIGNMENT
Supported values are: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024,
2048, 4096.
+config TILER_CACHE_LIMIT
+ int "Memory limit to cache free pages in MBytes"
+ range 0 128
+ default 40
+ depends on TI_TILER
+ help
+ This option sets the minimum memory that TILER retains even if
+ there is less TILER allocated memory is use. The unused memory is
+ instead stored in a cache to speed up allocation and freeing of
+ physical pages.
+
+ This option can be overriden by the tiler.cache boot argument.
+
+ While initially TILER will use less memory than this limit (0), it
+ will not release any memory used until it reaches this limit.
+ Thereafter, TILER will release any unused memory immediately as
+ long as there it is above this threshold.
+
config TILER_SECURITY
int "Process security"
range 0 1
diff --git a/drivers/media/video/tiler/tmm-pat.c b/drivers/media/video/tiler/tmm-pat.c
index 0e50fa35912..bfef67cbe39 100644
--- a/drivers/media/video/tiler/tmm-pat.c
+++ b/drivers/media/video/tiler/tmm-pat.c
@@ -26,9 +26,14 @@
#include "tmm.h"
+static int param_set_mem(const char *val, struct kernel_param *kp);
+
/* Memory limit to cache free pages. TILER will eventually use this much */
-static u32 cache_limit = (40 * 1024 * 1024);
-module_param_named(cache, cache_limit, uint, 0644);
+static u32 cache_limit = CONFIG_TILER_CACHE_LIMIT << 20;
+
+param_check_uint(cache, &cache_limit);
+module_param_call(cache, param_set_mem, param_get_uint, &cache_limit, 0644);
+__MODULE_PARM_TYPE(cache, "uint")
MODULE_PARM_DESC(cache, "Cache free pages if total memory is under this limit");
/* global state - statically initialized */
@@ -58,6 +63,26 @@ struct dmm_mem {
struct dmm *dmm;
};
+/* read mem values for a param */
+static int param_set_mem(const char *val, struct kernel_param *kp)
+{
+ u32 a;
+ char *p;
+
+ /* must specify memory */
+ if (!val)
+ return -EINVAL;
+
+ /* parse value */
+ a = memparse(val, &p);
+ if (p == val || *p)
+ return -EINVAL;
+
+ /* store parsed value */
+ *(uint *)kp->arg = a;
+ return 0;
+}
+
/**
* Frees pages in a fast structure. Moves pages to the free list if there
* are less pages used than max_to_keep. Otherwise, it frees the pages