[Userspace LL] audio: pipeline: enable position reporting for user-space pipelines - #11083
Open
kv2019i wants to merge 1 commit into
Open
[Userspace LL] audio: pipeline: enable position reporting for user-space pipelines#11083kv2019i wants to merge 1 commit into
kv2019i wants to merge 1 commit into
Conversation
Place the pipeline position lookup table in the sysuser memory partition and replace k_spinlock with a dynamically allocated k_mutex when CONFIG_SOF_USERSPACE_LL is enabled. Spinlocks disable interrupts which is a privileged operation unavailable from user-mode threads. The mutex pointer is stored in a separate APP_SYSUSER_BSS variable outside the SHARED_DATA struct so Zephyr's kernel object tracking can recognize it for syscall verification. Move pipeline_posn_init() from task_main_start() to primary_core_init() before platform_init(), so the mutex is allocated before ipc_user_init() grants thread access to it. In pipeline_posn_get(), bypass the sof_get() kernel singleton and access the shared structure directly when running in user-space. Grant the ipc_user_init thread access to the pipeline position mutex via new pipeline_posn_grant_access() helper. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
kv2019i
requested review from
abonislawski,
bardliao,
dbaluta,
iuliana-prodan,
lbetlej,
lgirdwood,
lyakh,
mmaka1,
pblaszko,
plbossart and
tmleman
as code owners
August 11, 2026 13:29
Collaborator
Author
|
For context, this is part of #10558 |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates SOF’s pipeline position reporting to work with Zephyr user-mode LL pipelines by moving the position lookup table into the sysuser memory partition and replacing an interrupt-disabling spinlock with a dynamically allocated mutex when CONFIG_SOF_USERSPACE_LL is enabled.
Changes:
- Move
pipeline_posn_init()earlier in boot (primary_core_init()), beforeplatform_init()triggers user-space IPC initialization. - Add a
pipeline_posn_grant_access()helper and grant the user IPC thread access to the dynamically allocated pipeline position mutex. - Update pipeline position bookkeeping to use a mutex (userspace LL) vs. spinlock (non-userspace), and bypass
sof_get()in user-space for direct access to shared state.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| zephyr/wrapper.c | Removes late pipeline_posn_init() call from task_main_start() after init is moved earlier. |
| src/ipc/ipc-common.c | Grants the user IPC thread access to the pipeline position mutex. |
| src/init/init.c | Initializes pipeline position offsets before platform_init() to ensure the mutex exists before user IPC setup. |
| src/include/sof/audio/pipeline.h | Adds a userspace-LL-only API to grant thread access to the position mutex. |
| src/audio/pipeline/pipeline-graph.c | Moves position table into sysuser partition, replaces spinlock usage with mutex under userspace LL, adds access-grant helper, and adjusts userspace lookup. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+205
to
+209
| #ifndef CONFIG_SOF_USERSPACE_LL | ||
| /* | ||
| * pipe_tr lives in the .trace_ctx section, which is not mapped into | ||
| * the sysuser partition, so it cannot be read from a user-mode thread. | ||
| * The copy is also unnecessary in that configuration: with Zephyr |
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.
Place the pipeline position lookup table in the sysuser memory partition and replace k_spinlock with a dynamically allocated k_mutex when CONFIG_SOF_USERSPACE_LL is enabled. Spinlocks disable interrupts which is a privileged operation unavailable from user-mode threads.
The mutex pointer is stored in a separate APP_SYSUSER_BSS variable outside the SHARED_DATA struct so Zephyr's kernel object tracking can recognize it for syscall verification.
Move pipeline_posn_init() from task_main_start() to primary_core_init() before platform_init(), so the mutex is allocated before ipc_user_init() grants thread access to it.
In pipeline_posn_get(), bypass the sof_get() kernel singleton and access the shared structure directly when running in user-space. Grant the ipc_user_init thread access to the pipeline position mutex via new pipeline_posn_grant_access() helper.