From c56d43dd347868a5964a2f2b12ce9d402cb75b8d Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Fri, 11 Sep 2026 11:49:49 +0200 Subject: [PATCH] vmh: fix address categorisation VMH doesn't occupy all the available SRAM address space, only a part of it. Use the correct address range to fix the categorisation. Signed-off-by: Guennadi Liakhovetski --- zephyr/lib/alloc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/zephyr/lib/alloc.c b/zephyr/lib/alloc.c index 55a65db7aa6b..2ce344133917 100644 --- a/zephyr/lib/alloc.c +++ b/zephyr/lib/alloc.c @@ -301,8 +301,6 @@ static void *virtual_heap_alloc(struct vmh_heap *heap, uint32_t flags, size_t by return mem; } -extern int _unused_ram_start_marker; - /** * Checks whether pointer is from virtual memory range. * @param ptr Pointer to memory being checked. @@ -311,8 +309,9 @@ extern int _unused_ram_start_marker; static bool is_virtual_heap_pointer(void *ptr) { uintptr_t virtual_heap_start = - POINTER_TO_UINT(sys_cache_cached_ptr_get(&_unused_ram_start_marker)); - uintptr_t virtual_heap_end = CONFIG_KERNEL_VM_BASE + CONFIG_KERNEL_VM_SIZE; + POINTER_TO_UINT(adsp_mm_get_unused_l2_start_aligned()); + uintptr_t virtual_heap_end = virtual_heap_start + + CONFIG_SOF_ZEPHYR_VIRTUAL_HEAP_REGION_SIZE; if (!sys_cache_is_ptr_cached(ptr)) ptr = (__sparse_force void *)sys_cache_cached_ptr_get(ptr);