]> xenbits.xensource.com Git - seabios.git/commitdiff
kvm: add support for reading tsc frequency via cpuid.
authorGerd Hoffmann <kraxel@redhat.com>
Tue, 10 Mar 2020 10:22:47 +0000 (11:22 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Mon, 16 Mar 2020 13:29:41 +0000 (14:29 +0100)
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20200310102248.28412-3-kraxel@redhat.com

src/fw/paravirt.c

index ef420931b9a5aae1f403cff9b44d28a651272b9b..1e3d6012700b4b9e0326100c3ae2d395b403df87 100644 (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");
+        }
     }
 }