diff options
| author | Doug Cook <dcook@microsoft.com> | 2026-09-26 00:10:42 +0300 |
|---|---|---|
| committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2026-09-28 15:47:39 +0300 |
| commit | cc59ae908f4d651fe0f262900160b500c2926245 (patch) | |
| tree | 55cd3dfc3dfd1faab9ca5df8b0f1a8f14add8fd9 /MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf | |
| parent | a9a0a7dee0cf1552ae79a59d8c83a1dfd8d416f0 (diff) | |
| download | edk2-cc59ae908f4d651fe0f262900160b500c2926245.tar.xz | |
OvmfPkg/LocalApicTimerDxe: Ask the hypervisor for the APIC timer frequency
LocalApicTimerDxe programs the local APIC timer on the assumption that
it counts at PcdFSBClock (fixed at 1 GHz). Under WHPX, QEMU uses the Hyper-V
in-kernel APIC (typically 200 MHz). Every timer tick is then five
times longer than requested. This affects performance, e.g. asynchronous NVMe
throughput falls by about 5x.
Query the value from the hypervisor, falling back to PcdFSBClock, with
behavior similar to Linux:
- Hyper-V, and anything implementing its interface, exposes
HV_X64_MSR_APIC_FREQUENCY when CPUID 0x40000003 reports the frequency
MSRs as both accessible and available.
- VMware reports the APIC bus frequency in kHz in EBX of CPUID
0x40000010. QEMU provides the same leaf (vmware-cpuid-freq, on by
default) for KVM, and for WHPX with its Hyper-V enlightenments
disabled.
Tested with QEMU 11.1 q35 on a Windows host:
- WHPX (default): HV_X64_MSR_APIC_FREQUENCY = 200 MHz
- WHPX hyperv=off: CPUID 0x40000010 = 200000 kHz
- TCG: no hypervisor leaves, falls back to PcdFSBClock
Writing 1.9 GiB to an emulated NVMe disk through BlockIo2 under WHPX
took 67.7 s before this change and 15.9 s after it.
Signed-off-by: Doug Cook <idigdoug@gmail.com>
Diffstat (limited to 'MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf')
0 files changed, 0 insertions, 0 deletions
