-
Notifications
You must be signed in to change notification settings - Fork 163
openhcl_boot: use host provided vtl2 mmio if provided when in vtl2 self allocate mode #2689
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
|
This PR modifies files containing For more on why we check whole files, instead of just diffs, check out the Rustonomicon |
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.
Pull request overview
This PR updates OpenHCL boot to use host-provided VTL2 MMIO ranges when VTL2 is configured to self-allocate memory, instead of always carving out MMIO from VTL0's allocation. The implementation correctly prioritizes host-provided VTL2 MMIO ranges and falls back to the legacy allocation strategy for backward compatibility.
Changes:
- Modified VTL2 MMIO allocation logic to prefer host-provided VTL2 MMIO ranges when available
- Added new MmioConfig enum to petri for custom MMIO gap configuration
- Added VMM test to validate the new allocation behavior
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| openhcl/openhcl_boot/src/host_params/dt/mod.rs | Core logic change: uses host-provided VTL2 MMIO ranges when available, with fallback to legacy carve-out from VTL0 |
| openhcl/openhcl_boot/src/host_params/mmio.rs | Renamed error variant for clarity (NotEnoughMmio → NotEnoughVtl0Mmio) |
| openhcl/openhcl_boot/src/main.rs | Improved error message formatting (Display → Debug format) |
| vmm_tests/vmm_tests/tests/tests/x86_64/openhcl_linux_direct.rs | New test to validate VTL2 MMIO self-allocation with host-provided ranges |
| vmm_tests/vmm_tests/tests/tests/multiarch/memstat.rs | Updated to explicitly set mmio_gaps field |
| petri/src/vm/mod.rs | Added MmioConfig enum and integrated into MemoryConfig; fixed typos in comments |
| petri/src/vm/openvmm/construct.rs | Updated to handle new MmioConfig enum |
| petri/pipette_client/src/shell.rs | Added read_file_raw helper method for binary file reads |
| petri/Cargo.toml, vmm_tests/vmm_tests/Cargo.toml, Cargo.lock | Added memory_range dependency for tests |
When VTL2 is asked to allocate memory by itself, today it allocates mmio space from the mmio gaps described for VTL0. In some host configurations, we instead will get an mmio range intended only for VTL2, so we should instead be using that.
Update the code to do just that, along with updating the existing size heuristic to use the host provided size. For legacy compatibility on older hosts, match the previous behavior of possibly calculating a larger default size if the host did not provide a VTL2 specific mmio range.
Add a vmm test to test this.