Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 367
mem: workaround - remove MEM_REG_ATTR_SHARED_HEAP from SOF#10144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -21,6 +21,7 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #if CONFIG_VIRTUAL_HEAP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #include <sof/lib/regions_mm.h> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #include <zephyr/drivers/mm/mm_drv_intel_adsp_mtl_tlb.h> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| struct vmh_heap; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| struct vmh_heap *virtual_buffers_heap; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @@ -288,8 +289,39 @@ static const struct vmh_heap_config static_hp_buffers = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /* WA Stubs begin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * in order to merge a PR that moves initialization of virtual regions from Zephyr to SOF, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * we need to create weak stubs for 2 functions that will need to be called once the PR is merged | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| __weak | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uintptr_t adsp_mm_get_unused_l2_start_aligned(void) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+297
to
+303
CopilotAI | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| __weak | |
| uintptr_tadsp_mm_get_unused_l2_start_aligned(void) | |
| { | |
| return0; | |
| } | |
| /** | |
| * @briefWeakstubforretrievingthestartaddressofunusedL2memory, aligned. | |
| * | |
| *Thisfunctionisaplaceholderandshouldbeoverriddenbyaplatform-specific | |
| *implementation. ItisexpectedtoreturnthestartingaddressofunusedL2memory, | |
| *alignedtotherequiredboundary. | |
| * | |
| * @returnuintptr_tThealignedstartaddressofunusedL2memory. Returns0if | |
| *noimplementationisprovided. | |
| */ | |
| __weak | |
| uintptr_tadsp_mm_get_unused_l2_start_aligned(void) | |
| { | |
| return0; | |
| } | |
| /** | |
| * @briefWeakstubforaddingavirtualmemoryregion. | |
| * | |
| *Thisfunctionisaplaceholderandshouldbeoverriddenbyaplatform-specific | |
| *implementation. Itisexpectedtoaddavirtualmemoryregionwiththespecified | |
| *address, size, andattributes. | |
| * | |
| * @paramregion_addressThestartingaddressofthevirtualmemoryregion. | |
| * @paramregion_sizeThesizeofthevirtualmemoryregioninbytes. | |
| * @paramattrAttributesforthevirtualmemoryregion (e.g., accesspermissions). | |
| * | |
| * @returnintReturns0ifsuccessful, oranerrorcodeiftheoperationfails. | |
| */ |
CopilotAIJul 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The weak stub function lacks documentation explaining its parameters, return values, and expected behavior when the real implementation becomes available.
| /** | |
| * @briefAddavirtualmemoryregiontothesystem. | |
| * | |
| *Thisweakstubfunctionisaplaceholderforaddingavirtualmemoryregion. | |
| *Itisexpectedtobeoverriddenbyarealimplementationinthefuture. | |
| * | |
| * @paramregion_addressThestartingaddressofthememoryregion. | |
| * @paramregion_sizeThesizeofthememoryregioninbytes. | |
| * @paramattrAttributesforthememoryregion (e.g., accesspermissions). | |
| * | |
| * @return0onsuccess, oranerrorcodeindicatingfailure. | |
| */ |
CopilotAIJul 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The abbreviation 'WA' should be spelled out as 'Workaround' for clarity in the comment.
| /* WA Stubs end */ | |
| /* Workaround Stubs end */ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -49,10 +49,7 @@ struct vmh_heap { | ||
| */ | ||
| struct vmh_heap *vmh_init_heap(const struct vmh_heap_config *cfg, bool allocating_continuously) | ||
Collaborator There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could you please explain - do you mean that VMH and LLEXT attempt to use the same addresses on PTL? Don't we have enough address space, cannot we just adjust
| ||
| { | ||
| const struct sys_mm_drv_region *virtual_memory_regions = | ||
| sys_mm_drv_query_memory_regions(); | ||
| int i; | ||
| struct vmh_heap *new_heap = | ||
| rzalloc(SOF_MEM_FLAG_KERNEL | SOF_MEM_FLAG_COHERENT, sizeof(*new_heap)); | ||
| @@ -61,15 +58,14 @@ struct vmh_heap *vmh_init_heap(const struct vmh_heap_config *cfg, bool allocatin | ||
| k_mutex_init(&new_heap->lock); | ||
| struct vmh_heap_config new_config = {0}; | ||
| const struct sys_mm_drv_region *region; | ||
| SYS_MM_DRV_MEMORY_REGION_FOREACH(virtual_memory_regions, region) { | ||
| if (region->attr == MEM_REG_ATTR_SHARED_HEAP) { | ||
| new_heap->virtual_region = region; | ||
| break; | ||
| } | ||
| } | ||
| if (!new_heap->virtual_region) | ||
| /* Workaround - use the very first virtual memory region because of virt addresses | ||
| * collision. | ||
| * Fix will be provided ASAP, but removing MEM_REG_ATTR_SHARED_HEAP from SOF is required | ||
| * to merge Zephyr changes | ||
| */ | ||
| new_heap->virtual_region = sys_mm_drv_query_memory_regions(); | ||
| if (!new_heap->virtual_region || !new_heap->virtual_region->size) | ||
| goto fail; | ||
| /* If no config was specified we will use default one */ | ||
Uh oh!
There was an error while loading. Please reload this page.
CopilotAIJul 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The abbreviation 'WA' should be spelled out as 'Workaround' for clarity in the comment.