Skip to content

Phase 0: remove XTOS and ALSA plugin leftovers, add kernel/user include checker - #11312

Open
lgirdwood wants to merge 23 commits into
thesofproject:mainfrom
lgirdwood:kernel-user/phase0
Open

lgirdwood wants to merge 23 commits into
thesofproject:mainfrom
lgirdwood:kernel-user/phase0

Conversation

@lgirdwood

@lgirdwood lgirdwood commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Phase 0a of #11306 (kernel / user-space partition): remove the XTOS-era and ALSA plugin code that no build uses any more, and add a report-only checker for kernel-only includes from user-space code. One patch per subject.

No platform loses support. Every file removed is either not referenced by any Zephyr, testbench or unit test build, or can no longer be built.

Patches

  • Stale references and dead CI
    • remove the zephyr CMake entries for the deleted hda-dma.c and lps_wait.c
    • remove the daily XTOS reproducible-build job, which exits 0 without building
  • Unit tests
    • remove the dead Xtensa (xt-run) cmocka build
    • move the cmocka defconfigs to test/cmocka/configs
  • XTOS firmware build: remove it from the top-level CMake, together with its toolchain file, scan-build wrapper, per-platform/driver CMake and Chrome config overrides
  • Platform and driver code no build uses
    • AMD Renoir/Vangogh/ACP 6.3, plus unbuilt AMD sources
    • MediaTek per-SoC XTOS dirs; Zephyr uses src/platform/mtk
    • i.MX XTOS DMA/DAI/IRQ/timer drivers
    • DesignWare DMA/GPIO/SPI: CONFIG_DW cannot be enabled
    • Intel HDA headers
    • posix base_fw_platform.c
  • Debug: remove the old SOF GDB stub (CONFIG_GDB_DEBUG); CONFIG_GDBSTUB is unaffected
  • xtos/: move the legacy XTOS IRQ header into zephyr/include (still used by AMD without native drivers), then remove xtos/include
  • ALSA plugin: remove the plugin, its topology, the shared-library module build and CONFIG_LIBRARY_STATIC
  • Other XTOS tooling: remove the installer, and the XTOS cross toolchains in the sof_builder docker image
  • Include checker: add scripts/check_kernel_includes.py + scripts/kernel_user_partition.txt, and a report-only step in the Zephyr workflow. Current PTL baseline: 148 user-space sources include 28 kernel-only headers.

Testing

Every commit was built. At each one:

  • tgl, imx8m, acp_7_0 and qemu_xtensa firmware is section-identical to the base;
  • the host library builds;
  • the cmocka unit tests pass.

At the tip:

  • Zephyr firmware: zephyr.elf has identical non-debug sections on all 15 platforms that build on main (tgl, tgl-h, mtl, lnl, ptl, wcl, nvl, imx8, imx8x, imx8m, imx8m_cm7, imx8ulp, imx95, acp_7_0, qemu_xtensa).
  • LLEXT: all 66 LLEXT modules are identical.
  • Host tools: testbench, sof-ctl/logger/probes and all cmocka configurations pass.
  • Platforms that already fail on main: acp_6_0, acp_7_x, mt8186, mt8188, mt8195, mt8196 and mt8365. Their complete error sets (ninja -k 0) are identical before and after.

Not tested: the sof_builder docker image. Its alsa-lib/alsa-utils stage already fails on main (Ubuntu 22.04 autoconf is too old) and is not changed here.

The tip results above were re-run on 637c056 (current main) after the rebase. The per-commit builds and the libsof.a symbol comparison (unchanged) were done on the previous base, d85ba5e; the rebase only changed the GDB stub patch, where it resolved conflicts with new doxygen comments.

Notes

  • UUID registry entries of removed code are kept, because distributed mappings must never change.
  • Phase 0b, the legacy driver path (dai-legacy.c, host-legacy.c, DMA domains, ll_schedule_xtos.c), is not included. It needs acp_6_0 and the MTK legacy platforms ported to native drivers, and the testbench to stop using the legacy host/DAI components. See [FEATURE] Partition SOF into DSP kernel and userspace source/include trees #11306.
  • Open question: src/trace is still built by the testbench, so it is kept for now.

🤖 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.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@@ -1,58 +0,0 @@
// SPDX-License-Identifier: BSD-3-Clause

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

pls check this is not needed to build native_sim target. If it is, we should fix so native sim can build without.

@intel-sofci

