Skip to content

Commit b1e3987

Browse files
abonislawskikv2019i
authored andcommitted
zephyr: alloc: fix L3 heap restore after power state change
Fix L3 heap restoration logic to ensure MMU mapping is always configured before restoring the heap state from l3_heap_copy. Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
1 parent 6cb32cd commit b1e3987

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

zephyr/lib/alloc.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -676,9 +676,7 @@ static int heap_init(void)
676676
#endif
677677

678678
#if CONFIG_L3_HEAP
679-
if (l3_heap_copy.heap.heap) {
680-
l3_heap = l3_heap_copy;
681-
} else if (ace_imr_used()) {
679+
if (ace_imr_used()) {
682680
void *l3_heap_start = UINT_TO_POINTER(get_l3_heap_start());
683681
size_t l3_heap_size = get_l3_heap_size();
684682
#if CONFIG_MMU
@@ -687,7 +685,10 @@ static int heap_init(void)
687685

688686
arch_mem_map(l3_heap_start, va, l3_heap_size, K_MEM_PERM_RW | K_MEM_CACHE_WB);
689687
#endif
690-
sys_heap_init(&l3_heap.heap, l3_heap_start, l3_heap_size);
688+
if (l3_heap_copy.heap.heap)
689+
l3_heap = l3_heap_copy;
690+
else
691+
sys_heap_init(&l3_heap.heap, l3_heap_start, l3_heap_size);
691692
}
692693
#endif
693694

0 commit comments

Comments
 (0)