Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ memory-partition markers and Kconfig hierarchy are documented in
moving code, follow it:

* **Place code in the right tier.** OS/HAL/boot/inter-core → a kernel-only directory
(`arch/`, `drivers/`, `idc/`, `init/`, `platform/`, `probe/`, `logging/`, `trace/`); audio
(`kernel/`, which is built into the `sof_kernel` library, and the directories not yet
moved there: `arch/`, `drivers/`, `platform/`, `probe/`, `logging/`, `trace/`); audio
application logic → `audio/`; reusable pure code → a shared-library directory (`lib/`,
`math/`, `module/`) kept free of privileged operations. Each top-level directory's
`README.md` states its tier in a "Runs in:" banner — keep it accurate.
Expand Down
2 changes: 1 addition & 1 deletion src/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ rsource "samples/Kconfig"
rsource "schedule/Kconfig"
rsource "schedule/Kconfig.threads_prio"

rsource "idc/Kconfig"
rsource "kernel/Kconfig"

rsource "ipc/Kconfig"

Expand Down
2 changes: 1 addition & 1 deletion src/audio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ modules in user context.

When adding a component here, keep it inside the application tier: allocate through the module
allocation syscalls (`mod_*`), mark any globals shared with the kernel using the partition
markers, and never call kernel-only subsystems (`drivers/`, `platform/`, `idc/`) directly.
markers, and never call kernel-only subsystems (`drivers/`, `platform/`, `kernel/idc/`) directly.
6 changes: 5 additions & 1 deletion src/include/sof/userspace/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,18 @@ its subdirectories span all tiers.

| Tier | Meaning | Directories |
|------|---------|-------------|
| **Kernel-only** | OS integration, HAL, boot, inter-core. Never executes in a user thread. Must not be reached directly from user code — only via a syscall. | `arch/`, `drivers/`, `idc/`, `init/`, `platform/`, `probe/` *, `logging/` *, `trace/` * |
| **Kernel-only** | OS integration, HAL, boot, inter-core. Never executes in a user thread. Must not be reached directly from user code — only via a syscall. | `kernel/` (`kernel/idc/`, `kernel/init/`), `arch/`, `drivers/`, `platform/`, `probe/` *, `logging/` *, `trace/` * |
| **Boundary / bridge** | Owns the syscalls and the thread / memory-domain setup. Split internally: some translation units run kernel-side, some user-side (e.g. `handler-kernel.c` vs `handler-user.c`, `zephyr_ll.c` vs `zephyr_ll_user.c`). | `schedule/`, `ipc/`, `library_manager/` *, `debug/debug_stream/` *, and (in the Zephyr integration tree) `zephyr/syscall/` |
| **Application** | Audio pipeline / component logic that runs in user threads under userspace configs. | `audio/` |
| **Shared library** | Context-agnostic code linked into whichever context calls it. Must stay "user-safe": no privileged operations (no direct MMIO, no spinlocks held across syscalls, no raw kernel object access) so it is safe when pulled into a user build. | `math/`, `module/` |
| **Mixed** | A directory whose files span more than one tier; see its own README for per-file classification. | `lib/` |

Directories marked * do not yet have a "Runs in:" README banner.

Kernel-only code is being moved under `src/kernel/`, which Zephyr builds into a library of its
own, `sof_kernel`, instead of `modules_sof`. The other kernel-only directories in the table
follow one at a time.

Classification is grep-verifiable — see [Verifying the taxonomy](#verifying-the-taxonomy).

> **`zephyr/syscall/` is the model to grow toward.** The Zephyr integration tree already
Expand Down
1 change: 1 addition & 0 deletions src/kernel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ if(zephyr)
set(ZEPHYR_CURRENT_LIBRARY sof_kernel)
endif()

add_subdirectory(idc)
add_subdirectory(init)
5 changes: 5 additions & 0 deletions src/kernel/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-License-Identifier: BSD-3-Clause

# Code that only runs in kernel mode, see scripts/kernel_user_partition.txt.

rsource "idc/Kconfig"
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/idc/README.md → src/kernel/idc/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Inter-Domain / Inter-Core Communication (`src/idc`)
# Inter-Domain / Inter-Core Communication (`src/kernel/idc`)

> **Runs in:** Kernel-only — cross-core messaging (`idc.c`, `zephyr_idc.c`) runs in supervisor
> context. User-space audio code triggers cross-core work indirectly through higher-level
> subsystems, not by calling IDC directly. See
> [User/kernel split](../include/sof/userspace/README.md).
> [User/kernel split](../../include/sof/userspace/README.md).

This directory implements the mechanism cores use to signal and hand work to each other. It is
part of the OS-integration layer, not the audio application.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ add_subdirectory(../src/math/ math_unused_install/)
# remaining directories (in alphabetical order)
add_subdirectory(../src/audio/ audio_unused_install/)
add_subdirectory(../src/debug/ debug_unused_install/)
add_subdirectory(../src/idc/ idc_unused_install/)
add_subdirectory(../src/ipc/ ipc_unused_install/)
add_subdirectory(../src/kernel/ kernel_unused_install/)
add_subdirectory(../src/lib/ lib_unused_install/)
Expand Down
Loading