Repository navigation
Phase 3 (part 1): split the mixed IPC files, kernel halves to src/kernel/ipc - #11422
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
The supplied hunks omit the three IPC implementation splits, so unchanged userspace and multicore behavior cannot be verified without before/after diffs or maintainer-confirmed comparison artifacts.
No open issues 🎉
What changed in this PR
This PR advances SOF’s kernel/user-space partition by separating kernel IPC operations from user-side processing. It builds on the architecture/platform relocation and DMA trace removal in #11420 and #11421, with no intended functional change in the IPC split.
Changes:
- Integrates the kernel halves of three mixed IPC files and exposes shared helpers through existing headers.
- Updates unit-test builds, host tools, configuration paths, and documentation for the new layout.
- Includes the stacked platform/architecture moves and legacy DMA trace cleanup.
| File | Description |
|---|---|
| zephyr/include/sof/trace/trace.h | Removes obsolete DMA trace commentary. |
| zephyr/include/sof/trace/preproc.h | Removes obsolete trace configuration guard. |
| zephyr/include/rtos/sof.h | Removes DMA trace context fields. |
| tools/tplg_parser/CMakeLists.txt | Updates relocated include paths. |
| tools/testbench/README.md | Updates documented configuration path. |
| tools/testbench/CMakeLists.txt | Updates configuration and include paths. |
| test/ztest/unit/objpool/CMakeLists.txt | Updates platform include path. |
| test/ztest/unit/math/matrix/CMakeLists.txt | Updates platform include path. |
| test/ztest/unit/math/fft/CMakeLists.txt | Adds kernel IPC half; updates includes. |
| test/ztest/unit/math/fft_multi/CMakeLists.txt | Updates platform include path. |
| test/ztest/unit/math/dct/CMakeLists.txt | Updates platform include path. |
| test/ztest/unit/math/auditory/CMakeLists.txt | Updates platform include path. |
| test/ztest/unit/math/advanced/functions/CMakeLists.txt | Updates platform include path. |
| test/ztest/unit/fast-get/CMakeLists.txt | Updates platform include path. |
| test/ztest/unit/dsrc/CMakeLists.txt | Updates platform include path. |
| test/ztest/unit/audio/drc/CMakeLists.txt | Adds kernel IPC half; updates includes. |
| test/ztest/unit/audio/crossover/CMakeLists.txt | Updates platform include path. |
| test/cmocka/src/math/fft/CMakeLists.txt | Adds kernel IPC half. |
| test/cmocka/src/lib/fast-get/CMakeLists.txt | Updates memory source path. |
| test/cmocka/src/lib/alloc/CMakeLists.txt | Updates platform source and include paths. |
| test/cmocka/src/common_mocks.c | Removes obsolete trace mocks. |
| test/cmocka/src/audio/volume/CMakeLists.txt | Adds kernel IPC half. |
| test/cmocka/src/audio/selector/CMakeLists.txt | Adds kernel IPC half. |
| test/cmocka/src/audio/pipeline/CMakeLists.txt | Adds kernel IPC half to pipeline tests. |
| test/cmocka/src/audio/pcm_converter/CMakeLists.txt | Adds kernel IPC half. |
| test/cmocka/src/audio/mixer/CMakeLists.txt | Adds kernel IPC half. |
| test/cmocka/src/audio/eq_iir/CMakeLists.txt | Adds kernel IPC half. |
| test/cmocka/src/audio/eq_fir/CMakeLists.txt | Adds kernel IPC half. |
| test/cmocka/src/audio/dcblock/CMakeLists.txt | Adds kernel IPC half. |
| test/cmocka/src/audio/component/CMakeLists.txt | Adds kernel IPC half. |
| test/cmocka/src/audio/buffer/CMakeLists.txt | Adds kernel IPC half to buffer tests. |
| test/cmocka/configs/rembrandt_defconfig | Removes trace channel setting. |
| test/cmocka/configs/acp_7_x_defconfig | Removes trace channel setting. |
| test/cmocka/configs/acp_7_0_defconfig | Removes trace channel setting. |
| test/cmocka/CMakeLists.txt | Updates Intel platform include paths. |
| src/trace/CMakeLists.txt | Removes DMA trace build rules. |
| src/kernel/platform/tigerlake/include/platform/trace/trace.h | Relocates trace header under kernel. |
| src/kernel/platform/tigerlake/include/platform/platform.h | Relocates platform definitions. |
| src/kernel/platform/tigerlake/include/platform/lib/memory.h | Removes conditional trace memory allocation. |
| src/kernel/platform/tigerlake/include/platform/lib/mailbox.h | Relocates mailbox header. |
| src/kernel/platform/README.md | Updates directory name and documentation link. |
| src/kernel/platform/qemu_xtensa/platform.c | Relocates platform stubs. |
| src/kernel/platform/qemu_xtensa/include/platform/trace/trace.h | Relocates trace stub header. |
| src/kernel/platform/qemu_xtensa/include/platform/platform.h | Relocates platform definitions. |
| src/kernel/platform/qemu_xtensa/include/platform/lib/memory.h | Relocates memory definitions. |
| src/kernel/platform/qemu_xtensa/include/platform/lib/mailbox.h | Relocates mailbox definitions and stubs. |
| src/kernel/platform/qemu_xtensa/include/platform/lib/dma.h | Relocates DMA stub header. |
| src/kernel/platform/qemu_xtensa/include/platform/lib/dai.h | Relocates DAI stub header. |
| src/kernel/platform/qemu_xtensa/include/platform/lib/clk.h | Relocates clock definitions. |
| src/kernel/platform/posix/include/platform/trace/trace.h | Relocates trace stub header. |
| src/kernel/platform/posix/include/platform/platform.h | Relocates platform definitions. |
| src/kernel/platform/posix/include/platform/lib/pm_runtime.h | Relocates power-management stubs. |
| src/kernel/platform/posix/include/platform/lib/memory.h | Relocates mailbox memory definitions. |
| src/kernel/platform/posix/include/platform/lib/mailbox.h | Relocates mailbox stubs. |
| src/kernel/platform/posix/include/platform/lib/dma.h | Relocates DMA definitions. |
| src/kernel/platform/posix/include/platform/lib/dai.h | Relocates DAI definitions. |
| src/kernel/platform/posix/include/platform/lib/cpu.h | Relocates CPU declarations. |
| src/kernel/platform/posix/include/platform/lib/clk.h | Relocates clock definitions. |
| src/kernel/platform/posix/include/platform/fuzz.h | Relocates fuzz interface declarations. |
| src/kernel/platform/posix/include/platform/drivers/interrupt.h | Relocates interrupt definitions. |
| src/kernel/platform/posix/include/platform/drivers/idc.h | Relocates inter-core messaging stub. |
| src/kernel/platform/novalake/lib/clk.c | Relocates clock table. |
| src/kernel/platform/novalake/include/platform/trace/trace.h | Relocates trace stub header. |
| src/kernel/platform/novalake/include/platform/platform.h | Relocates platform definitions. |
| src/kernel/platform/novalake/include/platform/lib/mailbox.h | Relocates mailbox header. |
| src/kernel/platform/novalake/include/platform/lib/clk.h | Relocates clock definitions. |
| src/kernel/platform/mtk/tools/README.txt | Relocates AFE generator documentation. |
| src/kernel/platform/mtk/tools/build.sh | Updates source and include paths. |
| src/kernel/platform/mtk/include/platform/trace/trace.h | Relocates trace placeholder header. |
| src/kernel/platform/mtk/include/platform/platform.h | Relocates platform definitions. |
| src/kernel/platform/mtk/include/platform/lib/pm_runtime.h | Relocates power-management stubs. |
| src/kernel/platform/mtk/include/platform/lib/mailbox.h | Relocates mailbox definitions. |
| src/kernel/platform/mtk/include/platform/lib/dma.h | Relocates DMA definitions. |
| src/kernel/platform/mtk/include/platform/lib/dai.h | Relocates DAI placeholder header. |
| src/kernel/platform/mtk/include/platform/lib/cpu.h | Relocates CPU definitions. |
| src/kernel/platform/mtk/include/platform/lib/clk.h | Relocates clock definitions. |
| src/kernel/platform/meteorlake/lib/clk.c | Relocates clock table. |
| src/kernel/platform/meteorlake/include/platform/trace/trace.h | Relocates trace stub header. |
| src/kernel/platform/meteorlake/include/platform/platform.h | Relocates platform definitions. |
| src/kernel/platform/meteorlake/include/platform/lib/mailbox.h | Relocates mailbox header. |
| src/kernel/platform/meteorlake/include/platform/lib/clk.h | Relocates clock definitions. |
| src/kernel/platform/lunarlake/lib/clk.c | Relocates clock table. |
| src/kernel/platform/lunarlake/include/platform/trace/trace.h | Relocates trace stub header. |
| src/kernel/platform/lunarlake/include/platform/platform.h | Relocates platform definitions. |
| src/kernel/platform/lunarlake/include/platform/lib/mailbox.h | Relocates mailbox header. |
| src/kernel/platform/lunarlake/include/platform/lib/clk.h | Relocates clock definitions. |
| src/kernel/platform/library/schedule/CMakeLists.txt | Relocates host scheduler build rules. |
| src/kernel/platform/library/platform.c | Relocates host platform initialization. |
| src/kernel/platform/library/panic.c | Relocates host panic implementation. |
| src/kernel/platform/library/lib/trace.c | Removes DMA trace header dependency. |
| src/kernel/platform/library/lib/pm_runtime.c | Relocates power-management stubs. |
| src/kernel/platform/library/lib/dai.c | Relocates host DAI initialization. |
| src/kernel/platform/library/lib/CMakeLists.txt | Builds host tracing unconditionally. |
| src/kernel/platform/library/lib/clk.c | Relocates clock conversion stubs. |
| src/kernel/platform/library/lib/alloc.c | Relocates host allocation wrappers. |
| src/kernel/platform/library/init.c | Relocates host firmware context. |
| src/kernel/platform/library/include/platform/lib/ll_schedule.h | Relocates host scheduler declarations. |
| src/kernel/platform/library/include/platform/lib/dma.h | Relocates DMA definitions. |
| src/kernel/platform/library/include/platform/lib/dai.h | Relocates DAI definitions. |
| src/kernel/platform/library/include/platform/lib/cpu.h | Relocates CPU definitions. |
| src/kernel/platform/library/include/platform/lib/clk.h | Relocates clock definitions. |
| src/kernel/platform/library/include/platform/drivers/pmc.h | Relocates power-controller declarations. |
| src/kernel/platform/library/include/platform/drivers/idc.h | Relocates inter-core messaging stubs. |
| src/kernel/platform/library/CMakeLists.txt | Relocates host platform build rules. |
| src/kernel/platform/intel/cavs/include/cavs/version.h | Relocates hardware version definitions. |
| src/kernel/platform/intel/cavs/include/cavs/trace/trace.h | Relocates platform trace implementation. |
| src/kernel/platform/intel/cavs/include/cavs/mem_window.h | Relocates memory-window declarations. |
| src/kernel/platform/intel/cavs/include/cavs/lib/power_down.h | Relocates power-down declarations. |
| src/kernel/platform/intel/cavs/include/cavs/ext_manifest.h | Relocates manifest definitions. |
| src/kernel/platform/intel/cavs/include/cavs/drivers/timestamp.h | Relocates timestamp register definitions. |
| src/kernel/platform/intel/cavs/include/cavs/drivers/sideband-ipc.h | Relocates IPC register definitions. |
| src/kernel/platform/intel/cavs/include/cavs/drivers/mn.h | Relocates clock-divider definitions. |
| src/kernel/platform/intel/ace/include/auth/intel_status_logger_api.h | Relocates status logger wrappers. |
| src/kernel/platform/intel/ace/include/ace/version.h | Relocates hardware version definitions. |
| src/kernel/platform/intel/ace/include/ace/lib/memory.h | Relocates memory header. |
| src/kernel/platform/intel/ace/include/ace/lib/clk.h | Relocates shared clock declarations. |
| src/kernel/platform/imx95/linker/data-sections.ld | Relocates firmware metadata linker section. |
| src/kernel/platform/imx95/lib/clk.c | Relocates clock initialization. |
| src/kernel/platform/imx95/include/platform/trace/trace.h | Relocates trace placeholder header. |
| src/kernel/platform/imx95/include/platform/platform.h | Relocates platform definitions. |
| src/kernel/platform/imx95/include/platform/lib/memory.h | Relocates memory definitions. |
| src/kernel/platform/imx95/include/platform/lib/mailbox.h | Relocates mailbox layout. |
| src/kernel/platform/imx95/include/platform/lib/dma.h | Relocates DMA placeholder header. |
| src/kernel/platform/imx95/include/platform/lib/clk.h | Relocates clock declarations. |
| src/kernel/platform/imx93_a55/lib/clk.c | Relocates clock initialization. |
| src/kernel/platform/imx93_a55/include/platform/trace/trace.h | Relocates trace placeholder header. |
| src/kernel/platform/imx93_a55/include/platform/platform.h | Relocates platform definitions. |
| src/kernel/platform/imx93_a55/include/platform/lib/memory.h | Relocates memory definitions. |
| src/kernel/platform/imx93_a55/include/platform/lib/dma.h | Relocates DMA definitions. |
| src/kernel/platform/imx93_a55/include/platform/lib/dai.h | Relocates DAI placeholder header. |
| src/kernel/platform/imx93_a55/include/platform/lib/clk.h | Relocates clock declarations. |
| src/kernel/platform/imx93_a55/include/platform/drivers/idc.h | Relocates inter-core messaging stub. |
| src/kernel/platform/imx8ulp/platform.c | Removes DMA trace initialization. |
| src/kernel/platform/imx8ulp/lib/clk.c | Relocates clock initialization. |
| src/kernel/platform/imx8ulp/include/platform/trace/trace.h | Relocates trace stub header. |
| src/kernel/platform/imx8ulp/include/platform/lib/dma.h | Relocates DMA definitions. |
| src/kernel/platform/imx8ulp/include/platform/lib/dai.h | Relocates DAI placeholder header. |
| src/kernel/platform/imx8ulp/include/platform/lib/cpu.h | Relocates CPU definitions. |
| src/kernel/platform/imx8ulp/include/platform/lib/clk.h | Relocates clock declarations. |
| src/kernel/platform/imx8ulp/include/platform/drivers/interrupt.h | Relocates interrupt definitions. |
| src/kernel/platform/imx8ulp/include/platform/drivers/idc.h | Relocates inter-core messaging stubs. |
| src/kernel/platform/imx8ulp/include/arch/xtensa/config/defs.h | Relocates Xtensa compatibility header. |
| src/kernel/platform/imx8m/platform.c | Removes DMA trace initialization. |
| src/kernel/platform/imx8m/lib/clk.c | Relocates clock initialization. |
| src/kernel/platform/imx8m/include/platform/trace/trace.h | Relocates trace stub header. |
| src/kernel/platform/imx8m/include/platform/lib/pm_runtime.h | Relocates power-management stubs. |
| src/kernel/platform/imx8m/include/platform/lib/dma.h | Relocates DMA definitions. |
| src/kernel/platform/imx8m/include/platform/lib/dai.h | Relocates DAI placeholder header. |
| src/kernel/platform/imx8m/include/platform/lib/cpu.h | Relocates CPU definitions. |
| src/kernel/platform/imx8m/include/platform/lib/clk.h | Relocates clock declarations. |
| src/kernel/platform/imx8m/include/platform/drivers/idc.h | Relocates inter-core messaging stubs. |
| src/kernel/platform/imx8m/include/arch/xtensa/config/defs.h | Relocates Xtensa compatibility header. |
| src/kernel/platform/imx8m_cm7/linker/data-sections.ld | Relocates firmware metadata linker section. |
| src/kernel/platform/imx8m_cm7/lib/clk.c | Relocates clock initialization. |
| src/kernel/platform/imx8m_cm7/include/platform/trace/trace.h | Relocates trace placeholder header. |
| src/kernel/platform/imx8m_cm7/include/platform/platform.h | Relocates platform definitions. |
| src/kernel/platform/imx8m_cm7/include/platform/lib/memory.h | Relocates memory definitions. |
| src/kernel/platform/imx8m_cm7/include/platform/lib/mailbox.h | Relocates mailbox layout. |
| src/kernel/platform/imx8m_cm7/include/platform/lib/dma.h | Relocates DMA placeholder header. |
| src/kernel/platform/imx8m_cm7/include/platform/lib/clk.h | Relocates clock declarations. |
| src/kernel/platform/imx8/lib/clk.c | Relocates clock initialization. |
| src/kernel/platform/imx8/include/platform/trace/trace.h | Relocates trace stub header. |
| src/kernel/platform/imx8/include/platform/lib/dma.h | Relocates DMA definitions. |
| src/kernel/platform/imx8/include/platform/lib/dai.h | Relocates DAI placeholder header. |
| src/kernel/platform/imx8/include/platform/lib/cpu.h | Relocates CPU definitions. |
| src/kernel/platform/imx8/include/platform/lib/clk.h | Relocates clock declarations. |
| src/kernel/platform/imx8/include/platform/drivers/idc.h | Relocates inter-core messaging stubs. |
| src/kernel/platform/imx8/include/arch/xtensa/config/defs.h | Relocates Xtensa compatibility header. |
| src/kernel/platform/CMakeLists.txt | Relocates platform build entry point. |
| src/kernel/platform/amd/rembrandt/platform.c | Removes DMA trace initialization. |
| src/kernel/platform/amd/rembrandt/include/arch/xtensa/config/defs.h | Relocates Xtensa compatibility header. |
| src/kernel/platform/amd/common/include/platform/trace/trace.h | Relocates trace stub header. |
| src/kernel/platform/amd/common/include/platform/lib/pm_runtime.h | Relocates power-management stubs. |
| src/kernel/platform/amd/common/include/platform/lib/mailbox.h | Relocates mailbox definitions. |
| src/kernel/platform/amd/common/include/platform/lib/dma.h | Relocates DMA definitions. |
| src/kernel/platform/amd/common/include/platform/lib/cpu.h | Relocates CPU definitions. |
| src/kernel/platform/amd/common/include/platform/lib/clk.h | Relocates clock declarations. |
| src/kernel/platform/amd/common/include/platform/ipc.h | Relocates IPC declarations. |
| src/kernel/platform/amd/common/include/platform/drivers/idc.h | Relocates inter-core messaging stubs. |
| src/kernel/platform/amd/common/include/platform/acp_sp_dma.h | Relocates serial-port DMA declarations. |
| src/kernel/platform/amd/common/include/platform/acp_dmic_dma.h | Relocates microphone DMA declarations. |
| src/kernel/platform/amd/common/include/platform/acp_dma.h | Relocates DMA structures and declarations. |
| src/kernel/platform/amd/acp_7_x/platform.c | Removes DMA trace include. |
| src/kernel/platform/amd/acp_7_0/platform.c | Removes DMA trace include. |
| src/kernel/platform/amd/acp_7_0/include/arch/xtensa/config/defs.h | Relocates Xtensa compatibility header. |
| src/kernel/platform/ace30/lib/clk.c | Relocates clock table. |
| src/kernel/platform/ace30/include/platform/trace/trace.h | Relocates trace stub header. |
| src/kernel/platform/ace30/include/platform/platform.h | Relocates platform definitions. |
| src/kernel/platform/ace30/include/platform/lib/mailbox.h | Relocates mailbox header. |
| src/kernel/platform/ace30/include/platform/lib/clk.h | Relocates clock definitions. |
| src/kernel/logging/Kconfig | Houses probe logging configuration. |
| src/kernel/Kconfig | Includes relocated logging configuration. |
| src/kernel/ipc/ipc4/CMakeLists.txt | Builds IPC4 kernel halves. |
| src/kernel/ipc/ipc3/helper.c | Removes DMA trace message helpers. |
| src/kernel/ipc/CMakeLists.txt | Builds common IPC kernel half. |
| src/kernel/init/README.md | Removes DMA trace initialization description. |
| src/kernel/init/init.c | Removes DMA trace initialization. |
| src/kernel/CMakeLists.txt | Adds host architecture and platform builds. |
| src/kernel/arch/xtensa/Kconfig | Relocates Xtensa configuration. |
| src/kernel/arch/README.md | Updates directory name and documentation link. |
| src/kernel/arch/Kconfig | Relocates architecture configuration entry point. |
| src/kernel/arch/host/lib/notifier.c | Relocates host notifier context. |
| src/kernel/arch/host/lib/CMakeLists.txt | Relocates host notifier build rule. |
| src/kernel/arch/host/lib/ams.c | Relocates host messaging context. |
| src/kernel/arch/host/include/arch/sof.h | Relocates architecture placeholder header. |
| src/kernel/arch/host/include/arch/schedule/task.h | Relocates task placeholder header. |
| src/kernel/arch/host/include/arch/lib/wait.h | Relocates wait stubs. |
| src/kernel/arch/host/include/arch/lib/cpu.h | Relocates CPU stubs. |
| src/kernel/arch/host/include/arch/lib/cache.h | Relocates cache stubs. |
| src/kernel/arch/host/include/arch/drivers/timer.h | Relocates timer stubs. |
| src/kernel/arch/host/include/arch/drivers/interrupt.h | Relocates interrupt stubs. |
| src/kernel/arch/host/include/arch/drivers/idc.h | Relocates messaging placeholder header. |
| src/kernel/arch/host/include/arch/debug/panic.h | Relocates register-dump stub. |
| src/kernel/arch/host/include/arch/debug/backtrace.h | Relocates host backtrace implementation. |
| src/kernel/arch/host/include/arch/compiler_info.h | Relocates compiler metadata definitions. |
| src/kernel/arch/host/configs/library_defconfig | Removes verbose DMA trace setting. |
| src/kernel/arch/host/CMakeLists.txt | Updates host include paths. |
| src/kernel/arch/CMakeLists.txt | Relocates architecture build entry point. |
| src/Kconfig | Updates kernel paths; removes trace configuration. |
| src/ipc/README.md | Updates documented platform location. |
| src/ipc/ipc4/README.md | Documents kernel-side message routers. |
| src/ipc/CMakeLists.txt | Removes DMA trace copy build rules. |
| src/include/sof/userspace/README.md | Updates kernel directory taxonomy. |
| src/include/sof/ipc/topology.h | Declares helpers shared across IPC halves. |
| src/include/sof/ipc/msg.h | Removes DMA trace helper declarations. |
| src/include/sof/ipc/common.h | Exposes user-thread entry and event bits. |
| src/include/sof/debug/debug.h | Removes legacy trace hex-dump macro. |
| src/debug/panic.c | Removes DMA trace flushing. |
| src/CMakeLists.txt | Delegates relocated builds; removes trace build. |
| src/audio/README.md | Updates documented kernel platform path. |
| src/audio/module_adapter/module/waves/waves.c | Removes legacy verbose trace dumps. |
| src/audio/Kconfig | Removes trace channel configuration. |
| scripts/rebuild-testbench.sh | Updates configuration path in help text. |
| scripts/kernel_user_partition.txt | Updates platform classification; removes trace header. |
| scripts/cmake/kconfig.cmake | Updates configuration search paths. |
| scripts/cmake/defconfigs.cmake | Updates defconfig discovery path. |
| posix/include/rtos/sof.h | Removes DMA trace context fields. |
| doc/sof.doxygen.in | Removes obsolete trace definition. |
| CODEOWNERS | Updates platform ownership paths. |
| CMakeLists.txt | Updates unit-test architecture path. |
| app/prj.conf | Removes obsolete trace setting. |
| app/CMakeLists.txt | Updates Xtensa include path. |
| app/boards/intel_adsp_ace40_nvls.conf | Removes obsolete trace setting. |
| app/boards/intel_adsp_ace40_nvl.conf | Removes obsolete trace setting. |
| app/boards/imx8mp_evk_mimx8ml8_adsp.conf | Removes obsolete trace setting. |
| app/boards/acp_7_x_adsp.conf | Removes obsolete trace setting. |
| app/boards/acp_7_0_adsp.conf | Removes obsolete trace setting. |
| AGENTS.md | Updates documented kernel directory placement. |
Review effort: Balanced
ed5de8c to
8d3600a
Compare
lgirdwood
left a comment
There was a problem hiding this comment.
Can we update the IPC handling readme.md to show teh new architecure and partitioning between user and kernel logic and processing. We should also state which IPCs are handled kernel only, user/kerel and user only.
| * IPC (InterProcessor Communication) provides a method of two way | ||
| * communication between the host processor and the DSP. The IPC used here | ||
| * utilises a shared mailbox and door bell between the host and DSP. | ||
| * |
There was a problem hiding this comment.
the naming of this file is confusing, can we state in the comments here what its doing between user and kernel space.
There was a problem hiding this comment.
Done in 3e43001. handler-user-kernel.c now starts with a comment describing its role. It holds the IPC4 global and module message routers, which run in the kernel IPC thread and are the kernel/user boundary for IPC4. They handle CHAIN_DMA, the IPC gateway, GDB and the base firmware LARGE_CONFIG in kernel mode in all builds, and hand the pipeline and module messages to the ipc4_route_*() functions. The comment also says that the "user" in the name refers to the messages, which are handled by the user-space part where possible.
| /* fw sends a fw ipc message to send the status of the last host ipc message */ | ||
| static struct ipc_msg *msg_reply; | ||
|
|
||
| #ifdef CONFIG_SOF_USERSPACE_LL |
There was a problem hiding this comment.
We should split the LL kernel space and userspace into separate c files to simplify. This file should be common.
There was a problem hiding this comment.
Done in 3e43001. handler-user-kernel.c is now common to all builds: there are no CONFIG_SOF_USERSPACE_LL conditionals left in the routers. For each pipeline and module message they call an ipc4_route_*() function, declared in the private handler-route.h. There are two implementations:
- handler-ll-user.c (CONFIG_SOF_USERSPACE_LL) forwards the message to the user-space IPC thread, with the target core lookup, the multicore SET_PIPELINE_STATE sequencing and the MOD_INIT driver lookup and module loading;
- handler-ll-kernel.c (LL in kernel space) calls the handlers directly.
Five of the routing functions in handler-ll-kernel.c are the former wrappers, renamed, with identical bodies. The sixth, for module config, takes the reply as a parameter. Every other function is unchanged.
PR 11422: test resultsRun date: 2026-11-14 21:39 UTC Tested commit: 709a32b8fdc6573956db9d3bcde0f54d8ab6f9bf |
ipc-common.c mixes code that only runs in kernel mode with code that also runs in the user-space IPC thread. Move the kernel part to src/kernel/ipc/ipc-common-kernel.c: - the IPC context and ipc_get() of user-space LL builds; - the IPC task, command completion and IDC forwarding to other cores; - the outgoing message queue and its work queue, and the kernel half of the ipc_msg_send() and ipc_msg_list_remove() system calls; - the setup of the user-space IPC threads, their kernel-only object copies, their registration as SOF system call callers and command forwarding to them; - the cross-core request slot semaphores and the access grants between the IPC and LL threads of the cores; - ipc_init(). ipc-common.c keeps message allocation, the component lookups and, for user-space LL builds, the user-space IPC thread function, the default command dispatch and the cross-core request helpers, which the user-space IPC and LL threads use instead of IDC. The user thread entry point and its event bits are now shared through sof/ipc/common.h. The unit tests that build ipc-common.c also build the kernel part. The code is unchanged. Only the Xtensa assembler's alignment padding and its choice between narrow and wide encodings of the same instructions differ in a few functions, as do the line numbers the moved functions pass to the assertion handler in builds with assertions (qemu_xtensa). In user-space LL builds the cross-core request helpers call ipc_get() instead of inlining it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
handler-user.c mixes the IPC4 global and module message routers, which run in the kernel IPC thread, with the handlers that also run in the user-space IPC thread. Move the kernel part to src/kernel/ipc/ipc4, in three files: - handler-user-kernel.c, common to all builds: the global and module message routers and the reply message they fill in, the CHAIN_DMA, IPC gateway and GDB commands, the module init that runs in the kernel (DP modules and builds without user-space LL), and the base firmware LARGE_CONFIG get and set, which use IDC and the IMR manifest; - handler-ll-user.c, built with the LL scheduler in user space (CONFIG_SOF_USERSPACE_LL): the routing of the pipeline and module messages to the user-space IPC thread, with the target core lookup, the multicore SET_PIPELINE_STATE sequencing and the MOD_INIT_INSTANCE driver lookup and module loading; - handler-ll-kernel.c, built with the LL scheduler in kernel space: the routing of the same messages directly to their handlers. Instead of switching on CONFIG_SOF_USERSPACE_LL per message, the routers call the ipc4_route_*() functions of the two routing files, which are declared in the private handler-route.h. A comment at the top of handler-user-kernel.c describes the split. handler-user.c keeps the pipeline state handling, the module config and large config processing and the user-space IPC thread dispatch. The pipeline ID lookup and the vendor config and kcontrol helpers, which both parts use, are no longer static and are declared in ipc4/handler.h. handler-user.c no longer needs the IPC gateway copier header. The handlers are unchanged. The routers now call the ipc4_route_*() functions, and through them ipc4_init_module_instance() and the base firmware LARGE_CONFIG handlers, instead of inlining that code. As before, the compiler can no longer inline or specialise the shared helpers in the callers on the other side of the split: their callers pass the full argument list instead of calling GCC's constant-propagated clones, and ipc4_set_pipeline_state() only partially inlines ipc4_pipeline_id_get() in builds without user-space LL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
helper.c mixes the IPC4 topology helpers, which also run in the user-space IPC thread, with code that needs kernel mode. Move the kernel part to src/kernel/ipc/ipc4/helper-kernel.c: - the component driver lookup, which reads the IMR manifest, registers loadable modules with the library manager and walks the driver list; - comp_new_ipc4(), the module creation of the kernel IPC thread (DP modules and builds without user-space LL), and the privileged part of the user-space module creation, ipc4_user_module_load(); - the IDC helpers, ipc4_process_on_core() and ipc_comp_free_remote(); - the chain DMA manager, which only the kernel CHAIN_DMA command uses. helper.c keeps the pipeline and component management, binding and the DMA config parsing. The module config parsing and the module init payload lookup, which both parts use, are no longer static and are declared in sof/ipc/topology.h, as is ipc_comp_free_remote(). helper.c no longer includes the rimage manifest, platform memory map and library manager headers. The code is unchanged, but the functions that now call across the split can no longer inline their callees: ipc_pipeline_new(), ipc_pipeline_free(), ipc4_comp_connect() and ipc4_comp_disconnect() call ipc4_process_on_core() and ipc_comp_free_remote(), and comp_new_ipc4(), ipc4_user_module_load() and ipc4_chain_manager_create() call the module config and component list helpers, instead of inlining them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add a User/Kernel Partitioning section to the IPC4 README. It shows how a message passes from the kernel dispatcher through the routers and the routing of the LL scheduler in user or kernel space to the user-space IPC thread, and lists which IPC4 messages are handled only in the kernel, in the kernel and in user space, and only in user space. Point the top-level IPC README at it and list the kernel and user halves of the split IPC files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
8d3600a to
709a32b
Compare
|
Re the IPC README review: done in 709a32b. src/ipc/ipc4/README.md has a new User/Kernel Partitioning section. It covers the message flow from the kernel dispatcher through the routers and the user-space or kernel-space LL routing to the user-space IPC thread, with a diagram. It also has a table of which IPC4 messages are handled only in the kernel, in the kernel and in user space, and only in user space. The top-level src/ipc/README.md points to it. |
Phase 3 of #11306 (kernel / user-space partition), first part: split the three mixed IPC source files and move their kernel halves into
src/kernel/ipc. Based on current main; the scheduler part (#11424) is already merged.The kernel half of
src/X/foo.cissrc/kernel/X/foo-kernel.c, and each user half says where its kernel half is. Shared helpers that used to bestaticare now declared in the existing IPC headers.Patches
ipc/ipc-common.c→kernel/ipc/ipc-common-kernel.c:ipc_msg_send()andipc_msg_list_remove()system calls;ipc_get();ipc_init().ipc-common.c:sof/ipc/common.h;ipc_user_xcore_send(),_reserve(),_release()), which the user-space IPC and LL threads use instead of IDC.ipc/ipc4/handler-user.c→src/kernel/ipc/ipc4, in three files:handler-user-kernel.c, common to all builds:A comment at the top explains its role between kernel and user space.
handler-ll-user.c, built with the LL scheduler in user space (CONFIG_SOF_USERSPACE_LL): the routing of the pipeline and module messages to the user-space IPC thread, with:handler-ll-kernel.c, built with the LL scheduler in kernel space: the routing of the same messages directly to their handlers.handler-route.h(private): the routers callipc4_route_*()functions, declared here, instead of switching onCONFIG_SOF_USERSPACE_LLper message.Stays in
handler-user.c: the pipeline state handling, the module config and large config processing, and the user-space IPC thread dispatch.Now shared: four helpers, declared in
ipc4/handler.h.ipc/ipc4/helper.c→kernel/ipc/ipc4/helper-kernel.c:comp_new_ipc4()andipc4_user_module_load();ipc4_process_on_core()andipc_comp_free_remote();helper.c: pipeline and component management, binding and the DMA config parsing.helper.cno longer includes the rimage manifest, platform memory map or library manager headers.Docs: a User/Kernel Partitioning section in the IPC4 README. It has a diagram of the message flow, and a table of which IPC4 messages are handled only in the kernel, in the kernel and in user space, and only in user space. The top-level IPC README points to it.
The 16 cmocka and 2 ztest unit test CMake files that build
ipc-common.calso build its kernel half. No unit test builds the IPC4 files.Some code in the user halves still calls the kernel (
ipc4_process_on_core()andipc_comp_free_remote()in builds without user-space LL, and the base firmware driver lookup). The issue tracks that as a Phase 5 item.Functional change
None. The functions are moved, not changed. The per-function disassembly of every image (the builds listed under Testing) was compared before and after each commit. It differs only where the compiler can no longer inline or specialise a function across the split:
ipc-common.c:ipc_get()instead of inlining it.handler-user.c:ipc4_route_*()functions, and through themipc4_init_module_instance()and the base firmware LARGE_CONFIG handlers, instead of inlining that code;ipc4_set_pipeline_state()only partially inlinesipc4_pipeline_id_get()(builds without user-space LL);helper.c: the callers no longer inline the shared helpers:ipc_pipeline_new(),ipc_pipeline_free(),ipc4_comp_connect()andipc4_comp_disconnect()callipc4_process_on_core()andipc_comp_free_remote();comp_new_ipc4(),ipc4_user_module_load()andipc4_chain_manager_create()call the module config and component list helpers.Symbols and
SYS_INIT()order are otherwise unchanged, as are every build's.configand the generated rimage configurations.Testing
CONFIG_SOF_USERSPACE_PROXY=n;os_linux_overlay.conf;llext_relocatable.conf.SYS_INIT()order), plus the per-function disassembly comparison described above.sof-hda-generic-cavs25-2ch.tplg, comparing main and the previous push of this branch, which has the same handlers. Both boot, play 5 s, and play again after runtime suspend, with no DSP errors. The routing split below was not run on hardware: the DUT was in use by someone else.All of the above was run after rebasing onto b0c97d5 (current main).
Changes since the last push
handler-user-kernel.ckeeps the routers, common to all builds.handler-ll-user.cforwards to the user-space IPC thread.handler-ll-kernel.ccalls the handlers directly.CONFIG_SOF_USERSPACE_LLconditionals left in the routers.handler-ll-kernel.care the former wrappers, renamed, with identical bodies. The sixth, for module config, takes the reply as a parameter instead of using the file-static reply.handler-user-kernel.cstarts with a comment explaining what it does between kernel and user space.helper.c.ipc-common.c(34),handler-user.c(33) andhelper.c(44) is present in the user or kernel half. Only the routers differ, and the routing wrappers are renamed.🤖 Generated with Claude Code