Skip to content

Conversation

@chris-oo
Copy link
Member

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.

@chris-oo chris-oo requested review from a team as code owners January 23, 2026 23:35
Copilot AI review requested due to automatic review settings January 23, 2026 23:35
@github-actions github-actions bot added the unsafe Related to unsafe code label Jan 23, 2026
@github-actions
Copy link

⚠️ Unsafe Code Detected

This PR modifies files containing unsafe Rust code. Extra scrutiny is required during review.

For more on why we check whole files, instead of just diffs, check out the Rustonomicon

Copy link
Contributor

Copilot AI left a 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

@github-actions
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport_1.7.2511 unsafe Related to unsafe code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant