Skip to content

virt_mshv: support upstream enlightened SNP AP startup - #4467

Open
Chris Oo (chris-oo) wants to merge 1 commit into
microsoft:mainfrom
chris-oo:mshv-snp-ap-start
Open

Chris Oo (chris-oo) wants to merge 1 commit into
microsoft:mainfrom
chris-oo:mshv-snp-ap-start

Conversation

@chris-oo

Copy link
Copy Markdown
Member

Handle the HvGetVpIndexFromApicId hypercall and standard AP start hypercall used by upstream SNP enlightened Linux guests with Hyper-V enlightenments enabled. This removes the previous implementation that was used during bring that targeted a specific ACI kernel, that had a slightly different hypercall expectations.

Handle APIC-to-VP index lookups using the configured VP topology, and
parse SNP StartVirtualProcessor inputs through the normal shared-memory
hypercall dispatcher instead of the unsupported GPA-read passthrough.
Retain reserved-field validation in the common x64 StartVP parser.

Cover lookup ordering, partial completion, invalid targets, and reserved
fields with tests. Validated normal-injection SNP boot and per-CPU timer
wakeups with 2, 4, and 8 VPs on MSHV.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 309b650d-fb0e-44da-8054-30ece8ab7e01
Copilot AI lite review requested due to automatic review settings September 16, 2026 16:26
@chris-oo
Chris Oo (chris-oo) requested a review from a team as a code owner September 16, 2026 16:26
@github-actions github-actions Bot added the unsafe Related to unsafe code label Sep 16, 2026
@github-actions

Copy link
Copy Markdown

⚠️ 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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The upstream StartVP context is incompatible with the current VMSA GPA parsing and can prevent AP startup.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Extends MSHV SNP support for upstream Hyper-V enlightened Linux AP startup.

Changes:

  • Routes SNP hypercalls through the shared dispatcher.
  • Adds APIC-ID-to-VP-index lookup and StartVP handling.
  • Validates StartVP fields and documents multi-VP requirements.
File summaries
File Reviewed changes
vmm_core/virt_mshv/src/x86_64/snp.rs Uses generic SNP hypercall dispatch.
vmm_core/virt_mshv/src/x86_64/mod.rs Adds VP lookup and StartVP dispatch.
vm/hv1/hv1_hypercall/src/support.rs Adds StartVP validation tests.
vm/hv1/hv1_hypercall/src/imp.rs Validates x64 StartVP reserved fields.
Guide/src/reference/openvmm/management/cli.md Documents SNP multi-VP requirements.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread vmm_core/virt_mshv/src/x86_64/mod.rs
@github-actions

Copy link
Copy Markdown

For multi-VP SNP IGVM boots, `--processors` must match the processor count
encoded in the image. Hyper-V-enlightened MSHV guests can start APs using
Hyper-V APIC-to-VP lookup and processor-start hypercalls. The guest kernel
must allocate shared hypercall input and output buffers for this path.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

again, dumping internals in the CLI doc

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

Labels

Guide unsafe Related to unsafe code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants