dma: dma_sg: allocate on specific heap#10729
dma: dma_sg: allocate on specific heap#10729kv2019i wants to merge 1 commit intothesofproject:mainfrom
Conversation
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>
|
For context, this is part of #10558 |
There was a problem hiding this comment.
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 *heapparameter todma_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
NULLfor 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. |
|
@lyakh @jsarha @lgirdwood ping? |
|
@kv2019i so, now that we've merged vregions for modules - which heap would these dma_sg allocations be done on? If you meant to allocate them on module heap, then I think now you need to pass a |
@kv2019i if needed dont mind if you want to do this incrementally. |
|
I think @lyakh and @lgirdwood we could do this incrementally. The users of this interface (DAI and host code) is not yet converted to use vregions (e.g. create_local_elems() in host-zephyr.c). So I cannot immediately convert this PR to vregions yet. |
|
Moving to draft until next rebase of #10558 (to see how move to vregions changes, or does not change, this PR). |
Add a heap parameter to DMA scatter-gather allocation interface. This makes it possible to control how allocations are done for the DMA buffers.