Skip to content

Conversation

@abonislawski
Copy link
Member

Updates the L3 heap management to dynamically calculate heap size based on the actual IMR size reported by hardware registers instead of using hardcoded values.

Only initializes the L3 heap when the IMR is actually available and being used, as determined by the ace_imr_used() function.

This change makes the L3 heap allocation more flexible and adaptable to different hardware configurations.

Copilot AI review requested due to automatic review settings August 18, 2025 07:43
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Updates L3 heap management to dynamically calculate heap size from hardware IMR registers instead of using hardcoded values, and adds conditional initialization based on IMR availability.

  • Replaces hardcoded IMR_L3_HEAP_SIZE with dynamic calculation using ace_imr_get_mem_size()
  • Adds conditional L3 heap initialization that only occurs when IMR is actually used
  • Includes MMU memory mapping for the L3 heap when CONFIG_MMU is enabled

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
zephyr/lib/alloc.c Updates L3 heap size calculation and adds conditional initialization with MMU support
west.yml Updates Zephyr revision to pull request branch

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one open.

@abonislawski abonislawski force-pushed the imr_runtime_size branch 2 times, most recently from 997bf96 to 4929754 Compare August 19, 2025 13:45
af974c307477 soc: intel_adsp: ace: add IMR info registers
35a1e62035fd soc: intel_adsp: ace40: extend hwreg1 MMU mapping

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
Updates the L3 heap management to dynamically calculate heap size
based on the actual IMR size reported by hardware registers
instead of using hardcoded values.

Only initializes the L3 heap when the IMR is actually available
and being used, as determined by the ace_imr_used() function,
improving robustness by preventing the initialization
of unavailable memory regions.

Adds proper memory mapping when MMU is enabled, which maps
the physical L3 heap memory to a virtual address with appropriate
permissions (read/write with write-back caching).
MMU mapping is required because it is no longer a fixed region with
fixed mapping in Zephyr.

This change makes the L3 heap allocation more flexible and
adaptable to different hardware configurations.

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@intel.com>
@abonislawski abonislawski force-pushed the imr_runtime_size branch 2 times, most recently from 402d5ae to 76252e7 Compare November 25, 2025 11:42
@abonislawski
Copy link
Member Author

Rebase + west commit update (Zephyr PR is merged)

void *cached_ptr = sys_cache_cached_ptr_get(l3_heap_start);
uintptr_t va = POINTER_TO_UINT(cached_ptr);

arch_mem_map(l3_heap_start, va, l3_heap_size, K_MEM_PERM_RW | K_MEM_CACHE_WB);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, why not sys_mm_drv_map_region()?

Copy link
Member Author

@abonislawski abonislawski Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are not equivalent, just like the lib/llext manager - we are using both of them. In short, the MM TLB driver is for SRAM memory. I assume in the future we will get some nicer API instead of arch_mem_map.

@abonislawski
Copy link
Member Author

sof-ci/jenkins/pr-build failing on TGL because this zephyr version is no longer compatible with TGL

@abonislawski abonislawski mentioned this pull request Nov 26, 2025
@abonislawski
Copy link
Member Author

SOFCI TEST

@kv2019i kv2019i merged commit 718b745 into thesofproject:main Nov 27, 2025
36 of 42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants