Repository navigation
Conversation
Phase 4 of the kernel / user-space partition moves the kernel-only headers to src/kernel/include/sof/kernel, included as <sof/kernel/...>, so that kernel-only includes are visible in the source and the headers can later be kept off the user-space include path. Add the directory to the include path of the firmware (the SOF interface library that sof_kernel and modules_sof use, so not the LLEXT modules), of the host library, of the testbench and the topology parser, and of the ZTest unit tests that build kernel sources. The include checker treats everything below it as kernel-only. The headers move in the following commits. No functional change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Liam Girdwood <[email protected]>
sof/platform.h declares the platform init, boot and context save functions and includes the platform definitions. Only kernel code includes it. Move it to src/kernel/include and include it as <sof/kernel/platform.h>, and update the platform headers that name it in their include guard errors. No functional change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Liam Girdwood <[email protected]>
sof/ipc/driver.h is the interface between the IPC core and the platform IPC driver: message transmit and receive, the IPC task and the host page tables. Only kernel code, and the host testbench and unit tests built with the kernel code, include it. Move it to src/kernel/include and include it as <sof/kernel/ipc/driver.h>. No functional change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Liam Girdwood <[email protected]>
sof/llext_manager.h declares the LLEXT loader and its dependency handling, which only the kernel library manager code uses. Move it to src/kernel/include and include it as <sof/kernel/llext_manager.h>. No functional change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Liam Girdwood <[email protected]>
The headers in sof/drivers describe the AMD, MediaTek and i.MX DAI and DMA drivers, the i.MX messaging unit, the SSP and the interrupt map. Only kernel code includes them. Move them to src/kernel/include and include them as <sof/kernel/drivers/...>, and update the code owner entries. dmic.h and pmc.h are not used anymore and stay for now. No functional change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Liam Girdwood <[email protected]>
sof/lib/regions_mm.h (the virtual memory heaps) and sof/lib/vpage.h (the virtual page allocator) are the interfaces of kernel memory management code. Only kernel code and its tests include them. Move them to src/kernel/include and include them as <sof/kernel/lib/regions_mm.h> and <sof/kernel/lib/vpage.h>. No functional change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Liam Girdwood <[email protected]>
Nothing includes sof/drivers/dmic.h, the definitions of the removed SOF DMIC driver, or sof/drivers/pmc.h and the host platform pmc.h that it wraps. Remove them, with their code owner and include checker entries, instead of moving them to the kernel headers. No functional change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Liam Girdwood <[email protected]>
src/debug/panic.c is the XTOS panic handler. Its build rules went with the XTOS support in commit e68dfe9 ("build: remove XTOS-specific sections from cmake lists"), and the host library has its own panic.c, so nothing builds it. Remove it. No functional change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Liam Girdwood <[email protected]>
The DMA single and multi channel and the Zephyr DMA LL scheduling domains, and the XTOS LL scheduler that ACP 6.0 still builds, set up interrupts and timers and include sof/kernel/platform.h. Like the legacy host and DAI drivers, they are kernel code that goes when the remaining platforms move to the Zephyr native drivers. Classify them as kernel sources. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Liam Girdwood <[email protected]>
The kernel-only headers are moving to src/kernel/include, included as <sof/kernel/...>. Add a --sources mode that checks the source tree, without build directories, for such includes in user-space sources and in the user-space headers listed in the new [user-headers] manifest section: src/include and src/platform, apart from the kernel-only headers that are still there. This is the "no <sof/kernel/ in user-space code" rule of thesofproject#11306. It also covers code that no checked build configuration compiles, and there is nothing to baseline: no user-space code includes them today. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Liam Girdwood <[email protected]>
Run the include checker on the source tree in the codestyle workflow, so that a pull request that includes a header from src/kernel/include in user-space code fails without waiting for the firmware builds, and also when no CI configuration compiles the file. Describe it in the src/kernel README. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Liam Girdwood <[email protected]>
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), seventh part: enforce the "no
<sof/kernel/...>in user-space code" rule on the source tree, as the issue plans ("add a checkpatch rule against<sof/kernel/in user dirs"). SOF's CI does not run checkpatch, so this is a mode of the include checker that runs in thecodestyleworkflow instead.Based on #11487. Only the last four commits are new.
Why
The build-based include check (#11464) only sees what the CI configurations compile. Since #11487, kernel-only headers in
src/kernel/includeare included as<sof/kernel/...>, so a kernel-only include is visible in the source. That makes a source-tree check cheap and exact:Patches
debug: removesrc/debug/panic.c, the XTOS panic handler. Nothing builds it since the XTOS build rules were removed in e68dfe9, and the host library has its ownpanic.c. The source check found it, because it includes<sof/kernel/platform.h>.scripts: kernel_user_partition: classify the legacy LL scheduling domains (DMA single and multi channel, the Zephyr DMA domain, and the XTOS LL scheduler that ACP 6.0 still builds) as kernel sources.<sof/kernel/platform.h>.scripts: check_kernel_includes: add a--sourcesmode, which checks the source tree for<sof/kernel/...>includes.[user-headers]manifest section (src/includeandsrc/platform, apart from the kernel-only headers still there).--strictfails when one is added.ci: codestyle: runcheck_kernel_includes.py --sources --strictin a newkernel-includesjob, and describe it in thesrc/kernelREADME.Install rules
The issue's item "install rules install only the user include set" needs no change. Only the host library installs headers: it installs the
sof_public_headersinclude directories, and #11487 putsrc/kernel/includeonsof_optionsinstead. So the kernel-only headers are not installed. The host platform headers still are, but the host build is not partitioned, and its users, the testbench and plugin, need them.Functional change
None.
Testing
<sof/kernel/...>include added to a user-space source (volume.c) and to a user-space header (component.h), it reports both and fails.--strict, it still passes for the 12 CI build configurations and the other configurations below, with the same 16 baseline sources.codestyle.ymlpassesyamllintwith the workflow's settings.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 #11487, on afa3820 (main).
🤖 Generated with Claude Code