mirror of https://github.com/thesofproject/sof.git
library-manager: allocate DMA buffer uncached
The library manager uses a DMA buffer only to receive data via DMA from the host and to copy it from it once completely to a destination buffer. With that flow using cached access to the DMA buffer doesn't accelerate IO but adds complexity and can slow it down instead. Switch over to using uncached access. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
parent
4bafdee66d
commit
76926dacdd
|
@ -424,15 +424,13 @@ static int lib_manager_dma_buffer_alloc(struct lib_manager_dma_ext *dma_ext,
|
||||||
* allocate new buffer: this is the actual DMA buffer but we
|
* allocate new buffer: this is the actual DMA buffer but we
|
||||||
* traditionally allocate a cached address for it
|
* traditionally allocate a cached address for it
|
||||||
*/
|
*/
|
||||||
dma_ext->dma_addr = (uintptr_t)rballoc_align(0, SOF_MEM_CAPS_DMA, size,
|
dma_ext->dma_addr = (uintptr_t)rballoc_align(SOF_MEM_FLAG_COHERENT, SOF_MEM_CAPS_DMA, size,
|
||||||
dma_ext->addr_align);
|
dma_ext->addr_align);
|
||||||
if (!dma_ext->dma_addr) {
|
if (!dma_ext->dma_addr) {
|
||||||
tr_err(&lib_manager_tr, "lib_manager_dma_buffer_alloc(): alloc failed");
|
tr_err(&lib_manager_tr, "lib_manager_dma_buffer_alloc(): alloc failed");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
dcache_invalidate_region((void __sparse_cache *)dma_ext->dma_addr, size);
|
|
||||||
|
|
||||||
tr_dbg(&lib_manager_tr,
|
tr_dbg(&lib_manager_tr,
|
||||||
"lib_manager_dma_buffer_alloc(): address: %#lx, size: %u",
|
"lib_manager_dma_buffer_alloc(): address: %#lx, size: %u",
|
||||||
dma_ext->dma_addr, size);
|
dma_ext->dma_addr, size);
|
||||||
|
@ -528,7 +526,7 @@ static int lib_manager_store_data(struct lib_manager_dma_ext *dma_ext,
|
||||||
ret = lib_manager_load_data_from_host(dma_ext, bytes_to_copy);
|
ret = lib_manager_load_data_from_host(dma_ext, bytes_to_copy);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
dcache_invalidate_region((void __sparse_cache *)dma_ext->dma_addr, bytes_to_copy);
|
|
||||||
memcpy_s((__sparse_force uint8_t *)dst_addr + copied_bytes, bytes_to_copy,
|
memcpy_s((__sparse_force uint8_t *)dst_addr + copied_bytes, bytes_to_copy,
|
||||||
(void *)dma_ext->dma_addr, bytes_to_copy);
|
(void *)dma_ext->dma_addr, bytes_to_copy);
|
||||||
copied_bytes += bytes_to_copy;
|
copied_bytes += bytes_to_copy;
|
||||||
|
|
Loading…
Reference in New Issue