mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
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>