[release/1.8.2607] cvm guest vsm: implement missing register handling (#4161) - #4236
Merged
Steven Malis (smalis-msft) merged 1 commit intoAug 13, 2026
Conversation
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
Contributor
There was a problem hiding this comment.
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 extendedVsmCapabilitiesregister handling (plus access checks) for hardware-isolated CVMs. - Fixed
HvEnableVpVtlto correctly resolveHV_VP_INDEX_SELFto 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) |
Mike Ebersol (mebersol)
approved these changes
Aug 13, 2026
Steven Malis (smalis-msft)
merged commit Aug 13, 2026
b4c3993
into
microsoft:release/1.8.2607
93 of 94 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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