Skip to content

platform: remove unused platform headers - #11528

Draft
lgirdwood wants to merge 5 commits into
thesofproject:mainfrom
lgirdwood:topic/platform-headers-1
Draft

lgirdwood wants to merge 5 commits into
thesofproject:mainfrom
lgirdwood:topic/platform-headers-1

Conversation

@lgirdwood

Copy link
Copy Markdown
Member

Remove 60 platform headers that no build includes (6,828 lines). This is the first part of the platform header cleanup in #11517 step 1 ("Remove dead code"). Later parts remove the unused macros in the headers that are still included.

Patches

  1. platform: remove the unused platform trace headers. Since c1e037a nothing includes platform/trace/trace.h and nothing calls platform_trace_point(). Removes the header from all 15 platforms, plus cavs/trace/trace.h.
  2. platform: remove the unused IDC headers. Only the host build includes platform/drivers/idc.h, from posix/include/rtos/idc.h, and it uses the library copy. The Zephyr rtos/idc.h does not include it. Removes the AMD, i.MX and posix copies.
  3. platform: remove the unused CPU and PM runtime headers. Same situation for platform/lib/cpu.h and platform/lib/pm_runtime.h: only the posix/include wrappers include them, and they resolve to the library copies. Removes the AMD, i.MX, MediaTek and posix copies.
  4. platform: intel: remove unused cAVS and ACE headers.
    • cavs/drivers/mn.h and cavs/drivers/timestamp.h: they can only be included from platform/drivers/*.h files that no longer exist.
    • cavs/ext_manifest.h.
    • cavs/lib/power_down.h and cavs/mem_window.h: prototypes of functions that SOF does not define, because Zephyr owns them.
    • auth/intel_status_logger_api.h.
  5. platform: remove Xtensa core headers that are not on any include path.
    • The i.MX8, i.MX8M and i.MX8ULP copies of include/arch/xtensa/config/*. These platforms don't add include/arch to the include path; the core configuration comes from hal_xtensa.
    • The ACP 7.x copy of xt_datacache.h, which is not on the include path either.
    • The ACP 6.0 and ACP 7.0 copies are kept. Those platforms add include/arch to the include path, so their copies replace the toolchain and hal_xtensa headers that Zephyr includes.

How the files were found

  • A static include analysis, run once per platform with that platform's include path from zephyr/CMakeLists.txt, plus the host library, testbench and ztest include paths.
  • Confirmed against the dependencies ninja recorded for the builds (ninja -t deps) of every configuration listed below at the base commit: none of the 60 files is a dependency of any build.
  • Altogether only 105 of the 236 platform headers are used by any build.

Functional change

None.

Testing

Run on 90fe874 (current main) and at the tip.

  • Firmware builds, each from scratch at both base and tip:

    • tgl, tgl-h, mtl, lnl, ptl, wcl, nvl, nvl-s;
    • 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 os_linux_overlay.conf;llext_relocatable.conf, PTL and TGL with debug_stream_overlay.conf.

    All pass.

  • Objects: 10,776 objects, LLEXT modules and ELF files hashed in each build. The only ones that differ are those that embed the source hash or git version: init.c, ext_manifest.c, each platform.c, and the final images.

  • Dependencies: the set of SOF headers the builds depend on is unchanged.

  • Platforms that already fail on main:

    • acp_6_0 and acp_7_0 fail at compile, and their full ninja -k 0 error sets are unchanged.
    • acp_7_x, mt8186, mt8188, mt8195, mt8196, mt8365 and phyboard_pollux fail at configure with the current Zephyr, and their errors are unchanged.
  • Cadence xt-clang (RI-2022.10): MTL, PTL and NVL compile.

  • Host: the host library, the cmocka unit tests for all defconfigs, the testbench and the tools pass (testbench and tools in the SOF CI docker image).

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

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

  • Documentation: builds with no warnings at every commit.

🤖 Generated with Claude Code

lrgirdwo and others added 5 commits November 23, 2026 16:50
Since commit c1e037a ("trace: do not include the platform trace header
from sof/trace/trace.h") nothing includes platform/trace/trace.h, and
nothing calls the platform_trace_point() hook it provided. Remove the
header from every platform, and the cAVS trace header that the Tiger
Lake one included.

No functional change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Only the host build includes platform/drivers/idc.h, from
posix/include/rtos/idc.h, and it uses the copy in the library platform.
The Zephyr rtos/idc.h does not include it, so the AMD, i.MX and posix
copies are never used. 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>
Only the host build includes platform/lib/cpu.h and
platform/lib/pm_runtime.h, from the posix/include wrappers, and it uses
the copies in the library platform. The Zephyr builds include neither
header, so the AMD, i.MX, MediaTek and posix copies are never used.
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>
Nothing includes these headers:
- cavs/drivers/mn.h and cavs/drivers/timestamp.h: register definitions
  that can only be included from platform/drivers/mn.h and
  platform/drivers/timestamp.h, which no platform has any more;
- cavs/ext_manifest.h: the cAVS configuration extended manifest element,
  which the firmware no longer emits;
- cavs/lib/power_down.h and cavs/mem_window.h: prototypes of functions
  that SOF does not define (Zephyr owns the cAVS power down and the
  memory windows);
- auth/intel_status_logger_api.h: inline wrappers around the status
  logger callbacks, which nothing calls.

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 i.MX8, i.MX8M and i.MX8ULP platforms have copies of the Xtensa core
configuration headers in include/arch/xtensa/config/, and ACP 7.x has a
copy of xtensa/tie/xt_datacache.h in include/arch/. None of these
platforms adds include/arch to the include path, so the copies are never
used: the core configuration comes from hal_xtensa. Remove them.

The ACP 6.0 and ACP 7.0 copies are kept: those platforms add include/arch
to the include path, so their copies replace the toolchain headers.

No functional change.

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.

2 participants