Skip to content

[Userspace LL] audio: pipeline: enable position reporting for user-space pipelines - #11083

Open
kv2019i wants to merge 1 commit into
thesofproject:mainfrom
kv2019i:202608-userll-pipeline-posn
Open

[Userspace LL] audio: pipeline: enable position reporting for user-space pipelines#11083
kv2019i wants to merge 1 commit into
thesofproject:mainfrom
kv2019i:202608-userll-pipeline-posn

Conversation

@kv2019i

@kv2019i kv2019i commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

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.

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>
Copilot AI lite review requested due to automatic review settings August 11, 2026 13:29
@kv2019i

kv2019i commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator Author

For context, this is part of #10558

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.

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()), before platform_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
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.

2 participants