Skip to content

userspace: doc: document the overall approach how SOF utilizes Zephyr user-space - #11247

Open
kv2019i wants to merge 3 commits into
thesofproject:mainfrom
kv2019i:202609-userll-doc-update
Open

kv2019i wants to merge 3 commits into
thesofproject:mainfrom
kv2019i:202609-userll-doc-update

Conversation

@kv2019i

@kv2019i kv2019i commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

Series of documentation patches to document the overall approach to user-space usage in SOF. This covers the main build options, adds a new central syscalls.h header for documentation and updates agent guardrails for new code.

Moving source files around was considered, but this is not yet done in this PR. As SOF supports multiple approaches: all-kernel (no MMU/MPU), mixed (single audio modules isolated) and app-code-all-in-user, for most source code files, the user/kernel split is not always the same. Starting with a documentation framework seems like the best approach to get started.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Several central architecture claims, file classifications, and syscall signatures do not match the current source and configuration.

Review effort: Balanced
Findings: 9 Medium severity

Open (9)
What changed in this PR

Documents SOF’s Zephyr user/kernel boundary and adds contributor guidance for preserving it.

Changes:

  • Defines execution tiers, userspace configuration, memory partitions, and placement rules.
  • Adds a centralized syscall-boundary index.
  • Adds “Runs in” banners and agent guardrails across subsystems.
File Description
AGENTS.md Adds user/kernel contribution rules.
src/​arch/​README.md Classifies architecture support.
src/​audio/​README.md Describes application-tier audio code.
src/​audio/​module_adapter/​README.md Classifies the module adapter boundary.
src/​drivers/​README.md Documents driver privilege requirements.
src/​idc/​README.md Classifies inter-core communication.
src/​include/​sof/​userspace/​README.md Defines the overall userspace architecture.
src/​include/​sof/​userspace/​syscalls.h Indexes SOF syscalls.
src/​init/​README.md Classifies initialization code.
src/​ipc/​README.md Documents IPC boundary behavior.
src/​ipc/​ipc4/​README.md Documents the IPC4 split.
src/​lib/​README.md Classifies common-library code.
src/​math/​README.md Documents user-safe math routines.
src/​module/​README.md Classifies the module API.
src/​platform/​README.md Classifies platform integration.
src/​schedule/​README.md Documents scheduler execution contexts.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/include/sof/userspace/README.md Outdated
Comment thread src/include/sof/userspace/README.md Outdated
Comment thread src/include/sof/userspace/README.md Outdated
Comment thread src/include/sof/userspace/README.md Outdated
Comment thread src/include/sof/userspace/syscalls.h Outdated
Comment thread src/include/sof/userspace/syscalls.h Outdated
*
* ## DMA
* Declared: sof/lib/sof_dma.h
* Kernel side: zephyr/syscall/sof_dma.c (z_vrfy_) / src/lib/dma.c (z_impl_)
Comment thread src/init/README.md Outdated
Comment on lines +3 to +4
> **Runs in:** Kernel-only — boot and early bring-up run in supervisor context before any user
> thread exists; this code never executes in a user thread. See
Comment thread src/lib/README.md Outdated
Comment on lines +3 to +5
> **Runs in:** Shared library — **with a boundary exception.** Most of this directory
> (`lib.c`, `notifier.c`, `objpool.c`, `clk.c`, `agent.c`, `ams.c`, `cpu-clk-manager.c`) is
> context-agnostic helper code linked into whichever thread calls it and must stay user-safe.
Comment thread src/schedule/README.md Outdated
Comment on lines +4 to +6
> memory-domain setup. It is split internally between kernel-side files (`zephyr_ll.c`,
> `zephyr_domain.c`, `zephyr_dp_schedule_thread.c`) and user-side files (`zephyr_ll_user.c`,
> `zephyr_ll_app.c`, `zephyr_dp_schedule_application.c`), and it hosts the
Comment thread src/include/sof/userspace/README.md
Comment thread src/include/sof/userspace/README.md Outdated
Comment thread src/include/sof/userspace/README.md Outdated
Comment thread src/include/sof/userspace/README.md Outdated
Comment thread src/include/sof/userspace/README.md Outdated
Comment thread src/include/sof/userspace/README.md Outdated
Comment thread src/include/sof/userspace/README.md
Comment thread src/include/sof/userspace/README.md Outdated
Comment thread src/include/sof/userspace/syscalls.h Outdated
SOF audio application logic now runs in Zephyr user-space on userspace
configurations (e.g. Intel PTL with CONFIG_SOF_USERSPACE_LL), but the
source layout gives no indication of which code runs in kernel vs user
context or where the privilege boundary is crossed.

Add a canonical reference under src/include/sof/userspace/ with
README.md documenting the execution model, split between kernel and users
and rules for placing new code.

No functional change; documentation only.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Make the user/kernel split evident at the point of use: each top-level
src/ directory README now opens with a "Runs in:" banner declaring its tier
(kernel-only / boundary / application / shared-library) and linking to the
canonical reference in src/include/sof/userspace/README.md.

Add banners to existing READMEs (schedule, ipc, ipc4, module_adapter,
init, module) and add short new READMEs for directories that lacked one.
lib/ is flagged as shared-library with a boundary exception, since dma.c
and dai.c host syscall implementations.

No functional change; documentation only.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Add a "User/kernel boundary" subsection under Development Standards that
points contributors to src/include/sof/userspace/README.md and states the
requirements for new code: place it in the correct directory tier, cross the
boundary only via a validated syscall, and mark any globals shared with user
threads with a partition marker.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
@kv2019i
kv2019i force-pushed the 202609-userll-doc-update branch from f6f9047 to 961b211 Compare October 7, 2026 06:12
@kv2019i

kv2019i commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator Author

V2 pushed:

  • fixed high prioririy findings in code review
  • dropped the syscalls.h documentation header, let's go with a simpler model

@intel-sofci

Copy link
Copy Markdown

PR 11247: test results

Run date: 2026-10-07 06:43 UTC

Tested commit: 961b21164118005d9a2f7b0683ec387e974d3fad

mtl pass rate lnl pass rate ptl pass rate wcl pass rate nvl pass rate

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.

4 participants