From d936645464835e970901c0b8e8476382a51d498b Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Thu, 1 Apr 2021 15:58:01 +0000 Subject: zephyr: hooks: make deferred queue stack size configurable The Zephyr implementation of EC hooks is currently using a hardcoded stack size of 1024 bytes. Make it configurable so that we can tweak it on the board configs. BUG=none BRANCH=none TEST=kernel stacks on the EC shell Signed-off-by: Fabio Baltieri Change-Id: I705f18b3a17ca9da62421ae563bbc6a2f8cefbc5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2799681 Reviewed-by: Jack Rosenthal Reviewed-by: Keith Short Reviewed-by: Simon Glass --- zephyr/Kconfig.system | 7 +++++++ zephyr/shim/src/hooks.c | 6 ++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/zephyr/Kconfig.system b/zephyr/Kconfig.system index 4fb681acc7..d6fd5b07e0 100644 --- a/zephyr/Kconfig.system +++ b/zephyr/Kconfig.system @@ -23,4 +23,11 @@ config PLATFORM_EC_SYSTEM_PRE_INIT_PRIORITY those critical to determining the reset type, should be initialized at lower priority so that the system reset flags are valid. +config DEFERRED_STACK_SIZE + int "Stack size for deferred calls queue" + default 1024 + help + This defines the stack size for the Zephyr implementation of the EC + hooks API. + endif # PLATFORM_EC diff --git a/zephyr/shim/src/hooks.c b/zephyr/shim/src/hooks.c index dee7c20441..fed75d51db 100644 --- a/zephyr/shim/src/hooks.c +++ b/zephyr/shim/src/hooks.c @@ -12,8 +12,6 @@ #include "task.h" #include "timer.h" -#define DEFERRED_STACK_SIZE 1024 - /* * Deferred thread is always the lowest priority, and preemptive if * available. @@ -24,7 +22,7 @@ #define DEFERRED_THREAD_PRIORITY -1 #endif -static K_THREAD_STACK_DEFINE(deferred_thread, DEFERRED_STACK_SIZE); +static K_THREAD_STACK_DEFINE(deferred_thread, CONFIG_DEFERRED_STACK_SIZE); static struct k_work_q deferred_work_queue; static void deferred_work_queue_handler(struct k_work *work) @@ -39,7 +37,7 @@ static int init_deferred_work_queue(const struct device *unused) { ARG_UNUSED(unused); k_work_q_start(&deferred_work_queue, deferred_thread, - DEFERRED_STACK_SIZE, DEFERRED_THREAD_PRIORITY); + CONFIG_DEFERRED_STACK_SIZE, DEFERRED_THREAD_PRIORITY); return 0; } SYS_INIT(init_deferred_work_queue, APPLICATION, 0); -- cgit v1.2.1