Skip to content

[release/1.8.2607] cvm guest vsm: implement missing register handling (#4161) - #4236

Merged
Steven Malis (smalis-msft) merged 1 commit into
microsoft:release/1.8.2607from
sluck-msft:1.8-backport/gvsm/missing-regs
Aug 13, 2026
Merged

[release/1.8.2607] cvm guest vsm: implement missing register handling (#4161)#4236
Steven Malis (smalis-msft) merged 1 commit into
microsoft:release/1.8.2607from
sluck-msft:1.8-backport/gvsm/missing-regs

Conversation

@sluck-msft

Copy link
Copy Markdown
Contributor

Backport of #4161. Clean cherry-pick.

Adds handling for several VSM-related synthetic registers that were previously unimplemented (or incompletely implemented) for hardware-isolated CVMs, so that a guest VSM (VTL 1) running inside a CVM can query partition/VP VSM state. Also fixes a bug in HvEnableVpVtl when the caller targets itself via HV_VP_INDEX_SELF.

Tested: via private updates to opentmk, booting partner VHD

Fixes #3797, fixes #3798

Adds handling for several VSM-related synthetic registers that were
previously unimplemented (or incompletely implemented) for
hardware-isolated CVMs, so that a guest VSM (VTL 1) running inside a CVM
can query partition/VP VSM state. Also fixes a bug in HvEnableVpVtl when
the caller targets itself via HV_VP_INDEX_SELF.

Tested: via private updates to opentmk, booting partner VHD

Fixes microsoft#3797, fixes microsoft#3798
Copilot AI lite review requested due to automatic review settings August 13, 2026 18:51
@sluck-msft
sluck-msft requested a review from a team as a code owner August 13, 2026 18:51
@sluck-msft sluck-msft added the release_1.8.2607 Targets the release/1.8.2607 branch. label Aug 13, 2026

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.

Pull request overview

Backport that completes guest-VSM (VTL1-in-CVM) support by implementing previously missing VSM synthetic register handling and correcting VP targeting semantics for HvEnableVpVtl, enabling VTL1 guests to query VSM partition/VP state reliably.

Changes:

  • Implemented VsmPartitionConfig, VsmPartitionStatus, VsmVpStatus, and extended VsmCapabilities register handling (plus access checks) for hardware-isolated CVMs.
  • Fixed HvEnableVpVtl to correctly resolve HV_VP_INDEX_SELF to the calling VP.
  • Added small supporting utilities (VtlSet::with_vtl, From<VtlSet> for u16, and new state fields for tracking privilege/MBEC status).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
vm/hv1/hv1_structs/src/vtl_array.rs Adds VtlSet builder + conversion helpers used by new VSM register implementations.
openhcl/virt_mshv_vtl/src/processor/hardware_cvm/mod.rs Implements/validates VSM register access, returns VSM partition/VP status, and fixes HV_VP_INDEX_SELF handling in EnableVpVtl.
openhcl/virt_mshv_vtl/src/lib.rs Extends CVM state to track per-VP MBEC and stores access-VSM privilege snapshot for register-access validation.
openhcl/virt_mshv_vtl/src/cvm_cpuid/tdx.rs Updates exposed Hyper-V privilege set for TDX CVMs (now includes VP register access).
openhcl/virt_mshv_vtl/src/cvm_cpuid/snp.rs Updates exposed Hyper-V privilege set for SNP CVMs (now includes VP register access).

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

Comment on lines 305 to 313
let privileges = hv1_emulator::cpuid::SUPPORTED_PRIVILEGES
.with_access_frequency_msrs(true)
.with_access_apic_msrs(true)
.with_start_virtual_processor(true)
.with_enable_extended_gva_ranges_flush_va_list(true)
.with_access_guest_idle_msr(true)
.with_access_vsm(self.access_vsm)
.with_access_vp_registers(true)
.with_isolation(true)
Comment on lines +428 to +433
Ok(u64::from(
HvRegisterVsmPartitionConfig::new()
.with_enable_vtl_protection(protector.vtl1_protections_enabled())
.with_default_vtl_protection_mask(u32::from(default_protections) as u8)
.with_zero_memory_on_reset(vtl1.zero_memory_on_reset)
.with_deny_lower_vtl_startup(vtl1.deny_lower_vtl_startup),
Comment on lines 407 to 415
let privileges = hv1_emulator::cpuid::SUPPORTED_PRIVILEGES
.with_access_frequency_msrs(true)
.with_access_apic_msrs(true)
.with_start_virtual_processor(true)
.with_enable_extended_gva_ranges_flush_va_list(true)
.with_access_guest_idle_msr(true)
.with_access_vsm(self.access_vsm)
.with_access_vp_registers(true)
.with_isolation(true)
@github-actions

Copy link
Copy Markdown

@smalis-msft
Steven Malis (smalis-msft) merged commit b4c3993 into microsoft:release/1.8.2607 Aug 13, 2026
93 of 94 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release_1.8.2607 Targets the release/1.8.2607 branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants