-
Notifications
You must be signed in to change notification settings - Fork 154
ref(vmpu): Standardize vMPU driver #216
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
base: main
Are you sure you want to change the base?
Conversation
063a1b2
to
2f167aa
Compare
src/core/mpu/mem.c
Outdated
@@ -546,7 +587,7 @@ vaddr_t mem_map_cpy(struct addr_space* ass, struct addr_space* asd, vaddr_t vas, | |||
mpr = mpe->region; | |||
spin_unlock(&ass->lock); | |||
|
|||
if (mem_map(asd, &mpr, true)) { | |||
if (mem_map(asd, &mpr, true, false)) { |
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.
Just a note that I think these type of invocations are not easily readable.
It would be best to have some macros (e.g., MPU_ENTRY_LOCKED, MPU_ENTRY_UNLOCKED) and used inplace of the true/false values which add little semantic information
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.
I agree with you. However, this false/true might not reflect if the entry will be locked or not. It's just a "guideline" for later functions to decide if the entry is locked or not.
@@ -164,7 +164,7 @@ static void mem_init_boot_regions(void) | |||
.mem_flags = PTE_HYP_FLAGS, | |||
.as_sec = SEC_HYP_IMAGE, | |||
}; | |||
mem_map(&cpu()->as, &mpr, true, true); | |||
mem_map(&cpu()->as, &mpr, false, true); |
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.
Similarly to a comment I made before, It would be best to have some macros (e.g., MPU_BROADCAST, MPU_NO_BROADCAST) used in place of the true/false values which add little semantic information
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.
Similar to the locked comment. Later functions decide if the regions need to be broadcast or not.
d1eb470
to
327ac4a
Compare
Signed-off-by: Jose Martins <josemartins90@gmail.com>
Signed-off-by: Jose Martins <josemartins90@gmail.com>
Added an ordered list structure to the vmpu to facilitate the merge of regions. Signed-off-by: Daniel Oliveira <drawnpoetry@gmail.com>
Add functionality to lock entries on the vMPU to prevent hypervisor MPU entries from being removed. Signed-off-by: Daniel Oliveira <drawnpoetry@gmail.com>
This API simplifies the implementation of vMPU entries coalescense. Updating a region requires a broadcast to the other CPUs on the same address space. This commit also fixes the install of the VM images where MPU entries on other cores were not correctly unmaped. Signed-off-by: Daniel Oliveira <drawnpoetry@gmail.com> Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
0c17b42
to
1fa7ca3
Compare
ef8a1ee
to
91a5c37
Compare
bool mpu_perms_compatible(unsigned long perms1, unsigned long perms2) | ||
{ | ||
bitmap_clear_consecutive(cpu()->arch.profile.mpu.bitmap, 0, mpu_num_entries()); | ||
list_init(&cpu()->arch.profile.mpu.order.list); | ||
UNUSED_ARG(perms1); | ||
UNUSED_ARG(perms2); | ||
|
||
for (mpid_t mpid = 0; mpid < (mpid_t)mpu_num_entries(); mpid++) { | ||
cpu()->arch.profile.mpu.order.node[mpid].mpid = mpid; | ||
return true; | ||
} |
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.
How to check mpu perm compaibility?
d0026bd
to
0a52b3e
Compare
This reduces the number of vMPU/MPU entries. Signed-off-by: Daniel Oliveira <drawnpoetry@gmail.com> Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
To simplify boot code we run with mpu disable until the mem init. Signed-off-by: Daniel Oliveira <drawnpoetry@gmail.com>
Initally, when mapping and copying, the destination region was being created with the same size of the original region, instead of the size of the data being copied Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
Removed the complexity from the MPU driver related to the merge of regions, which was moved to the vMPU level. Removed the creation of MPU entries during boot. Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
During the context switch of MPU regions, locked entries are not disabled. Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
PR Description
This PR aims to stantardize the vMPU driver and to the some extend the MPU API. This was needed to support different MPU implementations.
A major goal of this PR is remove the complexity from the MPU driver and move it to the vMPU.
The history of this PR still has to be reviewed.
Current MPU implementation have to be updated to comply with this PR.