Skip to content

Commit

Permalink
kvm: i386: require KVM_CAP_ADJUST_CLOCK
Browse files Browse the repository at this point in the history
This was introduced in KVM in Linux 2.6.33, we can require it
unconditionally.  KVM_CLOCK_TSC_STABLE was only added in Linux 4.9,
for now do not require it (though it would allow the removal of some
pretty yucky code).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
bonzini committed Oct 25, 2023
1 parent 86f2438 commit 700766b
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 10 deletions.
4 changes: 0 additions & 4 deletions hw/i386/kvm/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,6 @@ void kvmclock_create(bool create_always)
X86CPU *cpu = X86_CPU(first_cpu);

assert(kvm_enabled());
if (!kvm_has_adjust_clock()) {
return;
}

if (create_always ||
cpu->env.features[FEAT_KVM] & ((1ULL << KVM_FEATURE_CLOCKSOURCE) |
(1ULL << KVM_FEATURE_CLOCKSOURCE2))) {
Expand Down
6 changes: 1 addition & 5 deletions target/i386/kvm/kvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ const KVMCapabilityInfo kvm_arch_required_capabilities[] = {
KVM_CAP_INFO(VCPU_EVENTS),
KVM_CAP_INFO(X86_ROBUST_SINGLESTEP),
KVM_CAP_INFO(MCE),
KVM_CAP_INFO(ADJUST_CLOCK),
KVM_CAP_LAST_INFO
};

Expand Down Expand Up @@ -177,11 +178,6 @@ 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;
Expand Down
1 change: 0 additions & 1 deletion target/i386/kvm/kvm_i386.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ void kvm_request_xsave_components(X86CPU *cpu, uint64_t mask);

#ifdef CONFIG_KVM

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);
Expand Down

0 comments on commit 700766b

Please sign in to comment.