Branch: refs/heads/master
  Home:   https://github.com/tianocore/edk2
  Commit: cc59ae908f4d651fe0f262900160b500c2926245
      
https://github.com/tianocore/edk2/commit/cc59ae908f4d651fe0f262900160b500c2926245
  Author: Doug Cook <[email protected]>
  Date:   2026-09-28 (Mon, 28 Sep 2026)

  Changed paths:
    M OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.c

  Log Message:
  -----------
  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 <[email protected]>



To unsubscribe from these emails, change your notification settings at 
https://github.com/tianocore/edk2/settings/notifications


_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to