Copy link
Copy Markdown

PR 11312: test results

Run date: 2026-10-15 00:14 UTC

Tested commit: f882357269732f6b14fcf30ce6aa361f661d2d4b

mtl pass rate lnl pass rate ptl pass rate wcl pass rate nvl pass rate

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Reminder that xtos rtos and/or non native zephyr drivers support still exists and is functional in stable-v2.15 branch for those who are still transitioning.

lrgirdwo and others added 5 commits October 15, 2026 17:10
src/drivers/intel/ has been removed and src/platform/intel/ace/lps_wait.c
no longer exists. Neither CONFIG_INTEL_HDA nor CONFIG_CAVS_LPS is defined
by any Kconfig file, so these conditional source lists can never be
enabled and would break the build if they were.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
test-repro-build.sh builds the firmware twice with
scripts/xtensa-build-all.sh and compares the XTOS build output. That
script was removed together with the XTOS firmware build, so the check
now hits its "test -x xtensa-build-all.sh || exit 0" guard and passes
without building anything.

Remove the script, the repro-build workflow, its daily-tests entry and
the scripts/README.md section. Zephyr build reproducibility is still
covered by app/configs/repro-build.conf in the zephyr workflow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Only host cmocka builds have worked since src/arch/xtensa lost its
CMakeLists.txt: configuring with BUILD_UNIT_TESTS=ON and without
BUILD_UNIT_TESTS_HOST=ON fails at add_subdirectory(src/arch/xtensa).

Remove the xt-run / Xtensa GCC unit test support: the
BUILD_UNIT_TESTS_XTENSA_GCC option, the two Xtensa cmocka toolchain
files and the non-host branches in the test CMake files, which also
referenced the removed src/arch/xtos-wrapper, src/arch/xtensa/idc.c and
src/drivers/intel/cavs/idc.c. Fail early with a clear message if unit
tests are requested without BUILD_UNIT_TESTS_HOST.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
The src/arch/xtensa/configs/*_defconfig files were the XTOS firmware
build configurations. That build is gone and the only remaining user is
the cmocka matrix in test/test-all-defconfigs.sh (plus run-mocks.sh -c),
which builds the host unit tests once per defconfig.

Move them next to the tests that use them and search that directory for
-DINIT_CONFIG instead of src/arch/xtensa/configs. No change in content;
configurations for removed platforms are deleted together with those
platforms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
The top-level CMake project could still be configured for an XTOS
firmware image (ARCH=xtensa, add_executable(sof)), but that build can no
longer work: src/arch/xtensa has no CMakeLists.txt and xtos/ only holds
a few headers. All firmware is built with Zephyr through
zephyr/CMakeLists.txt, which never uses the top-level project, the
src/platform/*/ and src/drivers/*/ CMake files or the xtensa toolchain
file.

Remove the XTOS firmware part of the top-level CMakeLists.txt and fail
with a pointer to scripts/xtensa-build-zephyr.py instead. Also remove
what only that build used:

 - scripts/cmake/xtensa-toolchain.cmake, the unused
   scripts/cmake/xtensa-platform.cmake and BUILD_CLANG_SCAN
 - scripts/scan/, the XTOS clang scan-build wrapper
 - the XTOS-only tails of src/CMakeLists.txt, src/platform/CMakeLists.txt
   and src/drivers/CMakeLists.txt, and the per-platform/per-driver
   CMakeLists.txt files they included
 - the src/arch/xtensa/configs/override/ Chrome XTOS config fragments

The host library (testbench, plugin) and unit test builds are unchanged.
Sources that are no longer referenced by any build are removed in
follow-up patches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
lrgirdwo and others added 18 commits October 15, 2026 17:10
These platforms were only supported by the XTOS firmware build, which
has been removed. They have no Zephyr board and nothing builds their
platform code or drivers any more.

Remove src/platform/amd/{renoir,vangogh,acp_6_3}, src/drivers/amd/
{renoir,vangogh}, their Kconfig platform choices and rimage signing
schema defaults, their unit test defconfigs, and the CONFIG_ACP_6_3
code in the Rembrandt HS DMA driver that is shared with ACP 6.0.

Topologies and rimage configurations for these platforms are left in
place as they are not part of the firmware build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
The Zephyr builds for ACP 6.0, 7.0 and 7.x list their sources explicitly
in zephyr/CMakeLists.txt. The following files are not in those lists
and were only used by the removed XTOS firmware build:

 - drivers/amd/common/timer.c (XTOS timer, Zephyr provides the system
   timer)
 - drivers/amd/rembrandt/acp_sw_audio_{dai,dma}.c (ACP 6.3 / 7.0
   SoundWire audio DAI and DMA)
 - platform/amd/acp_7_0/lib/{dai,dma,memory}.c (XTOS DAI/DMA tables and
   memory map, ACP 7.0 uses the native Zephyr drivers)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
MediaTek firmware is built with Zephyr using the common src/platform/mtk
code, the AFE drivers in src/drivers/mediatek/afe and CONFIG_MTK.
The per-SoC platform and driver directories were only used by the
removed XTOS firmware build:

 - src/platform/{mt8186,mt8188,mt8195,mt8196,mt8365}
 - src/drivers/mediatek/{mt818x,mt8195,mt8196,mt8365} (XTOS interrupt,
   timer and IPC drivers)
 - src/drivers/mediatek/afe/mt8*/afe-sgen.c, the XTOS-only test sine
   generator, together with CONFIG_TEST_SGEN, its afe-memif.c hooks and
   sof/drivers/afe-sgen.h

