Repository navigation
platform: remove unused platform macros and inline functions - #11532
Merged
lgirdwood merged 8 commits intoNov 25, 2026
Merged
Conversation
Nothing uses these platform.h macros any more: - the DMA trace settings DMA_TRACE_LOCAL_SIZE, DMA_FLUSH_TRACE_SIZE, DMA_TRACE_PERIOD and DMA_TRACE_RESCHEDULE_TIME, since commit 47a032c ("trace: remove the SOF DMA trace"); - PLATFORM_SCHEDULE_IRQ, PLATFORM_SCHEDULE_IRQ_NAME and PLATFORM_IPC_INTERRUPT_NAME, which the XTOS scheduler and interrupt code used; - PLATFORM_DEFAULT_DELAY, since the delays use k_busy_wait(); - LPSRAM_SIZE on i.MX, PLATFORM_IPC_DMA_TIMEOUT in the host library and PLATFORM_CORE_COUNT on qemu_xtensa. 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>
These memory.h macros described the XTOS firmware image and heap layout: - the IRAM, vector, reset and literal sizes (IRAM_*, SOF_MEM_*, SOF_DYNAMIC_VECTORS_SIZE, ROM_RESET_*) and the UUID, log and extended manifest ELF sections (*_ENTRY_ELF_*, EXT_MANIFEST_ELF_*), which the XTOS linker scripts used until commit f6add88 ("platform: remove the XTOS linker scripts"); - the Tiger Lake XTOS boot loader layout (IMR_BOOT_LDR_* except the manifest base, BOOT_LDR_STACK_*), the LP SRAM stack (SOF_LP_STACK_*), SOF_FW_MAX_SIZE and SOF_TEXT_BASE; - the XTOS heap allocator settings: HEAP_BUF_ALIGNMENT, HEAP_BUFFER_COUNT, HEAP_HP_BUFFER_BLOCK_SIZE/COUNT, the host library LP heaps (HEAP_RT_LP_*, HEAP_LP_SYSTEM_*, HEAP_LP_RUNTIME_*, SOF_LP_DATA_SIZE) and SOF_CORE_S_T_SIZE; - the EDF task stack size PLATFORM_TASK_DEFAULT_STACK_SIZE, which no scheduler reads, and ARCH_OOPS_SIZE. Zephyr lays out the image and the heaps, so nothing uses them. 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 memory.h still has the XTOS-era register map: the shim, DMIC shim, codec command, resource, intra-DSP IPC, host window, IRQ controller, time stamping, M/N divider, GPDMA, link and host gateway, code loader, L2 TLB, DMIC, SSP, ALH, ROM and L1 cache control blocks, and the HP SRAM window bases. The Zephyr intel_adsp SoC and drivers own all of these, and SOF does not use any of them. Remove them, and the sideband IPC register fields other than the DIPCIDR ones that the firmware still uses. 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.MX memory.h headers still have the base addresses and sizes of the EDMA, SDMA, ESAI, SAI and MICFIL blocks. The Zephyr NXP drivers take these from the devicetree, and SOF does not use them. 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 uses these AMD platform macros: - the IRQ_MASK_* values and the XTSTR() helper in drivers/interrupt.h; - the SoundWire, BT and HS FIFO offsets that are not used by the DMA drivers, and on ACP 7.x the DAI DMA register bases; - the SoundWire channel and DAI index values in lib/dai.h; - MP1_APERTURE_ID in lib/clk.h. Remove them. The register maps in chip_offset_byte.h and platform_misc.h are left complete. 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 library and posix platforms copied macros from the Intel platforms that the host builds never use: all the interrupt numbers and masks (only the AMD interrupt driver uses IRQ_NUM_SOFTWARE0 and IRQ_NUM_TIMER1, from its own platform header), the DAI_NUM_* link counts and SSP_DEFAULT_IDX. 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 calls these platform functions: - platform_panic(): the Zephyr panic path does not call a platform hook. With it go ACP_SOF_FW_STATUS and SRAM_REG_FW_STATUS, which only it used; - platform_rfree_prepare(), an XTOS allocator hook; - mailbox_sw_reg_write64(); - arch_get_stack_entry() and arch_get_stack_size() in the host library; - the IDC idc_process_msg_queue() and idc_restore() stubs in the host library; - acp_dsp_sw_intr_disable() in the Rembrandt interrupt driver, and its declarations. Remove them, and the i.MX8 and i.MX8M comment for the platform_shared_commit() that was already removed. 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 library platform/lib/pm_runtime.h only has empty platform_pm_runtime_*() stubs, and nothing calls them: the host pm_runtime_*() functions do not call into the platform. Remove the header and its include in posix/include/sof/lib/pm_runtime.h, which now includes <stdbool.h> itself for bool. 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
marked this pull request as ready for review
November 24, 2026 14:46
lgirdwood
requested review from
bhiregoudar,
dbaluta,
kv2019i,
lbetlej,
mmaka1,
plbossart and
sunilkumardommati
as code owners
November 24, 2026 14:46
PR 11532: test resultsRun date: 2026-11-25 13:20 UTC Tested commit: d5e8feaf1c27ba7876019db7a3e54f2c945c8b78 |
Member
Author
|
CI unrelated as we are not building xtos anymore. |
This was referenced Nov 25, 2026
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 macros, inline functions and prototypes in the platform headers that nothing uses: about 535 macro definitions and 15 functions, 1,206 lines. This is the third part of the platform header cleanup in #11517 step 1, after #11528 and #11529.
Patches
platform: remove unused macros from the platform headers.DMA_TRACE_*/DMA_FLUSH_TRACE_SIZEsettings, unused since 47a032c.PLATFORM_SCHEDULE_IRQ(_NAME)andPLATFORM_IPC_INTERRUPT_NAME.PLATFORM_DEFAULT_DELAY, and a few platform-specific leftovers.platform: remove the XTOS memory layout macros.platform: intel: remove the unused cAVS register definitions. The XTOS-era register map in the Tiger Lakememory.h(shim, GPDMA, gateways, DMIC, SSP, ALH, ROM, L1 cache control, ...), which Zephyr'sintel_adspowns, and the unused sideband IPC fields.platform: imx: remove unused peripheral base addresses. EDMA, SDMA, ESAI, SAI and MICFIL, which the Zephyr NXP drivers take from the devicetree.platform: amd: remove unused macros.XTSTR().MP1_APERTURE_ID.platform: library, posix: remove unused host platform macros. These were copied from the Intel platforms and never used by the host builds.platform: remove unused inline functions and prototypes.platform_panic(), plus the two status offsets only it used.platform_rfree_prepare().mailbox_sw_reg_write64().arch_get_stack_*()and IDC stubs.acp_dsp_sw_intr_disable().platform: library: remove the PM runtime stubs. The hostplatform/lib/pm_runtime.honly had emptyplatform_pm_runtime_*()stubs that nothing calls.What was kept on purpose
The candidates came from a static scan of the whole repository, which also follows macros that are only used by other unused macros. A
#ifndef Xfallback in another file counts as a use ofX. Not removed:chip_offset_byte.handplatform_misc.h, and theDMA_ID_*lists. Removing single entries there makes the register documentation patchy without simplifying anything. These headers go with the native-driver moves in [FEATURE] Remove the remaining XTOS-era code and move SOF to native Zephyr APIs and drivers #11517._SIZE/_BASEpartner of a macro that is still used, for exampleMAILBOX_TRACE_BASEnext toMAILBOX_TRACE_SIZE.drivers/interrupt.hheaders. On Zephyr only the AMD legacy interrupt path includes this header name, so the next part removes the i.MX copies as whole files.core-isa.h/specreg.hcopies, and the MediaTek window sizes, which are built by token pasting.posix_dai_init()insrc/kernel/platform/posix/dai.c: it has no caller, but it is the only user of that file's DAI tables, so removing it means removing the legacy posix DAI file. That is a separate change.Functional change
None.
Testing
Run on 4c0f7b5 (current main), at every commit and at the tip.
Firmware, every commit, incremental builds of 37 configurations:
internal_ci_overlay.conf) of tgl, mtl, lnl and ptl;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, because removing header lines only shifts line numbers in the debug info. The only differing objects are the ones that embed the source hash or git version (
init.c,ext_manifest.c, eachplatform.c, the final images), plus the acp_6_0interrupt.cfrom patch 7, which removesacp_dsp_sw_intr_disable().Firmware, tip: a pristine build of the same matrix. Same result: only the version-bearing objects differ, all LLEXT modules are identical, the SOF header dependencies (
ninja -t deps) are unchanged, and the legacy error sets are unchanged.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.
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