From 13edff127310b51e16491891b3b0ed6c4bb93c99 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 20 May 2026 11:47:37 +0200 Subject: [PATCH 1/9] userspace: increase maximum memory domain partitions With LLEXT every loaded module will add several partitions to the userspace LL domain, which can easily results in dozens of such partitions needed for sufficiently advanced topologies. Increase it to at least 32 for now. Signed-off-by: Guennadi Liakhovetski --- app/boards/intel_adsp_ace30_ptl.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/boards/intel_adsp_ace30_ptl.conf b/app/boards/intel_adsp_ace30_ptl.conf index a79ca6e67764..20e866ade585 100644 --- a/app/boards/intel_adsp_ace30_ptl.conf +++ b/app/boards/intel_adsp_ace30_ptl.conf @@ -75,3 +75,5 @@ CONFIG_DYNAMIC_THREAD_PREFER_ALLOC=y CONFIG_SOF_STACK_SIZE=8192 CONFIG_SOF_USERSPACE_PROXY=y CONFIG_MAX_THREAD_BYTES=3 + +CONFIG_MAX_DOMAIN_PARTITIONS=32 From 196ba6ebe6bfd3d615c46c4dcb5d43097307a09a Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 20 May 2026 12:19:54 +0200 Subject: [PATCH 2/9] audio: module-adapter: add a parameter to module_adapter_new_ext() Add a parameter to explicitly provide module interface operations to module_adapter_new_ext(). This will be needed when loading modules using LLEXT in a system call. Signed-off-by: Guennadi Liakhovetski --- src/audio/module_adapter/module_adapter.c | 7 ++++--- src/include/sof/audio/module_adapter/module/generic.h | 3 ++- src/library_manager/lib_manager.c | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/audio/module_adapter/module_adapter.c b/src/audio/module_adapter/module_adapter.c index 658aa5e6e583..bebe14fe23bf 100644 --- a/src/audio/module_adapter/module_adapter.c +++ b/src/audio/module_adapter/module_adapter.c @@ -48,7 +48,7 @@ LOG_MODULE_REGISTER(module_adapter, CONFIG_SOF_LOG_LEVEL); struct comp_dev *module_adapter_new(const struct comp_driver *drv, const struct comp_ipc_config *config, const void *spec) { - return module_adapter_new_ext(drv, config, spec, NULL, NULL); + return module_adapter_new_ext(drv, config, spec, NULL, NULL, NULL); } #if CONFIG_MM_DRV @@ -207,11 +207,12 @@ static void module_adapter_mem_free(struct processing_module *mod) struct comp_dev *module_adapter_new_ext(const struct comp_driver *drv, const struct comp_ipc_config *config, const void *const_spec, void *mod_priv, - struct userspace_context *user_ctx) + struct userspace_context *user_ctx, + const struct module_interface *ops) { int ret; struct module_config *dst; - const struct module_interface *const interface = drv->adapter_ops; + const struct module_interface *const interface = ops ? : drv->adapter_ops; struct ipc_config_process spec = *((const struct ipc_config_process *) const_spec); #if CONFIG_IPC_MAJOR_4 diff --git a/src/include/sof/audio/module_adapter/module/generic.h b/src/include/sof/audio/module_adapter/module/generic.h index 91bdce96b1c7..94827d86cd9f 100644 --- a/src/include/sof/audio/module_adapter/module/generic.h +++ b/src/include/sof/audio/module_adapter/module/generic.h @@ -324,7 +324,8 @@ struct comp_dev *module_adapter_new(const struct comp_driver *drv, struct userspace_context; struct comp_dev *module_adapter_new_ext(const struct comp_driver *drv, const struct comp_ipc_config *config, const void *spec, - void *mod_priv, struct userspace_context *user_ctx); + void *mod_priv, struct userspace_context *user_ctx, + const struct module_interface *ops); int module_adapter_prepare(struct comp_dev *dev); int module_adapter_params(struct comp_dev *dev, struct sof_ipc_stream_params *params); int module_adapter_copy(struct comp_dev *dev); diff --git a/src/library_manager/lib_manager.c b/src/library_manager/lib_manager.c index b81ec6bbe738..5fe1c1e5c7ab 100644 --- a/src/library_manager/lib_manager.c +++ b/src/library_manager/lib_manager.c @@ -681,7 +681,7 @@ static struct comp_dev *lib_manager_module_create(const struct comp_driver *drv, if (comp_set_adapter_ops(drv, ops) < 0) goto err; - dev = module_adapter_new_ext(drv, config, spec, adapter_priv, userspace); + dev = module_adapter_new_ext(drv, config, spec, adapter_priv, userspace, NULL); if (!dev) goto err; From 52c68ff1a83baf1686d645c6e8a89cdcc6beb1c0 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Wed, 20 May 2026 13:49:13 +0200 Subject: [PATCH 3/9] userspace: ll: don't use mod_balloc() in modules ATM mod_balloc() doesn't work in userspace, use mod_alloc() instead to route allocations to vregions. Signed-off-by: Guennadi Liakhovetski --- src/audio/drc/drc.c | 2 +- src/audio/eq_fir/eq_fir.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/audio/drc/drc.c b/src/audio/drc/drc.c index 71d93496b766..007336fb2115 100644 --- a/src/audio/drc/drc.c +++ b/src/audio/drc/drc.c @@ -76,7 +76,7 @@ int drc_init_pre_delay_buffers(struct processing_module *mod, int i; /* Allocate pre-delay (lookahead) buffers */ - state->pre_delay_buffers[0] = mod_balloc(mod, bytes_total); + state->pre_delay_buffers[0] = mod_alloc(mod, bytes_total); if (!state->pre_delay_buffers[0]) return -ENOMEM; diff --git a/src/audio/eq_fir/eq_fir.c b/src/audio/eq_fir/eq_fir.c index 793a2294c647..f08b25315616 100644 --- a/src/audio/eq_fir/eq_fir.c +++ b/src/audio/eq_fir/eq_fir.c @@ -220,7 +220,7 @@ static int eq_fir_setup(struct processing_module *mod, int nch) return 0; /* Allocate all FIR channels data in a big chunk and clear it */ - cd->fir_delay = mod_balloc(mod, delay_size); + cd->fir_delay = mod_alloc(mod, delay_size); if (!cd->fir_delay) { comp_err(dev, "delay allocation failed for size %d", delay_size); return -ENOMEM; From 9692b067c3ea9e26d90a67b327b4436776a61951 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Thu, 21 May 2026 13:52:20 +0200 Subject: [PATCH 4/9] audio: component: disable legacy code Trace context isn't used under Zephyr, keep it only for non-Zephyr builds. Signed-off-by: Guennadi Liakhovetski --- src/include/sof/audio/component.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/include/sof/audio/component.h b/src/include/sof/audio/component.h index 7fc9feb53736..d391331eeccc 100644 --- a/src/include/sof/audio/component.h +++ b/src/include/sof/audio/component.h @@ -878,8 +878,10 @@ static inline void comp_init(const struct comp_driver *drv, #ifdef CONFIG_SOF_USERSPACE_LL sys_mutex_init(&dev->list_mutex); #endif +#ifndef __ZEPHYR__ memcpy_s(&dev->tctx, sizeof(dev->tctx), trace_comp_drv_get_tr_ctx(dev->drv), sizeof(struct tr_ctx)); +#endif } /** From 9a239d91cb9d4b488263129702c051fa12286eac Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Thu, 21 May 2026 16:53:42 +0200 Subject: [PATCH 5/9] audio: module-adapter: (cosmetic) fix a log string Remove a wrong function name from a log entry. Signed-off-by: Guennadi Liakhovetski --- src/audio/module_adapter/module_adapter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio/module_adapter/module_adapter.c b/src/audio/module_adapter/module_adapter.c index bebe14fe23bf..01126446860b 100644 --- a/src/audio/module_adapter/module_adapter.c +++ b/src/audio/module_adapter/module_adapter.c @@ -399,7 +399,7 @@ int module_adapter_prepare(struct comp_dev *dev) ret = module_adapter_params(dev, ¶ms); if (ret) { - comp_err(dev, "module_adapter_new() %d: module params failed", ret); + comp_err(dev, "module params failed: %d", ret); return ret; } } From fe103925cd93c740be660c67d81c5e4809b7f9fb Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Thu, 21 May 2026 16:58:14 +0200 Subject: [PATCH 6/9] ipc: remove irrelevant boot- / ztest headers handler-kernel.c doesn't contain any testing-relevant code, remove unneeded headers. Signed-off-by: Guennadi Liakhovetski --- src/ipc/ipc4/handler-kernel.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/ipc/ipc4/handler-kernel.c b/src/ipc/ipc4/handler-kernel.c index ae75ebc87303..d7d9f417806a 100644 --- a/src/ipc/ipc4/handler-kernel.c +++ b/src/ipc/ipc4/handler-kernel.c @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -41,11 +40,6 @@ #include #include -#if CONFIG_SOF_BOOT_TEST -/* CONFIG_SOF_BOOT_TEST depends on Zephyr */ -#include -#endif - #include #include #include From 421f745de46354ba1d55f807e95d6f0612547655 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Fri, 22 May 2026 15:43:06 +0200 Subject: [PATCH 7/9] schedule: dp: fix a compiler warning Move variable declarations above the first goto to avoid uninitialized variables. Signed-off-by: Guennadi Liakhovetski --- src/schedule/zephyr_dp_schedule_application.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/schedule/zephyr_dp_schedule_application.c b/src/schedule/zephyr_dp_schedule_application.c index 06f2d7b46b12..918f13188671 100644 --- a/src/schedule/zephyr_dp_schedule_application.c +++ b/src/schedule/zephyr_dp_schedule_application.c @@ -494,6 +494,11 @@ int scheduler_dp_task_init(struct task **task, const struct sof_uuid_entry *uid, stack_size, dp_thread_fn, ptask, NULL, NULL, CONFIG_DP_THREAD_PRIORITY, ptask->flags, K_FOREVER); + unsigned int pidx; + size_t size; + uintptr_t start; + bool on_pool = false; + #ifdef CONFIG_SCHED_CPU_MASK /* pin the thread to specific core */ ret = k_thread_cpu_pin(pdata->thread_id, core); @@ -506,10 +511,6 @@ int scheduler_dp_task_init(struct task **task, const struct sof_uuid_entry *uid, k_thread_access_grant(pdata->thread_id, pdata->event, &dp_sync[core]); scheduler_dp_grant(pdata->thread_id, core); - unsigned int pidx; - size_t size; - uintptr_t start; - bool on_pool = false; struct k_mem_domain *mdom = objpool_alloc(&dp_mdom_head, sizeof(*mdom), SOF_MEM_FLAG_COHERENT); From f4abb1065618745176a9a52876abdc32d7d3914b Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Fri, 22 May 2026 15:58:21 +0200 Subject: [PATCH 8/9] debug: disable cold store execution debugging with userspace LL Userspace LL is currently incompatible with cold store execution debugging, force disable it. Signed-off-by: Guennadi Liakhovetski --- Kconfig.sof | 1 + 1 file changed, 1 insertion(+) diff --git a/Kconfig.sof b/Kconfig.sof index 29c6f549fca8..df63811e652b 100644 --- a/Kconfig.sof +++ b/Kconfig.sof @@ -33,6 +33,7 @@ config COLD_STORE_EXECUTE_DRAM config COLD_STORE_EXECUTE_DEBUG bool "Enable checks for cold code on hot paths" + depends on !SOF_USERSPACE_LL help This enables an assert_can_be_cold() check, which causes an exception if called in the LL task context and assert() evaluation is enabled. From 11588580dbd6a58a212a50779faf16e1486f068e Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Fri, 22 May 2026 16:10:24 +0200 Subject: [PATCH 9/9] test: disable VMH test when userspace LL is enabled The VMH test shouldn't be used at all when VMH is enabled and used. It uses the same memory region as the SOF VMH thereby potentially corrupting it. It just happens to work without userspace LL supposedly because then the first VMH allocation only happens after all the tests have run. With userspace LL this no longer holds, so the VMH test must be disabled. Signed-off-by: Guennadi Liakhovetski --- zephyr/test/CMakeLists.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/zephyr/test/CMakeLists.txt b/zephyr/test/CMakeLists.txt index f548c98c5e73..6edf90ec840a 100644 --- a/zephyr/test/CMakeLists.txt +++ b/zephyr/test/CMakeLists.txt @@ -1,7 +1,10 @@ if(CONFIG_SOF_BOOT_TEST) - zephyr_library_sources_ifdef(CONFIG_VIRTUAL_HEAP - vmh.c - ) + if(NOT CONFIG_SOF_USERSPACE_LL) + zephyr_library_sources_ifdef(CONFIG_VIRTUAL_HEAP + vmh.c + ) + endif() + zephyr_library_sources_ifdef(CONFIG_SOF_VREGIONS vpage.c vregion.c )