File tree Expand file tree Collapse file tree 4 files changed +402
-2
lines changed
Expand file tree Collapse file tree 4 files changed +402
-2
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,19 @@ config SOF_USERSPACE_APPLICATION
145145 Not manually settable. This is effectively a shortcut to replace numerous
146146 checks for (CONFIG_USERSPACE && !CONFIG_SOF_USERSPACE_PROXY)
147147
148+ config SOF_VPAGE_MAX_ALLOCS
149+ int "Number of virtual memory page allocations"
150+ default 128
151+ help
152+ This setting defines the maximum number of virtual memory page
153+ allocations that can be tracked. Each allocation represents a
154+ contiguous block of virtual memory allocated from the virtual memory
155+ region. This API isn't intended for end-user allocations, instead it
156+ should be used by the framework to allocate memory, which is then
157+ used, e.g. to create one or multiple heap allocators in it. Increasing
158+ this number allows for more simultaneous allocations, but also
159+ increases the memory overhead for tracking these allocations.
160+
148161config ZEPHYR_NATIVE_DRIVERS
149162 bool "Use Zephyr native drivers"
150163 help
Original file line number Diff line number Diff line change 1818#include <zephyr/sys/mem_blocks.h>
1919
2020/* Attributes for memory regions */
21- #define VIRTUAL_REGION_SHARED_HEAP_ATTR 1U /*< region dedicated for shared virtual heap */
22- #define VIRTUAL_REGION_LLEXT_LIBRARIES_ATTR 2U /*< region dedicated for LLEXT libraries */
21+ #define VIRTUAL_REGION_SHARED_HEAP_ATTR 1U /*< region for shared virtual heap */
22+ #define VIRTUAL_REGION_LLEXT_LIBRARIES_ATTR 2U /*< region for LLEXT libraries */
23+ #define VIRTUAL_REGION_VPAGES_ATTR 3U /*< region for virtual page allocator */
2324
2425/* Dependency on ipc/topology.h created due to memory capability definitions
2526 * that are defined there
Original file line number Diff line number Diff line change 1+ // SPDX-License-Identifier: BSD-3-Clause
2+ // Copyright(c) 2025 Intel Corporation.
3+
4+ /* Virtual Page Allocator API */
5+ #ifndef __SOF_LIB_VPAGE_H__
6+ #define __SOF_LIB_VPAGE_H__
7+
8+ #include <zephyr/kernel.h>
9+ #include <stdint.h>
10+
11+ #ifdef __cplusplus
12+ extern "C" {
13+ #endif
14+
15+ /**
16+ * @brief Allocate virtual pages
17+ * Allocates a specified number of contiguous virtual memory pages by mapping
18+ * physical pages.
19+ *
20+ * @param[in] pages Number of 4kB pages to allocate.
21+ *
22+ * @return Pointer to the allocated virtual memory region, or NULL on failure.
23+ */
24+ void * vpage_alloc (unsigned int pages );
25+
26+ /**
27+ * @brief Free virtual pages
28+ * Frees previously allocated virtual memory pages and unmaps them.
29+ *
30+ * @param[in] ptr Pointer to the memory pages to free.
31+ */
32+ void vpage_free (void * ptr );
33+
34+ #ifdef __cplusplus
35+ }
36+ #endif
37+
38+ #endif /* __SOF_LIB_VPAGE_H__ */
You can’t perform that action at this time.
0 commit comments