Skip to content

Commit 019c69f

Browse files
lrgirdwolgirdwood
authored andcommitted
kconfig: heap: Add Kconfig option to set virtual memory heap size.
Allow the developer to set the maximum virtual heap size so that power savings can be made when full memory is not required for device use cases. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
1 parent 4f14fb0 commit 019c69f

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

zephyr/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ config SOF_ZEPHYR_HEAP_SIZE
3333
NOTE: Keep in mind that the heap size should not be greater than the physical
3434
memory size of the system defined in DT (and this includes baseFW text/data).
3535

36+
config SOF_ZEPHYR_VIRTUAL_HEAP_SIZE
37+
hex "Size of the Zephyr virtual heap for SOF"
38+
depends on VIRTUAL_HEAP
39+
default 0x40000
40+
help
41+
Support scaling of the virtual address heap size for different platforms.
42+
NOTE: Keep in mind that the heap size should not be greater than the physical
43+
memory size of the system defined in DT (and this includes baseFW text/data).
44+
3645
config ZEPHYR_NATIVE_DRIVERS
3746
bool "Use Zephyr native drivers"
3847
default n

zephyr/lib/alloc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <sof/trace/trace.h>
1919
#include <rtos/symbol.h>
2020
#include <rtos/wait.h>
21+
2122
#if CONFIG_VIRTUAL_HEAP
2223
#include <sof/lib/regions_mm.h>
2324

@@ -27,7 +28,7 @@ struct vmh_heap *virtual_buffers_heap;
2728
#undef HEAPMEM_SIZE
2829
/* Buffers are allocated from virtual space so we can safely reduce the heap size.
2930
*/
30-
#define HEAPMEM_SIZE 0x40000
31+
#define HEAPMEM_SIZE CONFIG_SOF_ZEPHYR_VIRTUAL_HEAP_SIZE
3132
#endif /* CONFIG_VIRTUAL_HEAP */
3233

3334

0 commit comments

Comments
 (0)