aboutsummaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorVitaly Kuznetsov <vkuznets@redhat.com>2020-09-22 17:19:34 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2020-09-30 19:11:36 +0200
commit8700a984436e561e29903731d7db11a4b61acd76 (patch)
treea9b4fdc36bed5166aab397b6420a21d1b54fe577 /target
parent6615be072dbb88d306cd1647c7c7b694682bac5e (diff)
target/i386: always create kvmclock device
QEMU's kvmclock device is only created when KVM PV feature bits for kvmclock (KVM_FEATURE_CLOCKSOURCE/KVM_FEATURE_CLOCKSOURCE2) are exposed to the guest. With 'kvm=off' cpu flag the device is not created and we don't call KVM_GET_CLOCK/KVM_SET_CLOCK upon migration. It was reported that without these call at least Hyper-V TSC page clocksouce (which can be enabled independently) gets broken after migration. Switch to creating kvmclock QEMU device unconditionally, it seems to always make sense to call KVM_GET_CLOCK/KVM_SET_CLOCK on migration. Use KVM_CAP_ADJUST_CLOCK check instead of CPUID feature bits. Reported-by: Antoine Damhet <antoine.damhet@blade-group.com> Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Message-Id: <20200922151934.899555-1-vkuznets@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'target')
-rw-r--r--target/i386/kvm.c5
-rw-r--r--target/i386/kvm_i386.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index b327e8706f..4fc6e8b9d5 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -143,6 +143,11 @@ bool kvm_has_adjust_clock_stable(void)
return (ret == KVM_CLOCK_TSC_STABLE);
}
+bool kvm_has_adjust_clock(void)
+{
+ return kvm_check_extension(kvm_state, KVM_CAP_ADJUST_CLOCK);
+}
+
bool kvm_has_exception_payload(void)
{
return has_exception_payload;
diff --git a/target/i386/kvm_i386.h b/target/i386/kvm_i386.h
index 064b8798a2..0fce4e51d2 100644
--- a/target/i386/kvm_i386.h
+++ b/target/i386/kvm_i386.h
@@ -34,6 +34,7 @@
bool kvm_allows_irq0_override(void);
bool kvm_has_smm(void);
+bool kvm_has_adjust_clock(void);
bool kvm_has_adjust_clock_stable(void);
bool kvm_has_exception_payload(void);
void kvm_synchronize_all_tsc(void);