Repository navigation
Phase 2 (part 4): move the Zephyr-only kernel code to src/kernel - #11411
Merged
Merged
Conversation
The library manager loads and links library and LLEXT modules and holds the kernel half of the lib_manager_free_module() system call. None of it runs in a user thread. Move it to src/kernel/library_manager, where it is built into the sof_kernel library. Source its Kconfig from src/kernel/Kconfig instead of src/Kconfig; the option values are unchanged. In the user-space README, list it with the kernel-only directories and update the path in the system call table. Only Zephyr builds the library manager, so the host builds are not affected. No functional change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Describe src/kernel: what belongs there, that moved code keeps its path below src/kernel, and that Zephyr builds it into the sof_kernel library. The README carries the "Runs in: Kernel-only" banner, so moved directories without a README of their own are covered by it. Point the user-space README's directory table at it instead of listing each kernel subdirectory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
The SOF probe log backend registers a Zephyr logging backend and runs in kernel mode. Move it to src/kernel/logging, where it is built into the sof_kernel library, and drop it from the not-yet-moved kernel-only directories in the docs. Only Zephyr builds it. No functional change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
The probe component drives DMA directly and runs in kernel mode. Move it to src/kernel/probe, where it is built into the sof_kernel library, or as before as an LLEXT module when CONFIG_PROBE=m. Its Kconfig is sourced from src/kernel/Kconfig instead of src/Kconfig; the option values are unchanged. Drop it from the not-yet-moved kernel-only directories in the docs. Only Zephyr builds it. No functional change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
The IPC4 base firmware module reports firmware and hardware configuration, manages DSP state and reads the memory windows. It runs in kernel mode. Move it to src/kernel/audio, where it is built into the sof_kernel library, and drop the files from the kernel exceptions in the include checker's manifest, which only lists user-space directories. base_fw_intel.c includes the copier's private copier_gain.h by a path relative to src/audio; it now uses a path relative to its new location. The base firmware module is not built for the host library. No functional change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
The microphone privacy manager handles the privacy interrupt and programs the DMIC and gateway hardware, and runs in kernel mode. Move it to src/kernel/audio/mic_privacy_manager, where it is built into the sof_kernel library, and drop it from the kernel exceptions in the include checker's manifest. Only Zephyr builds it. No functional change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
The user-space proxy is split in two: userspace_proxy_user.c runs in the user thread, and userspace_proxy.c creates that thread, its memory domain and object grants, and forwards the module calls to it from the kernel. Move the kernel half to src/kernel/audio/module_adapter/library, where it is built into the sof_kernel library. Drop it from the kernel exceptions in the include checker's manifest and update the module adapter README. Only Zephyr builds it. No functional change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
ipc-zephyr.c is the Intel ADSP IPC transport: it handles the host IPC interrupt and mailbox and the power state transitions requested over IPC, and runs in kernel mode. Move it to src/kernel/ipc, where it is built into the sof_kernel library. Only Zephyr builds it. No functional change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
The clock code takes spinlocks and calls the platform clock drivers, the KCPS manager requests clock changes from the platform, and the AMS messaging service disables interrupts and sends IDC messages to other cores. All three run in kernel mode. Move them to src/kernel/lib, where they are built into the sof_kernel library. The src/lib README listed ams.c among the context-agnostic helpers; correct that and point to the new location. None of these files is built for the host library. No functional change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
The telemetry code writes the performance and I/O measurements to the debug memory window and runs in kernel mode; components report to it through function calls, which is why user-space LL builds disable it for now. Move it to src/kernel/debug/telemetry, where it is built into the sof_kernel library. Its Kconfig is sourced from src/kernel/Kconfig instead of src/Kconfig; the option values are unchanged. Only Zephyr builds it. No functional change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
dram.c is the CONFIG_COLD_STORE_EXECUTE_DEBUG checker that tracks hot and cold code paths under a spinlock, and runs in kernel mode; user-space LL builds disable it for now. Move it to src/kernel/debug, where it is built into the sof_kernel library. Only Zephyr builds it. No functional change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
zephyr_ll_user.c creates the memory domain and heap of the user-space LL scheduler thread and checks the heap pointers passed to the heap system calls. Despite its name it runs in kernel mode. Move it to src/kernel/schedule, where it is built into the sof_kernel library. Update the schedule and user-space READMEs, and stop giving it as an example of a user-side file. Only Zephyr builds it, for CONFIG_SOF_USERSPACE_LL. No functional change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
A critical issue remains: moving the mixed translation unit into sof_kernel violates the kernel-only contract because userspace_proxy_process() still executes directly in a K_USER DP thread.
No open issues 🎉
What changed in this PR
Continues the kernel/user-space partition in #11306 by relocating Zephyr-only subsystems into src/kernel and the sof_kernel library. Includes the stacked library-manager move from #11402, with no intended functional changes.
Changes:
- Relocates logging, probes, base firmware, privacy management, IPC transport, clock services, telemetry, and scheduler setup.
- Updates CMake, Kconfig, and rimage paths for the new layout.
- Revises tier documentation and removes obsolete partition exceptions.
| File | Description |
|---|---|
zephyr/CMakeLists.txt |
Removes old subsystem build paths. |
tools/rimage/config/wcl.toml.h |
Updates probe manifest include. |
tools/rimage/config/tgl.toml.h |
Updates probe manifest include. |
tools/rimage/config/tgl-h.toml.h |
Updates probe manifest include. |
tools/rimage/config/ptl.toml.h |
Updates probe manifest include. |
tools/rimage/config/nvl.toml.h |
Updates probe manifest include. |
tools/rimage/config/mtl.toml.h |
Updates probe manifest include. |
tools/rimage/config/lnl.toml.h |
Updates probe manifest include. |
src/schedule/README.md |
Documents relocated LL memory setup. |
src/schedule/CMakeLists.txt |
Removes relocated scheduler source. |
src/platform/posix/include/platform/lib/clk.h |
Updates source path in a comment. |
src/lib/README.md |
Corrects clock and AMS tier descriptions. |
src/lib/CMakeLists.txt |
Removes relocated kernel services. |
src/kernel/schedule/zephyr_ll_user.c |
Relocates LL memory-domain and heap setup. |
src/kernel/schedule/CMakeLists.txt |
Builds relocated LL setup conditionally. |
src/kernel/README.md |
Defines kernel tier, layout, and build rules. |
src/kernel/probe/probe.toml |
Relocates probe module metadata. |
src/kernel/probe/llext/llext.toml.h |
Relocates probe extension manifest. |
src/kernel/probe/llext/CMakeLists.txt |
Relocates probe extension build rules. |
src/kernel/probe/Kconfig |
Relocates probe options. |
src/kernel/probe/CMakeLists.txt |
Relocates probe build selection. |
src/kernel/logging/log_backend_probe.c |
Relocates probe logging backend. |
src/kernel/logging/CMakeLists.txt |
Builds relocated logging backend. |
src/kernel/library_manager/llext_manager_dram.c |
Relocates extension context persistence. |
src/kernel/library_manager/lib_notification.c |
Relocates library notification handling. |
src/kernel/library_manager/lib_manager.c |
Relocates library loading and management. |
src/kernel/library_manager/Kconfig |
Relocates library-manager options. |
src/kernel/library_manager/CMakeLists.txt |
Relocates library-manager build rules. |
src/kernel/lib/cpu-clk-manager.c |
Relocates CPU clock budgeting. |
src/kernel/lib/CMakeLists.txt |
Builds relocated kernel services. |
src/kernel/lib/clk.c |
Relocates clock-control implementation. |
src/kernel/lib/ams.c |
Relocates asynchronous messaging service. |
src/kernel/Kconfig |
Sources relocated subsystem options. |
src/kernel/ipc/ipc-zephyr.c |
Relocates Intel ADSP IPC transport. |
src/kernel/ipc/CMakeLists.txt |
Builds transport on supported Intel platforms. |
src/kernel/debug/telemetry/telemetry.c |
Relocates scheduler telemetry. |
src/kernel/debug/telemetry/README.md |
Relocates telemetry documentation. |
src/kernel/debug/telemetry/performance_monitor.c |
Relocates performance monitoring. |
src/kernel/debug/telemetry/Kconfig |
Relocates telemetry options. |
src/kernel/debug/telemetry/CMakeLists.txt |
Relocates telemetry build rules. |
src/kernel/debug/dram.c |
Relocates cold-path execution checker. |
src/kernel/debug/CMakeLists.txt |
Builds relocated debug facilities. |
src/kernel/CMakeLists.txt |
Adds relocated subsystem directories. |
src/kernel/audio/module_adapter/library/userspace_proxy.c |
Relocates proxy implementation. |
src/kernel/audio/mic_privacy_manager/README.md |
Relocates privacy-manager documentation. |
src/kernel/audio/mic_privacy_manager/mic_privacy_manager_intel.c |
Relocates Intel microphone privacy implementation. |
src/kernel/audio/mic_privacy_manager/CMakeLists.txt |
Relocates privacy-manager build rules. |
src/kernel/audio/CMakeLists.txt |
Builds relocated audio-side services. |
src/kernel/audio/base_fw.c |
Relocates base-firmware IPC handlers. |
src/kernel/audio/base_fw_intel.c |
Relocates Intel handlers and adjusts copier include. |
src/Kconfig |
Removes old subsystem option paths. |
src/ipc/CMakeLists.txt |
Removes relocated IPC transport source. |
src/include/sof/userspace/README.md |
Updates tier table and relocated references. |
src/debug/CMakeLists.txt |
Removes relocated debug facilities. |
src/audio/module_adapter/README.md |
Updates proxy implementation paths. |
src/audio/module_adapter/CMakeLists.txt |
Keeps user-side proxy source in place. |
src/audio/CMakeLists.txt |
Removes relocated firmware and privacy sources. |
scripts/kernel_user_partition.txt |
Removes exceptions for relocated audio files. |
AGENTS.md |
Updates remaining kernel-directory guidance. |
Review effort: Balanced
lgirdwood
marked this pull request as ready for review
November 6, 2026 16:48
lgirdwood
requested review from
LaurentiuM1234,
abonislawski,
bardliao,
dbaluta,
iuliana-prodan,
kv2019i,
lyakh,
marcinszkudlinski,
mmaka1,
pblaszko,
plbossart,
ranj063 and
tmleman
as code owners
November 6, 2026 16:48
PR 11411: test resultsRun date: 2026-11-06 18:01 UTC Tested commit: 45c04781c8037ec3cf481bda3e991603e6da53fb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 2 of #11306 (kernel / user-space partition), fourth part: move the remaining kernel-only code that only Zephyr builds into
src/kernel, one commit per move. Moves of code the host builds also compile, and ofarch/platform, follow in two further PRs. Stacked on #11402: its commit (rebased onto current main) comes first and will drop out when #11402 is merged.Moved code keeps its path below
src/kernel(src/<path>→src/kernel/<path>). Only the kernel-only files of mixed directories move.Patches
src/kernel/README.md(new):sof_kernellibrary;logging/→kernel/logging/: the SOF probe log backend.probe/→kernel/probe/:src/kernel/Kconfig;tools/rimage/config/*.toml.hfiles that includeprobe.tomlget the new path.audio/base_fw.c,audio/base_fw_intel.c→kernel/audio/.base_fw_intel.cincludes the copier's privatecopier_gain.h, now by a path relative to its new location.audio/mic_privacy_manager/→kernel/audio/mic_privacy_manager/.audio/module_adapter/library/userspace_proxy.c→kernel/audio/module_adapter/library/: the kernel half of the user-space proxy. The user half,userspace_proxy_user.c, stays.ipc/ipc-zephyr.c→kernel/ipc/: the Intel ADSP IPC transport.lib/clk.c,lib/cpu-clk-manager.c,lib/ams.c→kernel/lib/. Thesrc/libREADME listedams.cas context-agnostic, but it disables interrupts and sends IDC messages; corrected.debug/telemetry/→kernel/debug/telemetry/: its Kconfig is now sourced fromsrc/kernel/Kconfig.debug/dram.c→kernel/debug/: theCONFIG_COLD_STORE_EXECUTE_DEBUGchecker.schedule/zephyr_ll_user.c→kernel/schedule/: despite its name, this is the kernel-side setup of the user LL memory domain and heap. The READMEs no longer give it as an example of a user-side file.audio/intel_uaol.cwas going to move as well, but since the UAOL feedback support it also contains functions that the DAI component calls from the user-space LL thread. It is now mixed, so it stays where it is and will be split in Phase 3.Each commit drops its files from the kernel exceptions in
scripts/kernel_user_partition.txt(which only lists user-space directories), and updates the READMEs that name them.Functional change
None. Every object and LLEXT module is unchanged, every build's
.confighas the same option values, and the generated rimage configuration (rimage_config.toml) of every Intel platform is identical. The symbols (name, type and size) of every firmware image are identical. Link-order effects:wordlist) in the PTL builds with Zephyr userspace, as in Phase 2 (part 1): add src/kernel and a sof_kernel library, move src/init #11394–Phase 2 (part 3): move src/library_manager to src/kernel/library_manager #11402.SYS_INIT()ties: the probe, base firmware and telemetry moves change the order amongAPPLICATION-level entries with the same priority, which Zephyr runs in link order.telemetry_init()andperformance_monitor_init()now run before the other component registrations instead of after them.sof_init()still run earlier, atPOST_KERNEL.Known kernel calls from user-space code (not changed here)
zephyr_ll_user_heap()(host-zephyr.c) and the telemetry functions (component.c, the host and DAI components). User-space LL builds disable telemetry for now. Both need system calls in a later phase.base_fw_intel.cuses the copier's private header.Testing
CONFIG_SOF_USERSPACE_PROXY=n;os_linux_overlay.conf;llext_relocatable.conf.*.toml.hconfigs. The generated configs are compared with the previous commit.sof-hda-generic-cavs25-2ch.tplg, comparing Phase 2 (part 3): move src/library_manager to src/kernel/library_manager #11402 and this branch. That covers the base firmware, IPC transport, AMS and probe moves (tested before the rebase, on 414a8a2). Both boot, register the probes card, play 5 s, and play again after runtime suspend, with no DSP errors.All of the above was run on 0ebaf49 (current main, Zephyr 76f604468505) with #11402 rebased onto it, except for the TGL hardware test, which was run on 414a8a2.
🤖 Generated with Claude Code