Skip to content

platform: remove headers that are compiled out for their platforms - #11534

Merged
lgirdwood merged 3 commits into
thesofproject:mainfrom
lgirdwood:topic/platform-headers-4
Nov 25, 2026
Merged

lgirdwood merged 3 commits into
thesofproject:mainfrom
lgirdwood:topic/platform-headers-4

Conversation

@lgirdwood

Copy link
Copy Markdown
Member

Remove 17 platform headers (597 lines) that are only reachable through includes that are compiled out for their platforms. This is the fourth part of the platform header cleanup in #11517 step 1, after #11528, #11529 and #11532.

Patches

  1. platform: remove the unused interrupt headers. On Zephyr, platform/drivers/interrupt.h is only included through rtos/interrupt-legacy.h, which only the AMD platforms without native drivers use. The host build uses the library copy. Removes the i.MX8, i.MX8M, i.MX8ULP and posix copies.
  2. platform: remove the unused DAI headers. platform/lib/dai.h is only included through sof/lib/dai-legacy.h, which is only used without CONFIG_ZEPHYR_NATIVE_DRIVERS. Every i.MX and qemu_xtensa board uses the native drivers, and SOF has no legacy DAI drivers for them. Removes their copies.
  3. platform: remove the unused DMA headers. The Zephyr sof/lib/dma.h only includes platform/lib/dma.h for the legacy DMA domain schedulers. Only Rembrandt, and MediaTek without native drivers, select those. Removes the i.MX, posix and qemu_xtensa copies.

How the files were found

The static include analysis used for the earlier parts ignores #if. This time the list came from the headers that builds actually depend on, taken from ninja -t deps and the compiler dependency files of:

  • every firmware configuration listed below;
  • the host library and the cmocka builds of all nine defconfigs;
  • the ztest unit tests;
  • the native_sim IPC3/IPC4 stub builds;
  • the testbench and the tools.

Of the 32 platform headers that none of these builds uses, this PR removes the 17 on platforms whose builds all configure and compile. The other 15 are AMD and MediaTek headers. Those builds fail at configure or compile on main, so the dependency data says nothing about them, and they stay until those platforms build again or move to native drivers.

Functional change

None.

Testing

Run on e9c2a45 (current main), at every commit and at the tip.

  • Firmware, every commit, incremental builds of 37 configurations:

    • tgl, tgl-h, mtl, lnl, ptl, wcl, nvl, nvl-s;
    • the internal CI configuration of tgl, mtl, lnl and ptl;
    • imx8, imx8x, imx8m, imx8m_cm7, imx8ulp, imx93, imx95;
    • qemu_xtensa, qemu_xtensa_mmu, native_sim;
    • PTL with the userspace overlay and with LL userspace, PTL and MTL with llext_relocatable.conf, PTL and TGL with debug_stream_overlay.conf;
    • the legacy acp_6_0, acp_7_0, acp_7_x, MediaTek and phyboard_pollux builds.

    Each commit builds the same configurations as main (the legacy ones fail with unchanged error sets). Objects, LLEXT modules and images were hashed with the debug sections stripped. The only differences are the objects that embed the source hash or git version, and the LLEXT modules that the incremental builds relink. The pristine tip build shows that the LLEXT modules are identical.

  • Firmware, tip: a pristine build of the same matrix, compared with a pristine build of main. The SOF header dependencies (ninja -t deps) and the legacy error sets are unchanged, and all LLEXT modules are identical. The only differing objects are the version-bearing ones: init.c, ext_manifest.c, each platform.c and the final images. On imx8m_cm7 and imx95 the isr_tables object also differs, because sof_init() embeds the git hash and changes size on Cortex-M, which moves the ISR addresses in the generated table.

  • Host, every commit: the host library and the cmocka unit test builds (unit_test, imx8, mtk defconfigs) pass. With the debug sections stripped, all 1,291 objects are identical to main at every commit.

  • native_sim IPC3/IPC4 stub builds: pass.

  • ZTest: 23 of 23 pass, run as in CI.

  • check_kernel_includes.py --sources --strict: passes.

  • Documentation: builds with no warnings at every commit.

The testbench and the tools use only the library platform headers, which this PR does not touch.

🤖 Generated with Claude Code

lrgirdwo and others added 3 commits November 25, 2026 08:53
On Zephyr, platform/drivers/interrupt.h is only included through
rtos/interrupt-legacy.h, which only the AMD platforms without native
drivers use, and the host build uses the library platform copy. The
i.MX8, i.MX8M, i.MX8ULP and posix copies are never included. Remove
them.

No functional change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
platform/lib/dai.h is only included through sof/lib/dai-legacy.h, which
the Zephyr sof/lib/dai.h only uses without CONFIG_ZEPHYR_NATIVE_DRIVERS.
All the i.MX and qemu_xtensa boards use the native drivers, and SOF has
no legacy DAI drivers for them, so their copies are never included.
Remove them.

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 Zephyr sof/lib/dma.h only includes platform/lib/dma.h for the
legacy DMA domain schedulers (CONFIG_SCHEDULE_DMA_SINGLE_CHANNEL and
CONFIG_SCHEDULE_DMA_MULTI_CHANNEL), which only Rembrandt and MediaTek
without native drivers select, and the host build uses the library
platform copy. The i.MX, posix and qemu_xtensa copies are never
included. Remove them.

No functional change.

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

intel-sofci commented Nov 25, 2026 •

Copy link
Copy Markdown

PR 11534: test results

Run date: 2026-11-25 14:52 UTC

Tested commit: a093f487a8b2a8e6b3666b21794e8db856006f5f

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

@lgirdwood

Copy link
Copy Markdown
Member Author

Dead code removal. CI unrelated.

@lgirdwood
lgirdwood merged commit d80a052 into thesofproject:main Nov 25, 2026
45 of 47 checks passed
@lgirdwood
lgirdwood deleted the topic/platform-headers-4 branch November 25, 2026 15:49
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