Skip to content

dma: dma_sg: allocate on specific heap#10729

Open
kv2019i wants to merge 1 commit intothesofproject:mainfrom
kv2019i:202604-dai-zephyr-userll
Open

dma: dma_sg: allocate on specific heap#10729
kv2019i wants to merge 1 commit intothesofproject:mainfrom
kv2019i:202604-dai-zephyr-userll

Conversation

@kv2019i
Copy link
Copy Markdown
Collaborator

@kv2019i kv2019i commented Apr 28, 2026

Add a heap parameter to DMA scatter-gather allocation interface. This makes it possible to control how allocations are done for the DMA buffers.

Add a heap parameter to DMA scatter-gather allocation interface. This
makes it possible to control how allocations are done for the DMA
buffers.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Copilot AI review requested due to automatic review settings April 28, 2026 09:24
@kv2019i kv2019i requested a review from jsarha April 28, 2026 09:24
@kv2019i
Copy link
Copy Markdown
Collaborator Author

kv2019i commented Apr 28, 2026

For context, this is part of #10558

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 extends the DMA scatter-gather (SG) allocation/free interface to accept an explicit Zephyr heap pointer, enabling callers to control which heap backs SG element allocations.

Changes:

  • Add struct k_heap *heap parameter to dma_sg_alloc() / dma_sg_free() declarations and definitions.
  • Switch SG element allocation/free to sof_heap_alloc() / sof_heap_free() and explicitly zero-initialize the allocated element array.
  • Update all current call sites to pass NULL for the heap (default heap behavior).

Reviewed changes

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

Show a summary per file
File Description
zephyr/include/sof/lib/dma.h Updates SG API prototypes to include a heap parameter.
posix/include/sof/lib/dma.h Mirrors the SG API prototype changes for the POSIX build.
src/lib/dma.c Implements heap-aware SG allocation/free using sof_heap_alloc/free and adds explicit zeroing.
src/trace/dma-trace.c Adjusts SG free call to pass NULL heap.
src/probe/probe.c Adjusts SG alloc/free calls to pass NULL heap.
src/ipc/ipc3/host-page-table.c Adjusts SG free call to pass NULL heap on error path.
src/ipc/ipc3/handler.c Adjusts SG free call to pass NULL heap on error path.
src/audio/host-zephyr.c Adjusts SG alloc/free calls to pass NULL heap.
src/audio/host-legacy.c Adjusts SG alloc/free calls to pass NULL heap.
src/audio/dai-zephyr.c Adjusts SG alloc/free calls to pass NULL heap.
src/audio/dai-legacy.c Adjusts SG alloc/free calls to pass NULL heap.

Comment thread src/lib/dma.c
Comment thread src/lib/dma.c
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