mirror of https://github.com/thesofproject/sof.git
lib: alloc: Use aligned allocation for L3_HEAP usage.
L3_HEAP is used in library manager for library storage buffer allocation and in D3 enter/exit flows to allocate IMR context storage buffer. Both buffers should be aligned so use rballoc_align() routine to get correctly aligned buffers. Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
This commit is contained in:
parent
58a42e5fdb
commit
8cad5bea57
|
@ -671,16 +671,14 @@ static void __sparse_cache *lib_manager_allocate_store_mem(uint32_t size,
|
|||
void __sparse_cache *local_add;
|
||||
#if CONFIG_L3_HEAP
|
||||
uint32_t caps = SOF_MEM_CAPS_L3 | SOF_MEM_CAPS_DMA;
|
||||
|
||||
/* allocate new buffer: cached alias */
|
||||
local_add = (__sparse_force void __sparse_cache *)rmalloc(SOF_MEM_ZONE_SYS, 0, caps, size);
|
||||
#else
|
||||
uint32_t addr_align = PAGE_SZ;
|
||||
uint32_t caps = SOF_MEM_CAPS_DMA;
|
||||
#endif
|
||||
|
||||
uint32_t addr_align = PAGE_SZ;
|
||||
/* allocate new buffer: cached alias */
|
||||
local_add = (__sparse_force void __sparse_cache *)rballoc_align(0, caps, size, addr_align);
|
||||
#endif
|
||||
|
||||
if (!local_add) {
|
||||
tr_err(&lib_manager_tr, "lib_manager_allocate_store_mem(): alloc failed");
|
||||
return NULL;
|
||||
|
|
|
@ -96,10 +96,16 @@ void cpu_notify_state_entry(enum pm_state state)
|
|||
storage_buffer_size += LP_SRAM_SIZE;
|
||||
|
||||
/* allocate IMR buffer and store it in the global pointer */
|
||||
global_imr_ram_storage = rmalloc(SOF_MEM_ZONE_SYS_RUNTIME,
|
||||
0,
|
||||
SOF_MEM_CAPS_L3,
|
||||
storage_buffer_size);
|
||||
global_imr_ram_storage = rballoc_align(0, SOF_MEM_CAPS_L3,
|
||||
storage_buffer_size,
|
||||
PLATFORM_DCACHE_ALIGN);
|
||||
|
||||
/* If no IMR buffer we can not recover */
|
||||
if (!global_imr_ram_storage) {
|
||||
tr_err(&zephyr_tr, "failed to allocate global_imr_ram_storage");
|
||||
k_panic();
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ADSP_IMR_CONTEXT_SAVE */
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue