aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJorge Ramirez-Ortiz <jorge@foundries.io>2020-08-25 08:56:28 +0200
committerJerome Forissier <jerome@forissier.org>2020-09-29 13:14:04 +0200
commitcca7b5ebeb9be199936930b308a2b04498a01dbc (patch)
tree2b3779d60416c492605fff0cc6eff88f46bd7cdd
parentee2f75af753f876e5602064925ec79ef05b9d60b (diff)
downloadoptee_os-cca7b5ebeb9be199936930b308a2b04498a01dbc.tar.gz
core: configuration switches to tune stack sizes
Enabling certain configuration options might increase the TMP and THREAD stack requirements. This commit defines CFG_ options so that the sizes of those two stacks can be fine tuned at build time. Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Jerome Forissier <jerome@forissier.org>
-rw-r--r--core/arch/arm/kernel/thread.c6
-rw-r--r--mk/config.mk4
2 files changed, 8 insertions, 2 deletions
diff --git a/core/arch/arm/kernel/thread.c b/core/arch/arm/kernel/thread.c
index ee51de825..7af396d6a 100644
--- a/core/arch/arm/kernel/thread.c
+++ b/core/arch/arm/kernel/thread.c
@@ -123,10 +123,12 @@ linkage uint32_t name[num_stacks] \
#define GET_STACK(stack) ((vaddr_t)(stack) + STACK_SIZE(stack))
-DECLARE_STACK(stack_tmp, CFG_TEE_CORE_NB_CORE, STACK_TMP_SIZE, static);
+DECLARE_STACK(stack_tmp, CFG_TEE_CORE_NB_CORE,
+ STACK_TMP_SIZE + CFG_STACK_TMP_EXTRA, static);
DECLARE_STACK(stack_abt, CFG_TEE_CORE_NB_CORE, STACK_ABT_SIZE, static);
#ifndef CFG_WITH_PAGER
-DECLARE_STACK(stack_thread, CFG_NUM_THREADS, STACK_THREAD_SIZE, static);
+DECLARE_STACK(stack_thread, CFG_NUM_THREADS,
+ STACK_THREAD_SIZE + CFG_STACK_THREAD_EXTRA, static);
#endif
#define GET_STACK_TOP_HARD(stack, n) \
diff --git a/mk/config.mk b/mk/config.mk
index 6cb9e7f2c..fd0ccf3a2 100644
--- a/mk/config.mk
+++ b/mk/config.mk
@@ -348,6 +348,10 @@ CFG_WITH_STACK_CANARIES ?= y
# stack limits on entry and panic immediately if it is out of range.
CFG_CORE_DEBUG_CHECK_STACKS ?= n
+# Use when the default stack allocations are not sufficient.
+CFG_STACK_THREAD_EXTRA ?= 0
+CFG_STACK_TMP_EXTRA ?= 0
+
# Device Tree support
#
# When CFG_DT is enabled core embeds the FDT library (libfdt) allowing