Skip to content

virt_whp: add support for MMIO hypercalls #1578

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

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

Conversation

jstarks
Copy link
Member

@jstarks jstarks commented Jun 22, 2025

Support MMIO hypercalls from VTL2, but don't advertise this capability yet. This is currently just useful for private testing, but it provides the infrastructure to implement this in other places (e.g., virt_mshv_vtl).

Support MMIO hypercalls from VTL2, but don't advertise this capability
yet. This is currently just useful for private testing, but it provides
the infrastructure to implement this in other places (e.g.,
virt_mshv_vtl).
@jstarks jstarks requested a review from a team as a code owner June 22, 2025 06:20
@jstarks jstarks requested a review from Copilot June 23, 2025 13:14
Copy link
Contributor

@Copilot 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 adds support for MMIO hypercalls for VTL2 testing, laying the groundwork to extend this support to other components.

  • Introduces async handling of hypercalls in both x86 and aarch64 processors.
  • Implements a new PendingHypercall enum to support asynchronous MMIO read and write operations.
  • Updates hypercall dispatch and support functions across several hypervisor modules.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
vmm_core/virt_whp/src/vp.rs Updated async handling for hypercalls in x86 and aarch64 contexts
vmm_core/virt_whp/src/hypercalls.rs Added PendingHypercall enum and new MMIO read/write implementations
vm/hv1/hvdef/src/lib.rs Added conversion implementation from HvResult<()> to HypercallOutput
vm/hv1/hv1_hypercall/src/support.rs Extended AsHandler trait and added hypercall completing helpers
vm/hv1/hv1_hypercall/src/lib.rs Re-exported new hypercall completing helpers
vm/hv1/hv1_hypercall/src/imp.rs Introduced new hypercall implementations for MMIO read/write
vm/hv1/hv1_hypercall/src/aarch64.rs Adjusted instruction pointer advancement behavior in AArch64
Comments suppressed due to low confidence (1)

vm/hv1/hv1_hypercall/src/aarch64.rs:93

  • [nitpick] Resetting 'self.pre_advanced' without an inline comment can be confusing. Please add a comment clarifying why this flag is reset in this context.
            self.pre_advanced = false;

@@ -90,6 +90,7 @@ impl<T: Arm64RegisterState> HypercallIo for Arm64RegisterIo<T> {
if self.pre_advanced {
let pc = self.inner.pc().wrapping_sub(4);
self.inner.set_pc(pc);
self.pre_advanced = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a test we could add that would've caught this?

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.

2 participants