-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add dynamic vaspace #7285
Add dynamic vaspace #7285
Conversation
31ecd3b
to
e0b8ee5
Compare
All checks has passed now. |
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.
Looks good to me. Comment for commit "Add phys_mem_alloc_flags()" + few nitpicks.
Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
for commit
"core: mmu: fix dynamic VA region dummy mapping".
Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
for commits
"core: add nex_dyn_vaspace and tee_dyn_vaspace areas",
"Use malloc flags MAF_* in tee_mm.h",
"core: tee_mm.c: use malloc_flags() and free_flags()",
"core: add tee_mm_alloc_flags()",
"core: mm: add virt_page_alloc()" and
"core: arm: boot: call page_alloc_init()".
@@ -36,5 +36,11 @@ | |||
* should be allocated from the Core or TA physical memory pool. | |||
*/ | |||
#define MAF_CORE_MEM 0x11 | |||
/* | |||
* Used by virt_page_alloc() to inidicate whether the allocated memory | |||
* should by guareded by an unmapped page at the beginning and end. |
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.
s/guareded/guarded/
#define MAF_FREE_WIPE 0x04 /* Free wipes allocated buffer */ | ||
/* | ||
* Used by tee_mm_init() to indicatate that the pool should allocate | ||
* from hi address to low address. |
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.
s/hi/high/
|
||
assert(!((vaddr | paddr) & SMALL_PAGE_MASK)); | ||
if (!paddr) | ||
attr = 0; |
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.
Should there be some kind of warning? Maybe a DMSG()
.
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.
No, this is normal. The alternative is to make sure that struct tee_mmap_region
without an assigned physical address never has the attr
field set. I didn't think it was worth the effort to test for that in the other place(s).
* Used by phys_mem_alloc_flags() to indicate whether physical memory | ||
* should be allocated from the Core or TA physical memory pool. | ||
*/ | ||
#define MAF_CORE_MEM 0x11 |
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.
0x20 (not zero-init + hi-alloc')
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.
Yes, I'll fix this flag and the others below.
Update |
The commit 873f5f6 ("core: mmu: Add dynamic VA regions' mapping to page table") populated page tables so all are available later when needed. However, it also mapped physical address 0 in all those ranges. So fix this by setting attributes to 0 when the physical address is 0. Fixes: 873f5f6 ("core: mmu: Add dynamic VA regions' mapping to page table") Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
Add MEM_AREA_NEX_DYN_VASPACE and MEM_AREA_TEE_DYN_VASPACE areas for dynamic Nexus and TEE memory mapping. This will be used to map additional heap and the stacks in later patches. Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
Switch to use the malloc flags MAF_* in tee_mm.h replacing the previous TEE_MM_POOL_* flags. TEE_MM_POOL_* flags are kept defined using MAF_* flags to for easier transition. The TEE_MM_POOL_* flags can be moved gradually after this commit. Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
Use malloc_flags() and free_flags() to simplify memory allocations with regards to the MAF_NEX/TEE_MM_POOL_NEX_MALLOC flag. Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
Add tee_mm_alloc_flags() taking a flags field to passed to malloc_flags() when allocating the tee_mm_entry_t. Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
e7dbe21
to
22c9ae3
Compare
Comments addressed, squashed, tags applied, and rebased on master to resolve the conflict. |
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.
Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
for commit
"Add phys_mem_alloc_flags()".
Add core: mm:
prefix to the commit message header line?
Add phys_mem_alloc_flags() taking MAF_* flags to control memory allocation. The new flag MAF_CORE_MEM behaves like {nex_,}phys_mem_core_alloc(), if the flag is absent it becomes {nex_,}phys_mem_ta_alloc(). The MAF_NEX flag selects Nexus memory. Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
Add virt_page_alloc() to allocate memory from physical pool and map it in a virtual address pool. Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
Call page_alloc_init()/nex_page_alloc_init() from init_primary() after unused boot memory has been released. virt_guest_created() calls page_alloc_init(). This allows virt_page_alloc() to be used instead of boot_mem_alloc() now that boot_mem_alloc() can't be used any longer. Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
22c9ae3
to
832733f
Compare
Commit message updated and tag applied. All commits have been reviewed now. |
Another PR preparing for dynamic boot configuration.