Skip to content

Commit 6ee638f

Browse files
kv2019ilgirdwood
authored andcommitted
zephyr: lib: alloc: use of is_cached() breaks non-xtensa builds
is_cached() is not available in posix Zephyr builds (like fuzzer). Use standard Zephyr interface for cache primitives instead. Fixes: 9ff0a7a ("alloc: sof_heap: Add missing support for shared buffers in sof_heap_alloc") Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
1 parent 66275b6 commit 6ee638f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

zephyr/lib/alloc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ static bool is_heap_pointer(const struct k_heap *heap, void *ptr)
167167
POINTER_TO_UINT(sys_cache_cached_ptr_get(heap->heap.init_mem));
168168
uintptr_t heap_end = heap_start + heap->heap.init_bytes;
169169

170-
if (!is_cached(ptr))
170+
if (!sys_cache_is_ptr_cached(ptr))
171171
ptr = (__sparse_force void *)sys_cache_cached_ptr_get(ptr);
172172

173173
return ((POINTER_TO_UINT(ptr) >= heap_start) &&
@@ -182,7 +182,7 @@ static bool is_shared_buffer_heap_pointer(void *ptr)
182182
uintptr_t shd_heap_start = POINTER_TO_UINT(shared_heapmem);
183183
uintptr_t shd_heap_end = POINTER_TO_UINT(shared_heapmem + SHARED_BUFFER_HEAP_MEM_SIZE);
184184

185-
if (is_cached(ptr))
185+
if (sys_cache_is_ptr_cached(ptr))
186186
ptr = sys_cache_uncached_ptr_get((__sparse_force void __sparse_cache *)ptr);
187187

188188
return (POINTER_TO_UINT(ptr) >= shd_heap_start) && (POINTER_TO_UINT(ptr) < shd_heap_end);
@@ -341,7 +341,7 @@ static bool is_virtual_heap_pointer(void *ptr)
341341
POINTER_TO_UINT(sys_cache_cached_ptr_get(&_unused_ram_start_marker));
342342
uintptr_t virtual_heap_end = CONFIG_KERNEL_VM_BASE + CONFIG_KERNEL_VM_SIZE;
343343

344-
if (!is_cached(ptr))
344+
if (!sys_cache_is_ptr_cached(ptr))
345345
ptr = (__sparse_force void *)sys_cache_cached_ptr_get(ptr);
346346

347347
return ((POINTER_TO_UINT(ptr) >= virtual_heap_start) &&
@@ -463,7 +463,7 @@ static void heap_free(struct k_heap *h, void *mem)
463463
#ifdef CONFIG_SOF_ZEPHYR_HEAP_CACHED
464464
void *mem_uncached;
465465

466-
if (is_cached(mem)) {
466+
if (sys_cache_is_ptr_cached(mem)) {
467467
mem_uncached = sys_cache_uncached_ptr_get((__sparse_force void __sparse_cache *)mem);
468468
sys_cache_data_flush_and_invd_range(mem,
469469
sys_heap_usable_size(&h->heap, mem_uncached));

0 commit comments

Comments
 (0)