Skip to content

Commit 1d75ad5

Browse files
lrgirdwoclaude
andcommitted
docs: lib: describe the kernel parts of dma.c and dai.c
Update the src/lib and user-space READMEs for the split of dma.c and dai.c: their kernel parts, with the kernel halves of the sof_dma_get(), sof_dma_put() and dai_get_device() system calls, are now in src/kernel/lib. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
1 parent 928dd0b commit 1d75ad5

2 files changed

Lines changed: 16 additions & 14 deletions

File tree

‎src/include/sof/userspace/README.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,13 @@ Classification is grep-verifiable — see [Verifying the taxonomy](#verifying-th
9292
> collects the validating half of several syscalls in one place — `zephyr/syscall/alloc.c`,
9393
> `cpu.c`, `vregion.c`, `dai.c`, `sof_dma.c` each hold the `z_vrfy_*` wrappers for their
9494
> subsystem, physically separated from the `z_impl_*` logic (in `zephyr/lib/*.c` and
95-
> `src/lib/*.c`). This is exactly the boundary-tier separation this document promotes; the
95+
> `src/kernel/lib/*.c`). This is exactly the boundary-tier separation this document promotes; the
9696
> migration opportunity is to move the *still-scattered* validators (IPC, module management,
9797
> library manager, scheduling, debug) toward the same convention.
9898
99-
> Borderline cases (e.g. parts of `lib/` that host syscall *implementations* such as `dma.c`
100-
> and `dai.c`) behave as boundary code even though the directory is mostly shared-library. When
101-
> a single directory genuinely mixes tiers, its README states the exception explicitly.
99+
> Mixed files are split: the syscall *implementations* of `lib/dma.c` and `lib/dai.c`, for
100+
> example, are in `kernel/lib/dma-kernel.c` and `dai-kernel.c`. When a single directory
101+
> genuinely mixes tiers, its README states the exception explicitly.
102102
103103
## The boundary is the syscall set
104104

@@ -119,8 +119,8 @@ syscall by subsystem:
119119
| IPC | `ipc_msg_send`, `ipc_msg_list_remove`, `ipc_msg_reply`, `ipc_compound_pre_start`, `ipc_compound_post_start`, `ipc_wait_for_compound_msg`, `send_resource_notif` | `sof/ipc/msg.h`, `sof/ipc/ipc_reply.h`, `ipc4/handler.h`, `ipc4/notification.h` | scattered: `ipc/ipc-common.c`, `kernel/ipc/ipc3/helper.c`, `kernel/ipc/ipc4/handler-kernel.c`, `kernel/ipc/ipc4/notification.c` |
120120
| Heap alloc | `sof_heap_alloc`, `sof_heap_free` | `rtos/alloc.h` | `zephyr/syscall/alloc.c` / `zephyr/lib/alloc.c` |
121121
| Virtual regions | `vregion_create_map`, `vregion_set_interim`, `vregion_get`, `vregion_put`, `vregion_alloc_align`, `vregion_alloc_coherent_align`, `vregion_free` | `sof/lib/vregion.h` | `zephyr/syscall/vregion.c` / `zephyr/lib/vregion.c` |
122-
| DMA | `sof_dma_get`, `sof_dma_put`, `sof_dma_get_attribute`, `sof_dma_request_channel`, `sof_dma_release_channel`, `sof_dma_config`, `sof_dma_start`, `sof_dma_stop`, `sof_dma_get_status`, `sof_dma_reload`, `sof_dma_suspend`, `sof_dma_resume` | `sof/lib/sof_dma.h` | `zephyr/syscall/sof_dma.c` / `lib/dma.c` (get/put); remaining 10 are `static inline z_impl_*` in `sof/lib/sof_dma.h` |
123-
| DAI | `dai_get_device` | `sof/lib/dai-zephyr.h` | `zephyr/syscall/dai.c` / `lib/dai.c` |
122+
| DMA | `sof_dma_get`, `sof_dma_put`, `sof_dma_get_attribute`, `sof_dma_request_channel`, `sof_dma_release_channel`, `sof_dma_config`, `sof_dma_start`, `sof_dma_stop`, `sof_dma_get_status`, `sof_dma_reload`, `sof_dma_suspend`, `sof_dma_resume` | `sof/lib/sof_dma.h` | `zephyr/syscall/sof_dma.c` / `kernel/lib/dma-kernel.c` (get/put); remaining 10 are `static inline z_impl_*` in `sof/lib/sof_dma.h` |
123+
| DAI | `dai_get_device` | `sof/lib/dai-zephyr.h` | `zephyr/syscall/dai.c` / `kernel/lib/dai-kernel.c` |
124124
| CPU | `cpu_get_id` | `sof/lib/cpu.h` | `zephyr/syscall/cpu.c` / `zephyr/lib/cpu.c` |
125125
| Module management | `mod_balloc_align`, `mod_alloc_ext`, `mod_free`, `mod_free_all`, `mod_data_blob_handler_new`, `mod_data_blob_set`, `mod_fast_get` | `sof/audio/module_adapter/module/generic.h` | scattered: `audio/module_adapter/module/generic.c` |
126126
| Library manager | `lib_manager_free_module` | `sof/lib_manager.h` | scattered: `kernel/library_manager/lib_manager.c` |

‎src/lib/README.md‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
# Common Library (`src/lib`)
22

3-
> **Runs in:** Mixed — this directory contains code in more than one tier. `dma.c` and `dai.c`
4-
> host the kernel-side implementations (`z_impl_sof_dma_get/put`, `z_impl_dai_get_device`) of
5-
> syscalls whose validators live in `zephyr/syscall/`; treat them as boundary/kernel code.
6-
> `notifier.c` takes Zephyr spinlocks and is similarly restricted to kernel context. The clock,
7-
> KCPS and AMS code (`clk.c`, `cpu-clk-manager.c`, `ams.c`) is kernel-only and lives in
8-
> `src/kernel/lib`. Truly context-agnostic helpers (`lib.c`, `objpool.c`) can safely be linked
9-
> into user builds. See [User/kernel split](../include/sof/userspace/README.md).
3+
> **Runs in:** Mixed — this directory contains code in more than one tier. `dma.c` (the DMA
4+
> buffer helpers) and `dai.c` (the DAI groups) also run in the user-space LL thread. Their
5+
> kernel parts, including the kernel-side implementations (`z_impl_sof_dma_get/put`,
6+
> `z_impl_dai_get_device`) of syscalls whose validators live in `zephyr/syscall/`, are in
7+
> `src/kernel/lib/dma-kernel.c` and `dai-kernel.c`. `notifier.c` takes Zephyr spinlocks and is
8+
> restricted to kernel context. The clock, KCPS and AMS code (`clk.c`, `cpu-clk-manager.c`,
9+
> `ams.c`) is kernel-only and lives in `src/kernel/lib`. Truly context-agnostic helpers
10+
> (`lib.c`, `objpool.c`) can safely be linked into user builds. See [User/kernel
11+
> split](../include/sof/userspace/README.md).
1012
1113
This directory collects cross-cutting helpers that don't belong to a single subsystem. When
1214
adding code here, decide first which tier it belongs to: a pure helper (no locks, no
1315
privileged ops), a privileged-kernel helper (spinlocks, platform callbacks), or a syscall
1416
implementation (kernel-only, reached from user space through a `z_vrfy_` validator). Keep the
15-
tiers in separate files as `dma.c`/`dai.c` and `lib.c`/`objpool.c` already demonstrate.
17+
tiers in separate files: kernel code goes to `src/kernel/lib`, as for `dma.c` and `dai.c`.

0 commit comments

Comments
 (0)