Repository navigation
Conversation
rtos/idc.h is the IDC driver header: the payload buffers, the driver state, interrupt setup and init. It also has the IDC message format, which user-space code needs to send cross-core component and pipeline messages: the send modes, the message types and fields, struct idc_msg and idc_send_msg(). Because of that, the component API pulls the whole driver header into 14 user-space sources. Move the message format to a new rtos/idc_msg.h, which rtos/idc.h includes, so existing users see no change. The core power-up message stays in rtos/idc.h: its extension is the firmware text address from the platform memory map. The prototypes of idc_cmd_user() and ipc_user_xcore_send(), the user-space LL cross-core path, move too. The host builds have no user/kernel split, so their rtos/idc_msg.h just includes rtos/idc.h. No functional change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
zephyr_ll_user_heap() returns the address of the user-space LL heap, and user-space code passes it to the heap system calls. It is declared in ll_schedule_domain.h with the LL domain internals, which include the platform clock headers and the memory map. Move the declaration to the user-space LL section of ll_schedule.h, next to the user LL lock helpers. ll_schedule_domain.h includes ll_schedule.h, so its users still see it. No functional change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
component_ext.h includes the IDC driver header, rtos/idc.h, for the cross-core component helpers, and ll_schedule_domain.h for zephyr_ll_user_heap(). Both pull kernel-only headers into every user-space source that uses the component API: rtos/idc.h, and through ll_schedule_domain.h the platform clock headers and the memory map. Include rtos/idc_msg.h, which has all that the helpers use, and ll_schedule.h, which now declares zephyr_ll_user_heap(). 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 user-space halves of ipc-common.c and notifier.c send IDC messages, and ipc-common.c runs forwarded component messages with idc_cmd_user() in the user-space LL build. They use nothing else from the IDC driver header. 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 builds declare heap_trace_all() in rtos/alloc.h, but the host builds declare it in sof/lib/mm_heap.h, so user-space code that calls it needs the heap header there. Declare it in the host rtos/alloc.h too, so both builds get it from the same header. No functional change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Remove 32 includes of kernel-only headers that user-space sources in src/audio, src/ipc, src/lib and src/schedule do not use: the platform memory map, sof/platform.h, the mailbox, interrupt, clock, IDC, PM runtime, heap, IPC driver, LLEXT manager and user-space helper headers. Each source was compiled without the include in every configuration that builds it, and none of them uses anything that the header declares. No functional change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
ll_schedule_domain.h does not use sof/lib/memory.h, the platform memory map. Drop the include, so that the user-space scheduler and IPC sources that include the LL domain header no longer get it. zephyr/lib/alloc.c uses the memory map and got it through this header, so include it there. No functional change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
dai-zephyr.h uses neither the platform memory map nor the register access helpers of sof/lib/io.h. Drop both includes, which reached the DAI, copier and pipeline sources that use the DAI API. 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_uaol.h only needs the __cold attribute from sof/lib/memory.h. Include sof/lib/cold.h, which defines it, instead of the platform memory map. 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 IPC4 DMIC configuration blob definitions in ipc4/dmic.h do not use the DMIC driver header, which only kernel code may include. 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>
module_adapter_ipc3.c and pipeline-params.c no longer include kernel-only headers in any configuration, so remove them from the leak baseline. With them listed, a new leak in either source would not be caught. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the IDC interface separation and header-dependency cleanup.
No open issues 🎉
What changed in this PR
This PR advances SOF’s kernel/user-space partitioning by separating IDC message definitions from driver internals and reducing kernel-only header dependencies. It builds on the include-checker enforcement in #11464, with no intended functional changes.
Changes:
- Introduces a user-facing IDC message header and switches component, IPC, and notifier code to narrower headers.
- Relocates heap declarations and removes unused kernel-only includes.
- Removes two clean sources from the include-leak baseline.
| File | Description |
|---|---|
zephyr/lib/alloc.c |
Adds the memory header directly. |
zephyr/include/rtos/idc.h |
Delegates message definitions to the new header. |
zephyr/include/rtos/idc_msg.h |
Defines the user-facing IDC message interface. |
src/schedule/zephyr_ll.c |
Removes an unused memory include. |
src/schedule/zephyr_dp_schedule.c |
Removes unused kernel-only includes. |
src/schedule/zephyr_dp_schedule_thread.c |
Removes the unused userspace-helper include. |
src/schedule/zephyr_dp_schedule_application.c |
Removes unused kernel-only includes. |
src/lib/notifier.c |
Uses the IDC message header; drops the interrupt include. |
src/lib/dma.c |
Removes an unused memory include. |
src/lib/dai.c |
Removes an unused memory include. |
src/ipc/ipc4/helper.c |
Removes an unused memory include. |
src/ipc/ipc4/handler-user.c |
Removes unused kernel-only includes. |
src/ipc/ipc4/dai.c |
Removes unused IDC-driver and memory includes. |
src/ipc/ipc-helper.c |
Removes unused kernel-only includes. |
src/ipc/ipc-common.c |
Uses the IDC message header and removes unused includes. |
src/include/sof/schedule/ll_schedule.h |
Adds the user-space LL heap declaration. |
src/include/sof/schedule/ll_schedule_domain.h |
Drops the memory include and relocated heap declaration. |
src/include/sof/lib/dai-zephyr.h |
Removes unused I/O and memory includes. |
src/include/sof/audio/intel_uaol.h |
Includes the specific header for __cold. |
src/include/sof/audio/component_ext.h |
Uses narrower IDC and LL scheduling headers. |
src/include/ipc4/dmic.h |
Removes the unused DMIC driver include. |
src/audio/pipeline/pipeline-graph.c |
Removes the heap-internals include. |
src/audio/module_adapter/module_adapter_ipc3.c |
Removes the unused interrupt include. |
src/audio/kpb.c |
Removes unused clock and platform includes. |
src/audio/copier/copier_ipcgtw.c |
Removes an unused memory include. |
src/audio/chain_dma.c |
Removes an unused memory include. |
scripts/kernel_user_partition.txt |
Removes two sources from the leak baseline. |
posix/include/sof/lib/mm_heap.h |
Removes the relocated heap-tracing declaration. |
posix/include/rtos/idc_msg.h |
Provides a host-compatible IDC header wrapper. |
posix/include/rtos/alloc.h |
Declares heap_trace_all() in the allocation interface. |
Review effort: Balanced
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.
Phase 4 of #11306 (kernel / user-space partition), second part: remove kernel-only includes from user-space code that only come from header untangling, and shrink the leak baseline that #11464 added.
What changes
rtos/idc.his the IDC driver header, but it also has the message format that user-space code needs to send cross-core component and pipeline messages. The message format moves to a newrtos/idc_msg.h, whichrtos/idc.hincludes.component_ext.hincludedrtos/idc.handll_schedule_domain.h(forzephyr_ll_user_heap()), and through them the platform clock headers and the memory map.ll_schedule_domain.h,dai-zephyr.h,intel_uaol.handipc4/dmic.hdrop includes of the memory map,sof/lib/io.hand the DMIC driver header that they did not need.In the CI configurations, five kernel-only headers no longer reach any user-space source:
rtos/idc.h,sof/ipc/driver.h,sof/llext_manager.h,sof/drivers/dmic.handsof/lib/mm_heap.h. They can move tosrc/kernel/includein a later part. Overall, the (user-space source, kernel-only header) pairs go from 854 to 686, and two sources leave the baseline.Patches
rtos: idc: move the message format tortos/idc_msg.h:struct idc_msgandidc_send_msg();idc_cmd_user()andipc_user_xcore_send().The core power-up message stays in
rtos/idc.h: its extension is the firmware text address from the platform memory map. The host builds have no user/kernel split, so theirrtos/idc_msg.hjust includesrtos/idc.h.schedule: declarezephyr_ll_user_heap()in the user-space LL section ofll_schedule.h. It returns the address of the user-space LL heap, which user-space code passes to the heap system calls.ll_schedule_domain.hincludesll_schedule.h, so its users still see it.audio: component_ext: includertos/idc_msg.handll_schedule.hinstead ofrtos/idc.handll_schedule_domain.h.ipc, notifier: the user-space halves ofipc-common.candnotifier.cincludertos/idc_msg.hinstead ofrtos/idc.h.posix: declareheap_trace_all()in the hostrtos/alloc.h, where the Zephyr builds declare it. The host builds only declared it insof/lib/mm_heap.h, which the pipeline code would otherwise have to keep including.Unused includes: remove 32 unused kernel-only includes from user-space sources in
src/audio,src/ipc,src/libandsrc/schedule.rtos/interrupt.hforirq_local_disable().schedule: ll_schedule_domain: drop the memory map.zephyr/lib/alloc.cused the memory map through this header, so it now includes it directly.lib: dai-zephyr: drop the memory map andsof/lib/io.h.audio: intel_uaol: includesof/lib/cold.h, for__cold, instead of the memory map.ipc4: dmic: drop the DMIC driver header.Baseline: remove the two sources that are now clean.
What is left
Most remaining leaks are not unused includes but uses of kernel APIs from user-space code. Next parts:
sof/lib/dma.h: split into a user part (scatter-gather structures, buffer copy,sof_dma_*system calls) and a kernel part. Through it,zephyr/drivers/dma.h,sof/lib/io.hand the memory map reach 13 sources.mailbox_sw_regs_write(),mailbox_stream_write()) and the mailbox layout constants, used by the copier, volume, DAI, host, pipeline and IPC code (13 sources).irq_local_disable()/irq_local_enable()in the copier, DAI, pipeline, IPC and LL scheduler code, and the platform timestamp functions fromrtos/timer.h.domain_init()inll_schedule_domain.h: a kernel-only inline that needsrtos/clk.h.idc_cmd_user()and the IDC component handlers that it calls run in the user-space IPC thread, but they live insrc/kernel/idc/idc.c. This is added to the Phase 5 list in [FEATURE] Partition SOF into DSP kernel and userspace source/include trees #11306.Functional change
None.
Testing
--strict, it passes for each of the 12 CI build configurations, built locally as CI does (repro-build.conf,-Werror), and for every other configuration below. Across all of them, exactly the 39 baseline sources leak.CONFIG_SOF_USERSPACE_PROXY=n;os_linux_overlay.conf;llext_relocatable.conf;app/debug_stream_overlay.conf, and PTL with that overlay and user-space LL.SYS_INIT()order), and the per-function disassembly. No object changes at any commit. The only image difference issof_init()on imx8m_cm7, imx93 and imx95, which embeds the git hash.All of the above was run on a4ce5dd (current main).
🤖 Generated with Claude Code