Skip to content

Build the host tools and TensorFlow without the host RTOS headers - #11555

Merged
lgirdwood merged 4 commits into
thesofproject:mainfrom
lgirdwood:kernel-user/host-posix-trim
Nov 28, 2026
Merged

lgirdwood merged 4 commits into
thesofproject:mainfrom
lgirdwood:kernel-user/host-posix-trim

Conversation

@lgirdwood

Copy link
Copy Markdown
Member

Part of #11306: reduce the users of the host RTOS headers (posix/include).

posix/include is the RTOS layer of the host library (libsof.a, CONFIG_LIBRARY), which the testbench and the CMocka unit tests link. Some code that is not part of the host library also adds it to its include path. This removes it from the code that does not need it.

Patches

  1. ipc: probe_dma_frame: the probe frame header is shared with the sof-probes tool, but it took MASK() from rtos/bit.h. The format masks are now constants, with the same values and the same unsigned long long type as the MASK() expressions. stdint.h is included for the uint32_t fields, which came through rtos/bit.h before.
  2. kernel: ext_manifest: the extended manifest header is shared with smex. It only used __packed from sof/compiler_attributes.h, and it already defines __packed when it is not defined. Drop the include.
  3. smex, probes: with that, smex and sof-probes build without posix/include, as their TODO comments asked.
  4. audio: tensorflow: the TensorFlow Micro library target had posix/include on its include path. Its sources (TensorFlow Micro, flatbuffers, gemmlowp, ruy, the HiFi NN library and the micro speech example) include no header from posix/include: nothing includes rtos/, sof/ or zephyr/ headers.

Not in this PR

  • sof-logger still needs posix/include: it includes sof/lib/uuid.h and sof/common.h, and sof/common.h uses zephyr/sys/util.h, which on the host comes from posix/include.
  • The topology parser is built with the host library for the testbench, so it keeps it too.

Functional change

None.

Testing

  • Tools: smex, sof-probes and sof-logger build without warnings. The testbench and the tools pass in the SOF CI container.
  • TensorFlow: checked by searching its sources, since no CI configuration builds the module. Nothing in TensorFlow Micro, flatbuffers, gemmlowp, ruy or the HiFi NN library includes a header that only posix/include provides.
  • Per commit, compared with main:
    • Builds: tgl, tgl-h, mtl, lnl, ptl, wcl, nvl, imx8, imx8x, imx8m, imx8m_cm7, imx8ulp, imx95 and qemu_xtensa, and the 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;
      • PTL and TGL with app/debug_stream_overlay.conf, and PTL with that overlay and user-space LL.
    • Comparisons: objects, LLEXT modules and firmware images (sections, symbols, SYS_INIT() order), and the per-function disassembly. No object changes at any commit. The only image difference is sof_init() on imx8m_cm7, imx93 and imx95, which embeds the git hash.
    • Signing: rimage runs for every Intel platform, and the generated configs are unchanged.
    • Cadence xt-clang (RI-2022.10): MTL, PTL and NVL compile.
    • ZTest: the unit tests pass, run as in CI (24 of 24 configurations at the tip).
    • Host: the host library and the cmocka unit tests build and pass.
    • Documentation: builds as in CI, with no warnings.
  • At the tip:
    • the host library and the cmocka unit tests pass for all nine defconfigs and the library config;
    • the include checker passes with --strict and --sources;
    • 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.

All of the above was run on c04d3f1 (main).

🤖 Generated with Claude Code

lrgirdwo and others added 4 commits November 28, 2026 11:45
probe_dma_frame.h is part of the probe ABI, which the sof-probes host
tool also uses, but it got MASK() from the RTOS header rtos/bit.h. That
made the tool build with the host RTOS headers (posix/include).

Write the format field masks as constants. They have the values and the
unsigned long long type of the MASK() expressions they replace. Include
stdint.h for the uint32_t fields, which came through rtos/bit.h before.

No functional change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
ext_manifest.h is shared with the smex host tool, and it only uses
__packed from sof/compiler_attributes.h, an RTOS header, which made smex
build with the host RTOS headers (posix/include). The header already
defines __packed when it is not defined, so drop the include.

No functional change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
smex and sof-probes added the host RTOS headers (posix/include) to their
include path, with a TODO to fix it. They only use SOF ABI headers from
src/include, which no longer include RTOS headers. Drop the include
directory and the TODOs.

The sof-logger still needs it: it includes sof/lib/uuid.h and
sof/common.h, which use zephyr/sys/util.h. The topology parser is
built with the host library for the testbench, so it keeps them too.

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 TensorFlow Micro library target (tflm_lib), built for the firmware
and as an LLEXT module, has the host RTOS headers (posix/include) on its
include path. Its sources are TensorFlow Micro, flatbuffers, gemmlowp,
ruy, the HiFi NN library and the micro speech example, and none of them
includes a header from posix/include (rtos/, sof/ or zephyr/). Drop the
include directory.

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 marked this pull request as ready for review November 28, 2026 17:02
@intel-sofci

Copy link
Copy Markdown

PR 11555: test results

Run date: 2026-11-28 17:21 UTC

Tested commit: c23f3f4649f212c8c0e0c95a6c4f9532c3b186ca

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

@lgirdwood

Copy link
Copy Markdown
Member Author

CI unrelated

@lgirdwood
lgirdwood merged commit a216716 into thesofproject:main Nov 28, 2026
45 of 47 checks passed
@lgirdwood
lgirdwood deleted the kernel-user/host-posix-trim branch November 28, 2026 18:13
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