Skip to content

Commit 47bd139

Browse files
marcinszkudlinskilgirdwood
authored andcommitted
mem: workaround - always use 1st virtual memory region
This PR forces buffers location in the very first memory region, preventing from conflict of virtual addresses with loadable modules in case of 5 cores platforms Signed-off-by: Marcin Szkudlinski <marcin.szkudlinski@intel.com>
1 parent bed24a7 commit 47bd139

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

zephyr/lib/regions_mm.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,7 @@ struct vmh_heap {
4949
*/
5050
struct vmh_heap *vmh_init_heap(const struct vmh_heap_config *cfg, bool allocating_continuously)
5151
{
52-
const struct sys_mm_drv_region *virtual_memory_regions =
53-
sys_mm_drv_query_memory_regions();
5452
int i;
55-
5653
struct vmh_heap *new_heap =
5754
rzalloc(SOF_MEM_FLAG_KERNEL | SOF_MEM_FLAG_COHERENT, sizeof(*new_heap));
5855

@@ -61,15 +58,14 @@ struct vmh_heap *vmh_init_heap(const struct vmh_heap_config *cfg, bool allocatin
6158

6259
k_mutex_init(&new_heap->lock);
6360
struct vmh_heap_config new_config = {0};
64-
const struct sys_mm_drv_region *region;
6561

66-
SYS_MM_DRV_MEMORY_REGION_FOREACH(virtual_memory_regions, region) {
67-
if (region->attr == MEM_REG_ATTR_SHARED_HEAP) {
68-
new_heap->virtual_region = region;
69-
break;
70-
}
71-
}
72-
if (!new_heap->virtual_region)
62+
/* Workaround - use the very first virtual memory region because of virt addresses
63+
* collision.
64+
* Fix will be provided ASAP, but removing MEM_REG_ATTR_SHARED_HEAP from SOF is required
65+
* to merge Zephyr changes
66+
*/
67+
new_heap->virtual_region = sys_mm_drv_query_memory_regions();
68+
if (!new_heap->virtual_region || !new_heap->virtual_region->size)
7369
goto fail;
7470

7571
/* If no config was specified we will use default one */

0 commit comments

Comments
 (0)