Skip to content

ref(vmpu): Standardize vMPU driver and update armv8-r MPU#216

Merged
josecm merged 11 commits into
mainfrom
ref/vmpu
Aug 20, 2025
Merged

ref(vmpu): Standardize vMPU driver and update armv8-r MPU#216
josecm merged 11 commits into
mainfrom
ref/vmpu

Conversation

@miguelafsilva5
Copy link
Copy Markdown
Member

@miguelafsilva5 miguelafsilva5 commented May 22, 2025

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.

In order to comply with these modifications to the vMPU, the MPU driver for armv8-r was also updated

Comment thread src/core/mpu/mem.c Outdated
Comment thread src/core/mpu/inc/mem_prot/mem.h
Comment thread src/core/mpu/inc/mem_prot/mem.h
Comment thread src/core/mpu/mem.c Outdated
Comment thread src/core/mpu/mem.c
Comment thread src/core/mpu/mem.c Outdated
Comment thread src/core/mpu/mem.c Outdated
Comment thread src/core/mpu/mem.c Outdated
Comment thread src/core/mpu/mem.c Outdated
Comment thread src/core/mpu/mem.c Outdated
Comment thread src/arch/armv8/armv8-r/mpu.c Outdated
Comment thread src/core/mpu/mem.c
Comment thread src/core/mpu/mem.c
Comment thread src/core/mpu/mem.c
Comment thread src/core/mpu/mem.c Outdated
Comment thread src/core/mpu/mem.c
Comment thread src/core/mpu/mem.c
Comment thread src/core/vm.c
Comment thread src/arch/armv8/armv8-r/inc/arch/mpu.h Outdated
Comment thread src/core/mpu/inc/mem_prot/mem.h Outdated
Comment thread src/platform/drivers/dummy_uart/dummy_uart.c Outdated
Comment thread src/core/mpu/mem.c Outdated
Comment thread src/arch/armv8/aarch32/exceptions.S Outdated
josecm and others added 5 commits August 18, 2025 13:41
Signed-off-by: Jose Martins <josemartins90@gmail.com>
Signed-off-by: Jose Martins <josemartins90@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>
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 reduces the number of vMPU/MPU entries.

Signed-off-by: Daniel Oliveira <drawnpoetry@gmail.com>
Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
@miguelafsilva5 miguelafsilva5 force-pushed the ref/vmpu branch 3 times, most recently from b5d134b to c058b4e Compare August 18, 2025 15:19
@josecm
Copy link
Copy Markdown
Member

josecm commented Aug 18, 2025

@miguelafsilva5 Please check for typos in commit messages. Also, the sentence after : should start lowecase.

danielRep and others added 2 commits August 19, 2025 11:32
To simplify boot code we run with mpu disabled 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>
@miguelafsilva5
Copy link
Copy Markdown
Member Author

@miguelafsilva5 Please check for typos in commit messages. Also, the sentence after : should start lowecase.

@josecm should be fixed already. Thank you

@danielRep
Copy link
Copy Markdown
Member

@miguelafsilva5 Please check for typos in commit messages. Also, the sentence after : should start lowecase.

@josecm should be fixed already. Thank you

@miguelafsilva5 commit 2922a2d still has a typo. Should be "deallocate"

@miguelafsilva5
Copy link
Copy Markdown
Member Author

@miguelafsilva5 Please check for typos in commit messages. Also, the sentence after : should start lowecase.

@josecm should be fixed already. Thank you

@miguelafsilva5 commit 2922a2d still has a typo. Should be "deallocate"

@danielRep my bad- Missed it. Its fixed now. Thank you

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>
Added a function that deallocates a vMPU entry whenever the mpu fails
to insert a region.

Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
Signed-off-by: Miguel Silva <miguelafsilva5@gmail.com>
@DavidMCerdeira DavidMCerdeira self-requested a review August 20, 2025 10:30
@danielRep danielRep requested review from danielRep and removed request for AfonsoSantos96 August 20, 2025 10:49
@josecm josecm merged commit a7a02e7 into main Aug 20, 2025
31 checks passed
@josecm josecm deleted the ref/vmpu branch August 20, 2025 10:58
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.

4 participants