-
Notifications
You must be signed in to change notification settings - Fork 349
audio: copier: Use module API also for allocating non cached memory #10371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
audio: copier: Use module API also for allocating non cached memory #10371
Conversation
There was a problem hiding this 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 refactors memory allocation in the audio copier module to consistently use the module API (mod_alloc_ext and mod_free) instead of direct allocation functions (rzalloc and rfree), particularly for DMA buffer allocation. This change follows the extension of the module API to support allocation flags, enabling unified memory management through the module interface.
Key changes:
- Replaced
rzalloccalls withmod_alloc_extfor coherent memory allocation - Replaced
rfreecalls withmod_freefor memory deallocation - Updated function signatures to accept
processing_moduleinstead of component-specific data structures - Added explicit
memsetcalls after allocation to replacerzalloc's zero-initialization
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 |
|---|---|
| src/include/sof/audio/module_adapter/module/generic.h | Reverted mod_alloc_align to use SOF_MEM_FLAG_USER flag instead of 0 |
| src/audio/copier/dai_copier.h | Updated copier_dai_free signature to accept processing_module parameter |
| src/audio/copier/copier_host.c | Converted FPI sync group allocation/deallocation to use module API |
| src/audio/copier/copier_dai.c | Converted DAI data and gain data allocation/deallocation to use module API |
| src/audio/copier/copier.c | Updated copier_dai_free call to pass mod instead of cd |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
31308b5 to
2e258ce
Compare
| { | ||
| struct fpi_sync_group *group = find_group_by_id(hd->group_id); | ||
| struct copier_data *cd = module_get_private_data(mod); | ||
| struct fpi_sync_group *group = find_group_by_id(cd->hd->group_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't see a reason to change this function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to pass in the module now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lgirdwood why? I don't see where it's needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @lyakh, there is indeed a bug. Not the unnecessary change, but unconverted rfree.
| { | ||
| struct fpi_sync_group *group = find_group_by_id(hd->group_id); | ||
| struct copier_data *cd = module_get_private_data(mod); | ||
| struct fpi_sync_group *group = find_group_by_id(cd->hd->group_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to pass in the module now
The module API was extended to pass flags the allocation back-end [1]. With this change there is no reason not use module API also to allocate the DMA buffers. [1] 1d170fc module: add an allocation function with flags Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
2e258ce to
259c4a2
Compare
| struct pipeline *pipeline); | ||
|
|
||
| void copier_dai_free(struct copier_data *cd); | ||
| void copier_dai_free(struct processing_module *mod); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: no need to change unless you have to submit a new version (e.g. there's currently a QB failure for this PR), but if you do need to update - maybe better use struct comp_dev *dev as a parameter here to match copier_dai_create()
The module API was extended to pass flags the allocation back-end [1]. With this change there is no reason not use module API also to allocate the DMA buffers.
[1] 1d170fc module: add an allocation function with flags