Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions zephyr/lib/vpage.c
Original file line number Diff line number Diff line change
Expand Up @@ -572,16 +572,18 @@ __cold static int vpage_init(void)

k_mutex_init(&vpage_ctx.lock);

if (start + library_l2_size + CONFIG_MM_DRV_PAGE_SIZE <= l2_end) {
if (!IS_ENABLED(CONFIG_LLEXT_TYPE_ELF_RELOCATABLE) &&
start + library_l2_size + CONFIG_MM_DRV_PAGE_SIZE <= l2_end) {
Comment on lines +575 to +576
/* virtual heap and library regions fit in L2, vpages get the rest */
end = l2_end - library_l2_size;
} else {
/*
* Small L2 (e.g. NVL-S): the virtual heap and library regions are only
* virtual address space backed on demand, so they need not fit in L2
* together with the vpages. Use the virtual space up to the library
* region (or the end of virtual memory) and cap it below by the
* physical L2 left after the image, as vpages can never use more.
* Relocatable LLEXTs or small L2 (e.g. NVL-S / MTL with virtual heap):
* the virtual heap and library regions are only virtual address space
* backed on demand, so they need not fit in L2 together with the
* vpages. Use the virtual space up to the library region (or the end
* of virtual memory) and cap it below by the physical L2 left after
* the image, as vpages can never use more.
Comment on lines +581 to +586
* Using pages beyond physical L2 needs the Zephyr TLB driver to map
* the uncached alias too, see
* https://github.com/zephyrproject-rtos/zephyr/pull/122801
Expand Down
Loading