aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLajos Molnar <molnar@ti.com>2010-07-16 11:36:46 -0400
committerPaolo Pisati <paolo.pisati@canonical.com>2012-08-17 04:19:02 -0400
commit2de1e0dc63f18780cc2f4a32b945f1555235dc7a (patch)
tree2fef254ab2aca749deafbad6673372790e2c6df8
parent72ae8a5551233b8b6790df02ba98f575bc716639 (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>
-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
46 Supported values are: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 46 Supported values are: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024,
47 2048, 4096. 47 2048, 4096.
48 48
49config TILER_CACHE_LIMIT
50 int "Memory limit to cache free pages in MBytes"
51 range 0 128
52 default 40
53 depends on TI_TILER
54 help
55 This option sets the minimum memory that TILER retains even if
56 there is less TILER allocated memory is use. The unused memory is
57 instead stored in a cache to speed up allocation and freeing of
58 physical pages.
59
60 This option can be overriden by the tiler.cache boot argument.
61
62 While initially TILER will use less memory than this limit (0), it
63 will not release any memory used until it reaches this limit.
64 Thereafter, TILER will release any unused memory immediately as
65 long as there it is above this threshold.
66
49config TILER_SECURITY 67config TILER_SECURITY
50 int "Process security" 68 int "Process security"
51 range 0 1 69 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 @@
26 26
27#include "tmm.h" 27#include "tmm.h"
28 28
29static int param_set_mem(const char *val, struct kernel_param *kp);
30
29/* Memory limit to cache free pages. TILER will eventually use this much */ 31/* Memory limit to cache free pages. TILER will eventually use this much */
30static u32 cache_limit = (40 * 1024 * 1024); 32static u32 cache_limit = CONFIG_TILER_CACHE_LIMIT << 20;
31module_param_named(cache, cache_limit, uint, 0644); 33
34param_check_uint(cache, &cache_limit);
35module_param_call(cache, param_set_mem, param_get_uint, &cache_limit, 0644);
36__MODULE_PARM_TYPE(cache, "uint")
32MODULE_PARM_DESC(cache, "Cache free pages if total memory is under this limit"); 37MODULE_PARM_DESC(cache, "Cache free pages if total memory is under this limit");
33 38
34/* global state - statically initialized */ 39/* global state - statically initialized */
@@ -58,6 +63,26 @@ struct dmm_mem {
58 struct dmm *dmm; 63 struct dmm *dmm;
59}; 64};
60 65
66/* read mem values for a param */
67static int param_set_mem(const char *val, struct kernel_param *kp)
68{
69 u32 a;
70 char *p;
71
72 /* must specify memory */
73 if (!val)
74 return -EINVAL;
75
76 /* parse value */
77 a = memparse(val, &p);
78 if (p == val || *p)
79 return -EINVAL;
80
81 /* store parsed value */
82 *(uint *)kp->arg = a;
83 return 0;
84}
85
61/** 86/**
62 * Frees pages in a fast structure. Moves pages to the free list if there 87 * Frees pages in a fast structure. Moves pages to the free list if there
63 * are less pages used than max_to_keep. Otherwise, it frees the pages 88 * are less pages used than max_to_keep. Otherwise, it frees the pages