Also remove the MT8186/MT8188/MT8195/MT8196/MT8365 Kconfig platform
choices, the MEDIATEK symbol and the unused MEDIATEK_DRAM_IMAGE option
that only they used, their rimage signing schema and
FORCE_DMA_COPY_WHOLE_BLOCK defaults (never set by the Zephyr builds,
which select MTK instead), and their unit test defconfigs, replaced by a
single mtk_defconfig. Point the MediaTek CODEOWNERS entries at the
remaining MediaTek code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
The i.MX Zephyr builds use the native Zephyr EDMA, SDMA, SAI, ESAI,
MICFIL, interrupt controller and timer drivers. The SOF implementations
of these drivers and the per-platform lib/{dai,dma,memory}.c tables
were only used by the removed XTOS firmware build:

 - src/drivers/imx/{edma,esai,interrupt-generic,interrupt-irqsteer,
   micfil,sai,sdma,timer}.c and sof/drivers/{esai,sai,sdma,micfil}.h
 - src/platform/{imx8,imx8m,imx8ulp}/lib/{dai,dma,memory}.c and
   src/platform/imx93_a55/lib/{dai,dma}.c

Remove them together with the IMX_EDMA, IMX_SDMA, IMX_ESAI, IMX_MICFIL,
IMX_INTERRUPT_IRQSTEER, IMX_INTERRUPT_GENERIC and HAVE_SDMA_FIRMWARE
Kconfig options, which nothing else uses. sof/drivers/edma.h is kept,
it is still used by the IPC3 DAI code and the i.MX8ULP platform.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
All options in src/drivers/dw/Kconfig depend on CONFIG_DW, which has no
prompt and is not selected by any platform since the XTOS platforms
were removed. CONFIG_DW_DMA can therefore never be enabled and the
dw/dma.c entry in zephyr/CMakeLists.txt is dead; the GPIO and SPI
drivers are not referenced by any build at all. Platforms with a
DesignWare DMA controller use the Zephyr dma_dw driver.

Remove src/drivers/dw, its Kconfig, sof/drivers/{dw-dma,gpio,spi,
iomux}.h and the CODEOWNERS entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
sof/drivers/hda.h and sof/drivers/hda-dma.h belonged to the SOF Intel
HDA DMA driver, which has been replaced by the Zephyr intel_adsp HDA
drivers and removed together with src/drivers/intel. Nothing includes
these headers any more.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
No build compiles this file and nothing calls the platform_basefw_*()
functions it defines, the base firmware platform interface has since
changed. The native_sim builds do not need it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
CONFIG_GDB_DEBUG enabled the SOF GDB stub in src/debug/gdb, which needs
architecture support in arch/debug/gdb/. That support only remains for
the host architecture, the Xtensa implementation went away with XTOS,
so the option cannot be built for any firmware target. Debugging over
IPC is provided by the Zephyr GDB stub (CONFIG_GDBSTUB), which is not
affected.

Remove CONFIG_GDB_DEBUG, src/debug/gdb, the host arch gdb headers and
the GDB_DEBUG paths in the IPC3 handler and fw_ready flags. Keep the
gdb_init() declaration used by the CONFIG_GDBSTUB path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
AMD platforms built without CONFIG_ZEPHYR_NATIVE_DRIVERS still use the
SOF interrupt API from src/drivers/interrupt.c, which zephyr's
rtos/interrupt.h pulls in from xtos/include with a relative path. That
is the last firmware user of xtos/include.

