From e0ddc0bbff8c320ff1ff22b5f0b585dd09aeacb3 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Wed, 20 May 2026 18:12:09 +0300 Subject: [PATCH 1/8] zephyr: rtos: userspace_helper.h: add SYSUSER macros for non-user builds Commit b76dd88415026 ("zephyr: rtos: userspace_helper.h: add sysuser memory partition") added macros APP_SYSUSER_BSS and APP_SYSUSER_DATA, but did not define them for the case if CONFIG_USERSPACE is not defined. Add definitions that handle this case as well. Signed-off-by: Kai Vehmanen --- zephyr/include/rtos/userspace_helper.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zephyr/include/rtos/userspace_helper.h b/zephyr/include/rtos/userspace_helper.h index 7d8f7919d865..5215f48529ce 100644 --- a/zephyr/include/rtos/userspace_helper.h +++ b/zephyr/include/rtos/userspace_helper.h @@ -17,6 +17,8 @@ #ifndef CONFIG_USERSPACE #define APP_TASK_BSS #define APP_TASK_DATA +#define APP_SYSUSER_BSS +#define APP_SYSUSER_DATA #else #include #include From 57a3f6b6da830a9685fe8081f8de0fbbd3bbd416 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Wed, 20 May 2026 19:00:42 +0300 Subject: [PATCH 2/8] posix: rtos: userspace_helper.h: add SYSUSER macros Commit b76dd88415026 ("zephyr: rtos: userspace_helper.h: add sysuser memory partition") added macros APP_SYSUSER_BSS and APP_SYSUSER_DATA, but did not add them for posix headers. Signed-off-by: Kai Vehmanen --- posix/include/rtos/userspace_helper.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/posix/include/rtos/userspace_helper.h b/posix/include/rtos/userspace_helper.h index 09a52b7804d5..bb5d7670e9a1 100644 --- a/posix/include/rtos/userspace_helper.h +++ b/posix/include/rtos/userspace_helper.h @@ -19,6 +19,8 @@ #define APP_TASK_BSS #define APP_TASK_DATA +#define APP_SYSUSER_BSS +#define APP_SYSUSER_DATA struct sys_heap; From 114695339728219facb749b3154656b219406dd1 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Fri, 13 Feb 2026 18:54:45 +0200 Subject: [PATCH 3/8] zephyr: lib: dma: make DMA platform data available to user-space The platform data descriptions need to be accessible to all system threads. These are e.g. used when setting up host/DAI copiers and they need platform DMA properties. Signed-off-by: Kai Vehmanen --- zephyr/lib/dma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zephyr/lib/dma.c b/zephyr/lib/dma.c index 380c31d48843..6a273336162f 100644 --- a/zephyr/lib/dma.c +++ b/zephyr/lib/dma.c @@ -15,12 +15,13 @@ #include #include #include +#include #include #define DW_DMA_BUFFER_PERIOD_COUNT 0x4 #define HDA_DMA_BUFFER_PERIOD_COUNT 4 -SHARED_DATA struct sof_dma dma[] = { +APP_SYSUSER_DATA SHARED_DATA struct sof_dma dma[] = { #if DT_NODE_HAS_STATUS(DT_NODELABEL(lpgpdma0), okay) { /* Low Power GP DMAC 0 */ .plat_data = { From 1abac6aa874d7612fa6e01affc68334ee6861a79 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Thu, 26 Feb 2026 17:11:56 +0200 Subject: [PATCH 4/8] audio: copier: export copier endpoint ops to user-space Allow the copier endpoint interface ops to be used also from user-space system threads. Signed-off-by: Kai Vehmanen --- src/audio/copier/copier.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/audio/copier/copier.c b/src/audio/copier/copier.c index d2aefcb13be6..93e018408bf3 100644 --- a/src/audio/copier/copier.c +++ b/src/audio/copier/copier.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -1189,7 +1190,7 @@ __cold static int copier_unbind(struct processing_module *mod, struct bind_info return 0; } -static struct module_endpoint_ops copier_endpoint_ops = { +static APP_SYSUSER_DATA const struct module_endpoint_ops copier_endpoint_ops = { .get_total_data_processed = copier_get_processed_data, .position = copier_position, .dai_ts_config = copier_dai_ts_config_op, @@ -1200,7 +1201,7 @@ static struct module_endpoint_ops copier_endpoint_ops = { .trigger = copier_comp_trigger }; -static const struct module_interface copier_interface = { +static APP_SYSUSER_DATA const struct module_interface copier_interface = { .init = copier_init, .prepare = copier_prepare, .process_audio_stream = copier_process, From 8a9b82b2878b93265324c5f2d60e986a4c3f63df Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Tue, 31 Mar 2026 14:29:13 +0300 Subject: [PATCH 5/8] audio: copier_host: make FPI sync group available to user-space The FPI sync functionality relies on static global objects. Make these available to the SOF application even when it is run in user-space. Signed-off-by: Kai Vehmanen --- src/audio/copier/copier_host.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/audio/copier/copier_host.c b/src/audio/copier/copier_host.c index fe17a49328b9..3e704b2b1163 100644 --- a/src/audio/copier/copier_host.c +++ b/src/audio/copier/copier_host.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "copier.h" #include "host_copier.h" @@ -27,7 +28,7 @@ struct fpi_sync_group { struct list_item item; }; -static struct list_item group_list_head = LIST_INIT(group_list_head); +static APP_SYSUSER_DATA struct list_item group_list_head = LIST_INIT(group_list_head); __cold static struct fpi_sync_group *find_group_by_id(uint32_t id) { From 98dda6fffeba6a9aab03232700e1bd10bcb55c57 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Thu, 26 Feb 2026 17:59:32 +0200 Subject: [PATCH 6/8] zephyr: schedule: allow user-space to access scheduler list Make the scheduler list available to system user-space threads. Signed-off-by: Kai Vehmanen --- zephyr/schedule.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zephyr/schedule.c b/zephyr/schedule.c index 75155b5d4913..1e3971a33682 100644 --- a/zephyr/schedule.c +++ b/zephyr/schedule.c @@ -10,10 +10,11 @@ #include #include #include +#include #include #include -static struct schedulers *_schedulers[CONFIG_CORE_COUNT]; +static APP_SYSUSER_BSS struct schedulers *_schedulers[CONFIG_CORE_COUNT]; /** * Retrieves registered schedulers. From 52b914eabfab1035c66becbb54c955e318bb04c5 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Tue, 24 Mar 2026 18:16:12 +0200 Subject: [PATCH 7/8] audio: place component driver list in user-space accessible partition Annotate the static comp_driver_list with APP_SYSUSER_BSS so that it is placed in the sysuser memory partition. This makes the component driver registry accessible from user-space threads when CONFIG_SOF_USERSPACE_LL is enabled. Signed-off-by: Kai Vehmanen --- src/audio/component.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio/component.c b/src/audio/component.c index 941be20f8534..da597023cf73 100644 --- a/src/audio/component.c +++ b/src/audio/component.c @@ -36,7 +36,7 @@ LOG_MODULE_REGISTER(component, CONFIG_SOF_LOG_LEVEL); -static SHARED_DATA struct comp_driver_list cd; +static APP_SYSUSER_BSS SHARED_DATA struct comp_driver_list cd; SOF_DEFINE_REG_UUID(component); From 4bc053c71b0d0497d1497f2948bf19a1b40d2daa Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Wed, 15 Apr 2026 15:55:44 +0300 Subject: [PATCH 8/8] ipc4: make fw_reg mutex available to user-space Mark the fw_reg mutex with APP_SYSUSER_BSS, allowing the lock to be used when DAI module is run in user-space. Signed-off-by: Kai Vehmanen --- src/ipc/ipc4/dai.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ipc/ipc4/dai.c b/src/ipc/ipc4/dai.c index 9724e7578c99..bc8b0043528a 100644 --- a/src/ipc/ipc4/dai.c +++ b/src/ipc/ipc4/dai.c @@ -34,8 +34,7 @@ LOG_MODULE_DECLARE(ipc, CONFIG_SOF_LOG_LEVEL); -/* Protects IPC4 LLP reading-slot firmware registers used by DAI code. */ -static SYS_MUTEX_DEFINE(llp_reading_slots_lock); +static APP_SYSUSER_BSS SYS_MUTEX_DEFINE(llp_reading_slots_lock); void dai_set_link_hda_config(uint16_t *link_config, struct ipc_config_dai *common_config,