File tree Expand file tree Collapse file tree 3 files changed +42
-0
lines changed
Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,13 @@ config SOF_ZEPHYR_VIRTUAL_HEAP_SIZE
5050 NOTE: Keep in mind that the heap size should not be greater than the physical
5151 memory size of the system defined in DT (and this includes baseFW text/data).
5252
53+ config SOF_ZEPHYR_VIRTUAL_HEAP_REGION_SIZE
54+ hex "Size in bytes of virtual memory region for virtual heap shared for all cores"
55+ depends on MM_DRV_INTEL_ADSP_MTL_TLB
56+ default 0x100000
57+ help
58+ This config defines size of virtual heap region shared between all cores
59+
5360config ZEPHYR_NATIVE_DRIVERS
5461 bool "Use Zephyr native drivers"
5562 default n
Original file line number Diff line number Diff line change 1717#include <zephyr/init.h>
1818#include <zephyr/sys/mem_blocks.h>
1919
20+ /* Attributes for memory regions */
21+ #define VIRTUAL_REGION_SHARED_HEAP_ATTR 1U /*< region dedicated for shared virtual heap */
22+
2023/* Dependency on ipc/topology.h created due to memory capability definitions
2124 * that are defined there
2225 */
Original file line number Diff line number Diff line change 2121
2222#if CONFIG_VIRTUAL_HEAP
2323#include <sof/lib/regions_mm.h>
24+ #include <zephyr/drivers/mm/mm_drv_intel_adsp_mtl_tlb.h>
2425
2526struct vmh_heap ;
2627struct vmh_heap * virtual_buffers_heap ;
@@ -288,8 +289,39 @@ static const struct vmh_heap_config static_hp_buffers = {
288289 },
289290};
290291
292+ /* WA Stubs begin
293+ *
294+ * in order to merge a PR that moves initialization of virtual regions from Zephyr to SOF,
295+ * we need to create weak stubs for 2 functions that will need to be called once the PR is merged
296+ */
297+
298+ __weak
299+ uintptr_t adsp_mm_get_unused_l2_start_aligned (void )
300+ {
301+ return 0 ;
302+ }
303+
304+ __weak
305+ int adsp_add_virtual_memory_region (uintptr_t region_address , uint32_t region_size , uint32_t attr )
306+ {
307+ return 0 ;
308+ }
309+ /* WA Stubs end */
310+
291311static int virtual_heap_init (void )
292312{
313+ int ret ;
314+
315+ if (virtual_buffers_heap )
316+ return - EEXIST ;
317+
318+ /* add a virtual memory region */
319+ ret = adsp_add_virtual_memory_region (adsp_mm_get_unused_l2_start_aligned (),
320+ CONFIG_SOF_ZEPHYR_VIRTUAL_HEAP_REGION_SIZE ,
321+ VIRTUAL_REGION_SHARED_HEAP_ATTR );
322+ if (ret )
323+ return ret ;
324+
293325 virtual_buffers_heap = vmh_init_heap (& static_hp_buffers , false);
294326 if (!virtual_buffers_heap ) {
295327 tr_err (& zephyr_tr , "Unable to init virtual heap" );
You can’t perform that action at this time.
0 commit comments