Skip to content

Phase 2 (part 3): move src/library_manager to src/kernel/library_manager - #11402

Draft
lgirdwood wants to merge 1 commit into
thesofproject:mainfrom
lgirdwood:kernel-user/phase2c
Draft

lgirdwood wants to merge 1 commit into
thesofproject:mainfrom
lgirdwood:kernel-user/phase2c

Conversation

@lgirdwood

@lgirdwood lgirdwood commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Phase 2 of #11306 (kernel / user-space partition), third part: move the library manager to src/kernel/library_manager. Follows #11398.

Patch

  • src/library_manager → src/kernel/library_manager: a pure move. The library manager loads and links library and LLEXT modules, and it holds the kernel half of the lib_manager_free_module() system call (z_impl_/z_vrfy_). None of it runs in a user thread, so it is now built into the sof_kernel library.
    • Kconfig: sourced from src/kernel/Kconfig instead of src/Kconfig. The option values are unchanged.
    • User-space README: lists it with the kernel-only directories, and the system call table has the new path.
    • Host builds: only Zephyr builds the library manager, so they are not affected.

Functional change

None.

Testing

  • Per commit:
    • Firmware builds: tgl, tgl-h, mtl, lnl, ptl, wcl, nvl, imx8, imx8x, imx8m, imx8m_cm7, imx8ulp, imx95 and qemu_xtensa.
    • Extra CI configurations:
      • native_sim IPC3/IPC4 stub builds;
      • imx93 64-bit;
      • PTL with each userspace overlay;
      • PTL with CONFIG_SOF_USERSPACE_PROXY=n;
      • PTL and MTL with os_linux_overlay.conf;llext_relocatable.conf.
    • Comparisons: objects, LLEXT modules and firmware images, as described above.
    • Cadence xt-clang (RI-2022.10): MTL, PTL and NVL compile.
    • Host: the host library and cmocka build and pass.
  • At the tip:
    • all cmocka configurations, the testbench and the tools pass;
    • the platforms that already fail on main (acp_6_0, acp_7_0, acp_7_x, mt8186, mt8188, mt8195, mt8196, mt8365) have unchanged error sets.
  • Hardware: ARL-S (MTL firmware, which builds the library manager), sof-arl-hdmi.tplg, comparing Phase 2 (part 2): move src/idc to src/kernel/idc #11398 and this branch.
    • Result: both boot, load the base firmware library, play on HDMI, and play again after runtime suspend, with no DSP errors.
    • Not covered: this topology does not use an LLEXT module, so loading external modules was not exercised on hardware. TGL does not build the library manager.

All of the above was run on 78b23ad with #11394 and #11398 applied. After the rebase onto 414a8a2 (current main, including #11398), the patch is unchanged, and the firmware builds, the host library and cmocka were repeated at the tip.

🤖 Generated with Claude Code

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The component-creation callback remains directly callable from userspace despite being moved into a kernel-only translation unit, so user-side lifecycle callbacks must be separated from privileged loader and syscall code.

No open issues 🎉

What changed in this PR

This PR advances SOF’s kernel/user-space source partition by relocating the library manager under src/kernel and building it into sof_kernel. It also includes the stacked IDC relocation from #11398.

Changes:

  • Relocates library loading, linking, notification, and DRAM persistence code.
  • Updates CMake and Kconfig wiring for the relocated directories.
  • Updates directory classifications and documentation paths.
File Description
zephyr/​CMakeLists.txt Removes direct inclusion of the old directories.
src/​kernel/​library_manager/​llext_manager.c Relocates LLEXT loading and memory-domain management.
src/​kernel/​library_manager/​llext_manager_dram.c Relocates library-context save and restore logic.
src/​kernel/​library_manager/​lib_notification.c Relocates external-module notification handling.
src/​kernel/​library_manager/​lib_manager.c Relocates library loading, lifecycle callbacks, and syscall handling.
src/​kernel/​library_manager/​Kconfig Relocates library-manager configuration options.
src/​kernel/​library_manager/​CMakeLists.txt Builds relocated sources through the kernel subtree.
src/​kernel/​Kconfig Sources IDC and library-manager options.
src/​kernel/​idc/​zephyr_idc.c Relocates Zephyr inter-core messaging.
src/​kernel/​idc/​README.md Updates the directory name and documentation link.
src/​kernel/​idc/​Kconfig Relocates IDC timeout configuration.
src/​kernel/​idc/​idc.c Relocates inter-core command handling.
src/​kernel/​idc/​CMakeLists.txt Integrates IDC sources into the kernel subtree.
src/​kernel/​CMakeLists.txt Adds IDC and library-manager subdirectories.
src/​Kconfig Routes relocated configuration through kernel Kconfig.
src/​include/​sof/​userspace/​README.md Updates directory taxonomy and syscall implementation paths.
src/​audio/​README.md Updates the kernel-only IDC path.
AGENTS.md Documents src/kernel and its build library.

Review effort: Balanced

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>
@lgirdwood
lgirdwood force-pushed the kernel-user/phase2c branch from 76a2584 to eb47f25 Compare November 5, 2026 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants