Skip to content
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

Fix(extra mem): Fix additonal memory allocation for MPU-based systems #196

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

miguelafsilva5
Copy link
Member

PR description

This PR fixes a problem identified for systems based on MPUs, where additional memory was being allocated for VMs in the linkerscript. This is only required for MMU-based ones.
Additionally, this PR also fixes a small mistake where the root pool bitmap base was being allocated in a wrong place for systems with MPU.

Copy link
Member

@DavidMCerdeira DavidMCerdeira left a comment

Choose a reason for hiding this comment

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

Code looks alright, but commit message is confusing.
Here's my proposal:

For MMU systems we manage the location counter to relocate VM images virtual address space.
This allows us to maintain a contiguous virtual address for each cpu between the hypervisor image and it’s private memory. However, for non-mmu systems this operation results in extra memory being erroneously allocated for the vms, as this space is already allocated between vm_image_start and vm_image_end.

@josecm
Copy link
Member

josecm commented Nov 28, 2024

Shouldn't this also address calculations in pp_root_reserve_hyp_mem?

For MMU systems we manage the location counter to relocate VM images virtual
address space.
This allows us to maintain a contiguous virtual address for each cpu between
the hypervisor image and it’s private memory. However, for non-mmu systems
this operation results in extra memory being erroneously allocated for the vms,
as this space is already allocated between vm_image_start and vm_image_end.

Signed-off-by: Miguel Silva <[email protected]>
In mmu-based systems, the vm_image_size is already encompassed in the
image_size. This lead to miscalculations in the base address of the bitmap
and cpu.

Signed-off-by: Miguel Silva <[email protected]>
Having this symbol right before the bss section (firs noload section)
allows easier calculations in the c code.

Signed-off-by: Miguel Silva <[email protected]>
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.

3 participants