Skip to content

Commit ce9416a

Browse files
tonicmuroqrbradford
authored andcommitted
arch: x86_64: advertise mandatory Hyper-V partition privileges
The Microsoft "Requirements for Implementing the Microsoft Hypervisor Interface" document marks exactly two privileges in CPUID leaf 0x40000003 EAX as "Must be set": AccessHypercallMsrs (bit 5) and AccessVpIndex (bit 6). Cloud Hypervisor advertised neither. Without bit 5, Windows guests abort enlightened-mode initialization before timer-API selection: HalpHvTimerApi is left NULL and every QueryPerformanceCounter call falls back to reading HV_X64_MSR_TIME_REF_COUNT (0x40000020), costing one VM exit per call. The guest never writes HV_X64_MSR_REFERENCE_TSC (0x40000021) to enable the reference TSC page, even though AccessPartitionReferenceTsc (bit 9) is advertised. With both bits set, Windows 10 22H2 and Windows 11 25H2 guests enable the reference TSC page at boot. Measured QueryPerformanceCounter throughput on a nested-KVM host went from ~71K calls/sec (14 us/call, one MSR exit each) to ~1.3M calls/sec (free, no exits); on bare metal from ~390K to ~1.9M calls/sec. Guest idle CPU and interrupt-service time drop correspondingly. Both MSR ranges are already handled in-kernel by KVM unconditionally, so no backend change is needed. Bisection across the full delta to QEMU's Hyper-V CPUID layout (vendor ID, max leaf, leaves 4-6 contents, build number) shows bit 5 is the only load-bearing change; bit 6 is included per the conformance document's mandate. Signed-off-by: Tonic Li <tonic@simular.ai> Signed-off-by: tonic <tonicbupt@gmail.com>
1 parent fffa200 commit ce9416a

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

arch/src/x86_64/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,8 @@ fn required_common_cpuid_updates(
864864
eax: (1 << 1) // AccessPartitionReferenceCounter
865865
| (1 << 2) // AccessSynicRegs
866866
| (1 << 3) // AccessSyntheticTimerRegs
867+
| (1 << 5) // AccessHypercallMsrs
868+
| (1 << 6) // AccessVpIndex
867869
| (1 << 9), // AccessPartitionReferenceTsc
868870
edx: 1 << 3, // CPU dynamic partitioning
869871
..Default::default()

0 commit comments

Comments
 (0)