summaryrefslogtreecommitdiff
path: root/zephyr/Kconfig.tasks
diff options
context:
space:
mode:
authorFabio Baltieri <fabiobaltieri@google.com>2022-04-14 13:12:36 +0000
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-04-21 20:24:54 +0000
commit33be9c52c6910c4805fb1ef67b4e1d23e81471fd (patch)
treea2f7b9cb37e2e06df48df9d46193386cd6f9759c /zephyr/Kconfig.tasks
parent2fae2c312151cfb33d9a243efe12570e9b69960f (diff)
downloadchrome-ec-33be9c52c6910c4805fb1ef67b4e1d23e81471fd.tar.gz
zephyr: tasks: run HOSTCMD in main thread
Add an option to run the host command loop in the main thread, taking over the entire thread and reusing its thread support code and stack. This is still optional and automatically disabled on tests as test code actually needs main() to run the test code itself. The code ensures that the main thread is switched to the correct priority for the HOSTCMD code and changes the thread name as well. BRANCH=none BUG=b:223044986 TEST=zmake testall TEST=build and run on brya Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: Ib2b3ba3d8a6fb883876ecdd432068ca3300e5344 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3593779 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'zephyr/Kconfig.tasks')
-rw-r--r--zephyr/Kconfig.tasks18
1 files changed, 18 insertions, 0 deletions
diff --git a/zephyr/Kconfig.tasks b/zephyr/Kconfig.tasks
index d1e9e17769..d329150e22 100644
--- a/zephyr/Kconfig.tasks
+++ b/zephyr/Kconfig.tasks
@@ -88,8 +88,26 @@ config HAS_TASK_HOSTCMD
if HAS_TASK_HOSTCMD
+choice TASK_HOSTCMD_THREAD_MODE
+ prompt "Host command thread selection"
+ default TASK_HOSTCMD_THREAD_DEDICATED if ZTEST
+
+config TASK_HOSTCMD_THREAD_MAIN
+ bool "Run the host command in the main thread"
+ help
+ Run the HOSTCMD task in the main thread, reusing the main thread
+ resources. Set the stack size using MAIN_STACK_SIZE.
+
+config TASK_HOSTCMD_THREAD_DEDICATED
+ bool "Run the host command in a dedicated thread"
+ help
+ Run the HOSTCMD task in a dedicated thread.
+
+endchoice
+
config TASK_HOSTCMD_STACK_SIZE
int "HOSTCMD task stack size"
+ depends on TASK_HOSTCMD_THREAD_DEDICATED
default 1024
help
The size of the host-command task stack.