kvm: add support for reading tsc frequency via cpuid.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20200310102248.28412-3-kraxel@redhat.com
This commit is contained in:
Gerd Hoffmann 2020-03-10 11:22:47 +01:00
parent d68335174d
commit 34160e0525
1 changed files with 5 additions and 0 deletions

View File

@ -67,6 +67,11 @@ static void kvm_detect(void)
if (strcmp(signature, "KVMKVMKVM") == 0) {
dprintf(1, "Running on KVM\n");
PlatformRunningOn |= PF_KVM;
if (eax >= KVM_CPUID_SIGNATURE + 0x10) {
cpuid(KVM_CPUID_SIGNATURE + 0x10, &eax, &ebx, &ecx, &edx);
dprintf(1, "kvm: have invtsc, freq %u kHz\n", eax);
tsctimer_setfreq(eax, "invtsc");
}
}
}