From f72fa2732fa8dc116d216699287ce25534f87921 Mon Sep 17 00:00:00 2001 From: Serhiy Katsyuba Date: Thu, 15 Jan 2026 12:30:44 +0100 Subject: [PATCH] fast-get: Fix shared data usage by multiple callers fast_get() for the same data can be called by multiple clients from the same or other cores. Since sram_ptr points to cached memory, writeback is needed after memcpy() to also copy data to uncached memory. When fast_get() is called a second time for the same data, invalidate() is used to bring shared data into another core's cache. This fixes tests which use two SRC modules. Signed-off-by: Serhiy Katsyuba --- zephyr/lib/fast-get.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zephyr/lib/fast-get.c b/zephyr/lib/fast-get.c index c3c70c1ee438..4f08d111e8b9 100644 --- a/zephyr/lib/fast-get.c +++ b/zephyr/lib/fast-get.c @@ -117,12 +117,13 @@ const void *z_impl_fast_get(struct k_heap *heap, const void *dram_ptr, size_t si goto out; } - ret = sof_heap_alloc(heap, SOF_MEM_FLAG_USER, size, 0); + ret = sof_heap_alloc(heap, SOF_MEM_FLAG_USER, size, PLATFORM_DCACHE_ALIGN); if (!ret) goto out; entry->size = size; entry->sram_ptr = ret; memcpy_s(entry->sram_ptr, entry->size, dram_ptr, size); + dcache_writeback_region((__sparse_force void __sparse_cache *)entry->sram_ptr, size); entry->dram_ptr = dram_ptr; entry->refcount = 1; out: