-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PAL/Linux-SGX] Add Invariant TSC query fallback for hypervisors
Some hypervisors (like QEMU with KVM) do not expose CPUID leaves 0x15 and 0x16 (Core Crystal Clock/Process Frequency). Instead, hypervisor-specific synthetic CPUID leaf 0x40000010 shows TSC frequency. Unfortunately, leaf 0x40000010 is not standardized, and some other hypervisor (e.g. MS Hyper-V) could use this leaf for something else other than TSC frequency. To work around this, we check the `hypervisor_id` value in leaf 0x40000000, and only use 0x40000010 if the value is "KVMKVMKVM" (that's how QEMU with KVM identifies itself) or "VMwareVMware". To date, we know that VMWare, QEMU/KVM and Cloud Hypervisor/KVM expose this TSC-frequency leaf 0x40000010. MS Hyper-V does not expose this leaf. We don't know about other hypervisors. Note that QEMU must start the VM with CPU flags `+invtsc,+vmware-cpuid-freq` to expose required CPUID leaves. Signed-off-by: Dmitrii Kuvaiskii <[email protected]>
- Loading branch information
Dmitrii Kuvaiskii
committed
Aug 3, 2023
1 parent
7485c90
commit a479631
Showing
4 changed files
with
124 additions
and
47 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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