Skip to content

audio: host-zephyr: make component usable from user-space - #10799

Merged
kv2019i merged 1 commit into
thesofproject:mainfrom
kv2019i:202605-host-zephyr-user
May 25, 2026
Merged

audio: host-zephyr: make component usable from user-space#10799
kv2019i merged 1 commit into
thesofproject:mainfrom
kv2019i:202605-host-zephyr-user

Conversation

@kv2019i

Copy link
Copy Markdown
Collaborator

Ensure an allocation context object is passed correctly whenever memory is allocated in the component. This allows to run the component both in kernel and user space.

CopilotAI review requested due to automatic review settings May 21, 2026 10:02
@kv2019i

Copy link
Copy Markdown
CollaboratorAuthor

For context, part of #10558

CopilotAI 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

Note

Copilot was unable to run its full agentic suite in this review.

This PR updates the Zephyr host audio component to consistently pass an allocation context/heap into memory allocation APIs, enabling the component to run correctly in both kernel and user-space.

Changes:

  • Add alloc_ctx to struct host_data to carry allocation context information.
  • Use hd->alloc_ctx.heap when allocating/freeing DMA scatter-gather elements and DMA-related configs.
  • Initialize hd->alloc_ctx.heap for user-space low-latency builds via zephyr_ll_user_heap().

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

FileDescription
src/audio/host-zephyr.cRoutes allocations/frees through hd->alloc_ctx.heap and sets user-space heap under CONFIG_SOF_USERSPACE_LL.
src/audio/copier/host_copier.hAdds struct mod_alloc_ctx alloc_ctx to struct host_data.

Comment threadsrc/audio/host-zephyr.c Outdated
Comment threadsrc/audio/host-zephyr.c Outdated
Comment threadsrc/audio/host-zephyr.c
@kv2019i
kv2019i requested review from jsarha and lyakhMay 21, 2026 13:37
Ensure an allocation context object is passed correctly whenever memory
is allocated in the component. This allows to run the component both in
kernel and user space.
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
@kv2019i
kv2019iforce-pushed the 202605-host-zephyr-user branch from d20c1b8 to ade5256CompareMay 21, 2026 14:23
@kv2019i

Copy link
Copy Markdown
CollaboratorAuthor

V2 pushed:

  • address copilot comments, not functional changes to code

dev->ipc_config = *config;

hd = rzalloc(SOF_MEM_FLAG_USER, sizeof(*hd));
hd = sof_heap_alloc(heap, SOF_MEM_FLAG_USER, sizeof(*hd), 0);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'd use NULL here directly just like you do in host_free()

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

@lyakh Same comment as in dai-zephyr.c PR #10801 . Given we need to use same value in two places in this function, I prefer to use a variable and single "NULL". host_free() has a single magic NULL, so that's a bit different.

@kv2019i

Copy link
Copy Markdown
CollaboratorAuthor

Anymore reviews anyone, I'll proceed with merge end-of-day if no new comments.

@kv2019i
kv2019i merged commit 43444b7 into thesofproject:mainMay 25, 2026
43 of 44 checks passed
Sign up for freeto 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.

3 participants

@kv2019i@lyakh