Move the header to zephyr/include/rtos/interrupt-legacy.h and include it
by name, so that xtos/ can be removed. It goes away together with the
legacy driver path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
The XTOS RTOS headers left in xtos/include are now only used as an extra
include directory by LLEXT module builds, sof-logger, sof-probes and
smex. zephyr/include and posix/include provide all of them:

 - LLEXT modules are Zephyr code and already get zephyr/include through
   the Zephyr interface include directories.
 - sof-logger already has posix/include ahead of xtos/include.
 - sof-probes and smex now use posix/include instead.

Remove xtos/, its include directory entries and its doxygen input, and
refer to posix/include instead in src/include/README.md and in the
\file comments of the posix headers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
The SOF ALSA plugin (sof-pipe, the ALSA PCM/control plugins and the
host module loaders) is no longer needed: host-side pipeline testing is
covered by the testbench, and keeping the plugin building means
maintaining another host consumer of the firmware sources and headers.

Remove tools/plugin, its plugin_ipc4_defconfig library configuration
and the SOF-alsa-plugin CI job.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
development/sof-plugin.conf described the pipelines of the removed SOF
ALSA plugin, and ov_noise_suppression.conf the plugin-only OpenVINO noise
suppression module. Nothing else uses them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD built each audio module as a
host shared object (sof_<module>[_<opt>].so) for the SOF ALSA plugin.
The plugin has been removed and the testbench links the modules
statically into libsof, so nothing enables this option any more.

Remove the option and its build rules from src/audio and
src/audio/module_adapter. The Zephyr and host library builds are
unchanged, the libsof.a symbol table is identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
With the ALSA plugin gone, the testbench is the only user of the host
library and of the topology parser library, and it always builds both as
static archives. CONFIG_LIBRARY_STATIC is therefore always set for
CONFIG_LIBRARY builds.

Drop CONFIG_LIBRARY_STATIC and the shared library variants: build libsof
and libsof_tplg_parser as static archives, test CONFIG_LIBRARY instead of
CONFIG_LIBRARY_STATIC, and remove the immediate pipeline_trigger() variant
that was only built for the shared library. kpb.c keeps being built for
the firmware and not for the host library. The resulting libsof.a symbol
table and the firmware images are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
installer/GNUmakefile staged /lib/firmware/intel/sof from the
build_<platform>_<toolchain>/ directories produced by
scripts/xtensa-build-all.sh. That script and the XTOS firmware build it
drove are gone, so the installer can no longer find anything to stage.
Zephyr builds are staged by scripts/xtensa-build-zephyr.py in
build-sof-staging/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
The sof_builder image still built crosstool-ng GCC 10.2 toolchains and
newlib for the XTOS firmware targets (byt, hsw, apl, cnl, imx, imx8m,
imx8ulp, rn, rmb, vangogh, mt8186, mt8195, mt8188). The XTOS build is
gone and firmware is built with the Zephyr SDK container
(zephyr/docker-run.sh); this image is now only used for host builds.

Remove the crosstool-ng and newlib stages and their PATH entries, and
drop the XTOS firmware build examples from scripts/README.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
SOF is being split into DSP kernel code (Zephyr supervisor mode) and
user-space code that must be safe to run in Zephyr user threads. As a
first step, measure how much user-space code depends on kernel-only
headers.

check_kernel_includes.py reads the dependency log of one or more ninja
build directories and reports every kernel-only header included, directly
or transitively, by an object built from a user-space source. The
classification lives in scripts/kernel_user_partition.txt and starts with
the audio, math, module and sample code as user space, and the platform,
driver, interrupt, clock, IDC, PM and memory map headers as kernel-only.

The checker only reports by default; --strict makes it fail and is meant
for later, once the existing includes have been removed. For PTL it
currently reports 148 user-space sources including 28 kernel-only
headers, mostly through component.h, audio_stream.h and rtos/alloc.h.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Run scripts/check_kernel_includes.py on every Linux Zephyr build and
print the per-header summary, so that the kernel / user-space partition
work can track how many kernel-only headers user-space code still pulls
in. The step never fails the build; it will be switched to --strict once
the existing includes are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
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.

4 participants