Skip to content

Commit a9c5a1b

Browse files
lyakhlgirdwood
authored andcommitted
module_adapter: mark data buffers as cached
Module adapter code uses struct input_stream_buffer and struct output_stream_buffer to pass generic data to individual modules for processing. Further, modules implementing the .simple_copy option pass a cached pointer to struct audio_stream which is already acquired at the generic code level. That means, that in those cases .data contains cached memory aliases. This patch marks the .data pointer as cached. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
1 parent adce544 commit a9c5a1b

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/audio/module_adapter/module_adapter.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,7 @@ int module_adapter_prepare(struct comp_dev *dev)
270270
list_for_item(blist, &dev->bsource_list) {
271271
size_t size = MAX(mod->deep_buff_bytes, mod->period_bytes);
272272

273-
mod->input_buffers[i].data = (__sparse_force void __sparse_cache *)rballoc(0,
274-
SOF_MEM_CAPS_RAM, size);
273+
mod->input_buffers[i].data = rballoc(0, SOF_MEM_CAPS_RAM, size);
275274
if (!mod->input_buffers[i].data) {
276275
comp_err(mod->dev, "module_adapter_prepare(): Failed to alloc input buffer data");
277276
ret = -ENOMEM;
@@ -283,8 +282,7 @@ int module_adapter_prepare(struct comp_dev *dev)
283282
/* allocate memory for output buffer data */
284283
i = 0;
285284
list_for_item(blist, &dev->bsink_list) {
286-
mod->output_buffers[i].data = (__sparse_force void __sparse_cache *)rballoc(0,
287-
SOF_MEM_CAPS_RAM, md->mpd.out_buff_size);
285+
mod->output_buffers[i].data = rballoc(0, SOF_MEM_CAPS_RAM, md->mpd.out_buff_size);
288286
if (!mod->output_buffers[i].data) {
289287
comp_err(mod->dev, "module_adapter_prepare(): Failed to alloc output buffer data");
290288
ret = -ENOMEM;

src/include/sof/audio/module_adapter/module/module_interface.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#ifndef __SOF_MODULE_INTERFACE__
1414
#define __SOF_MODULE_INTERFACE__
1515

16+
#include <sof/compiler_attributes.h>
17+
1618
/**
1719
* \enum module_cfg_fragment_position
1820
* \brief Fragment position in config
@@ -46,7 +48,7 @@ enum module_processing_mode {
4648
* \brief Input stream buffer
4749
*/
4850
struct input_stream_buffer {
49-
void *data; /* data stream buffer */
51+
void __sparse_cache *data; /* data stream buffer */
5052
uint32_t size; /* size of data in the buffer */
5153
uint32_t consumed; /* number of bytes consumed by the module */
5254

@@ -59,7 +61,7 @@ struct input_stream_buffer {
5961
* \brief Output stream buffer
6062
*/
6163
struct output_stream_buffer {
62-
void *data; /* data stream buffer */
64+
void __sparse_cache *data; /* data stream buffer */
6365
uint32_t size; /* size of data in the buffer */
6466
};
6567

0 commit comments

Comments
 (0)