Repository navigation
platform: remove macro copies that only other platforms use - #11537
Merged
lgirdwood merged 5 commits intoNov 25, 2026
Merged
Conversation
The PLATFORM_HEAP_* counts size the heap arrays of the host allocator in posix/include/sof/lib/mm_heap.h, which only the host builds use, with the library platform. The Zephyr allocator does not read them, so the copies in the firmware platform headers 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>
Some platform macros are only used by code that is never built for the platforms that define them: - PLATFORM_DEFAULT_CLOCK on the ACE platforms: only the host build and the AMD drivers read it; - cache_to_uncache_init(): nothing uses it any more; - CLK_DEFAULT_CPU_HZ on i.MX; - the MAILBOX_TRACE_BASE and MAILBOX_TRACE_SIZE aliases on cAVS and ACE. The trace window itself stays in the mailbox layout. 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 Tiger Lake and i.MX memory.h headers still describe parts of the XTOS memory layout that the Zephyr builds do not use: - Tiger Lake: the system, shared and LP heaps, the LP SRAM vectors and code, SOF_FW_BASE and SOF_STACK_TOTAL_SIZE; - i.MX: the DRAM and SDRAM banks, HEAP_SYSTEM_0_BASE, HEAP_BUFFER_BLOCK_SIZE and SOF_STACK_END. The runtime heap sizes that zephyr/lib/alloc.c reads stay, and so do the bases next to sizes that are still used. Remove the rest. 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 host build does not build the clock code or the DMA domain schedulers, so the host library clock frequency table, default clock and DMA controller macros 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>
clk.h checks __PLATFORM_LIB_CLK_H__ but defines __PLATFORM_LIB_CLK_H___, with an extra underscore, so the guard never stops a second inclusion. Define the name it checks. No functional change: the header only has macros that expand the same way each time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
lgirdwood
marked this pull request as ready for review
November 25, 2026 14:01
lgirdwood
requested review from
dbaluta,
kv2019i,
lbetlej,
mmaka1 and
plbossart
as code owners
November 25, 2026 14:01
PR 11537: test resultsRun date: 2026-11-25 14:30 UTC Tested commit: 72788dba1921ecd6f731b847fbd916a68baa9e28 |
Member
Author
|
Dead code removal: CI unrelated. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Remove the platform macro copies that only other platforms' code uses (about 140 definitions, 280 lines), and fix the i.MX93
clk.hinclude guard. This is the fifth part of the platform header cleanup in #11517 step 1, after #11528, #11529, #11532 and #11534.The earlier parts removed macros whose names nothing uses. This part looks at each platform on its own. A definition is dead if nothing that can be built with that platform's headers uses it, even if another platform's code uses the same name. For example, the
PLATFORM_HEAP_*counts are defined in 15 platforms, but only the host allocator reads them, and it uses the host library platform.Patches
platform: remove the heap counts from the firmware platforms.PLATFORM_HEAP_*size the heap arrays of the host allocator inposix/include/sof/lib/mm_heap.h. Removed from the 10 firmware platform headers; the host library platform keeps them.platform: remove macros that only other platforms use.PLATFORM_DEFAULT_CLOCKon the ACE platforms: only the host build and the AMD drivers read it.cache_to_uncache_init().CLK_DEFAULT_CPU_HZon i.MX.MAILBOX_TRACE_*aliases. The trace window itself stays in the mailbox layout.platform: remove the rest of the XTOS memory layouts.zephyr/lib/alloc.creads stay.platform: library: remove unused clock and DMA macros. The host build does not build the clock code or the DMA domain schedulers.platform: imx93_a55: fix theclk.hinclude guard. It checked__PLATFORM_LIB_CLK_H__but defined__PLATFORM_LIB_CLK_H___.How the definitions were found
A definition counts as used if its name appears anywhere in code that can be built with that platform's headers, in any
#ifbranch and under any Kconfig. That code is:Building only some configurations is not enough. For example,
host_to_local()looks unused on Tiger Lake, where the builds are IPC4, but IPC3 code still uses it, so it is kept.AMD and MediaTek are not changed. Those builds fail on main, so the results cannot be checked by building. As in #11532,
_BASE/_SIZEand_START/_ENDpartners of used macros, isolated entries in enumerations, mailbox windows with a used member, and the explicit qemu_xtensa mailbox map are kept.Not in this part
The remaining duplicates are still used:
HOST_PAGE_SIZE(4096 on 15 platforms), the identityhost_to_local()/local_to_host(), and the per-platform mailbox layouts. Merging them into shared defaults would change how each platform states its host-visible layout, so that needs its own discussion.Functional change
None.
Testing
Run on 276f0aa (current main), at every commit and at the tip.
Firmware, every commit, incremental builds of 37 configurations:
llext_relocatable.conf, PTL and TGL withdebug_stream_overlay.conf;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.
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, eachplatform.cand the final images.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.
Testbench and tools (SOF CI docker image): pass, and all 260 objects are identical to main with the debug sections stripped.
Cadence xt-clang (RI-2022.10): MTL, PTL and NVL compile.
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.
🤖 Generated with Claude Code