Commit 7e810a38 authored by Wanpeng Li's avatar Wanpeng Li Committed by Paolo Bonzini

KVM: LAPIC: rename start/cancel_hv_tscdeadline to start/cancel_hv_timer

Rename start/cancel_hv_tscdeadline to start/cancel_hv_timer since
they will handle both APIC Timer periodic/oneshot mode and tsc-deadline
mode.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: Yunhong Jiang <yunhong.jiang@intel.com>
Signed-off-by: default avatarWanpeng Li <wanpeng.li@hotmail.com>
Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
parent 498f8162
...@@ -1400,7 +1400,7 @@ bool kvm_lapic_hv_timer_in_use(struct kvm_vcpu *vcpu) ...@@ -1400,7 +1400,7 @@ bool kvm_lapic_hv_timer_in_use(struct kvm_vcpu *vcpu)
} }
EXPORT_SYMBOL_GPL(kvm_lapic_hv_timer_in_use); EXPORT_SYMBOL_GPL(kvm_lapic_hv_timer_in_use);
static void cancel_hv_tscdeadline(struct kvm_lapic *apic) static void cancel_hv_timer(struct kvm_lapic *apic)
{ {
kvm_x86_ops->cancel_hv_timer(apic->vcpu); kvm_x86_ops->cancel_hv_timer(apic->vcpu);
apic->lapic_timer.hv_timer_in_use = false; apic->lapic_timer.hv_timer_in_use = false;
...@@ -1412,26 +1412,26 @@ void kvm_lapic_expired_hv_timer(struct kvm_vcpu *vcpu) ...@@ -1412,26 +1412,26 @@ void kvm_lapic_expired_hv_timer(struct kvm_vcpu *vcpu)
WARN_ON(!apic->lapic_timer.hv_timer_in_use); WARN_ON(!apic->lapic_timer.hv_timer_in_use);
WARN_ON(swait_active(&vcpu->wq)); WARN_ON(swait_active(&vcpu->wq));
cancel_hv_tscdeadline(apic); cancel_hv_timer(apic);
apic_timer_expired(apic); apic_timer_expired(apic);
} }
EXPORT_SYMBOL_GPL(kvm_lapic_expired_hv_timer); EXPORT_SYMBOL_GPL(kvm_lapic_expired_hv_timer);
static bool start_hv_tscdeadline(struct kvm_lapic *apic) static bool start_hv_timer(struct kvm_lapic *apic)
{ {
u64 tscdeadline = apic->lapic_timer.tscdeadline; u64 tscdeadline = apic->lapic_timer.tscdeadline;
if (atomic_read(&apic->lapic_timer.pending) || if (atomic_read(&apic->lapic_timer.pending) ||
kvm_x86_ops->set_hv_timer(apic->vcpu, tscdeadline)) { kvm_x86_ops->set_hv_timer(apic->vcpu, tscdeadline)) {
if (apic->lapic_timer.hv_timer_in_use) if (apic->lapic_timer.hv_timer_in_use)
cancel_hv_tscdeadline(apic); cancel_hv_timer(apic);
} else { } else {
apic->lapic_timer.hv_timer_in_use = true; apic->lapic_timer.hv_timer_in_use = true;
hrtimer_cancel(&apic->lapic_timer.timer); hrtimer_cancel(&apic->lapic_timer.timer);
/* In case the sw timer triggered in the window */ /* In case the sw timer triggered in the window */
if (atomic_read(&apic->lapic_timer.pending)) if (atomic_read(&apic->lapic_timer.pending))
cancel_hv_tscdeadline(apic); cancel_hv_timer(apic);
} }
trace_kvm_hv_timer_state(apic->vcpu->vcpu_id, trace_kvm_hv_timer_state(apic->vcpu->vcpu_id,
apic->lapic_timer.hv_timer_in_use); apic->lapic_timer.hv_timer_in_use);
...@@ -1445,7 +1445,7 @@ void kvm_lapic_switch_to_hv_timer(struct kvm_vcpu *vcpu) ...@@ -1445,7 +1445,7 @@ void kvm_lapic_switch_to_hv_timer(struct kvm_vcpu *vcpu)
WARN_ON(apic->lapic_timer.hv_timer_in_use); WARN_ON(apic->lapic_timer.hv_timer_in_use);
if (apic_lvtt_tscdeadline(apic)) if (apic_lvtt_tscdeadline(apic))
start_hv_tscdeadline(apic); start_hv_timer(apic);
} }
EXPORT_SYMBOL_GPL(kvm_lapic_switch_to_hv_timer); EXPORT_SYMBOL_GPL(kvm_lapic_switch_to_hv_timer);
...@@ -1457,7 +1457,7 @@ void kvm_lapic_switch_to_sw_timer(struct kvm_vcpu *vcpu) ...@@ -1457,7 +1457,7 @@ void kvm_lapic_switch_to_sw_timer(struct kvm_vcpu *vcpu)
if (!apic->lapic_timer.hv_timer_in_use) if (!apic->lapic_timer.hv_timer_in_use)
return; return;
cancel_hv_tscdeadline(apic); cancel_hv_timer(apic);
if (atomic_read(&apic->lapic_timer.pending)) if (atomic_read(&apic->lapic_timer.pending))
return; return;
...@@ -1473,7 +1473,7 @@ static void start_apic_timer(struct kvm_lapic *apic) ...@@ -1473,7 +1473,7 @@ static void start_apic_timer(struct kvm_lapic *apic)
if (apic_lvtt_period(apic) || apic_lvtt_oneshot(apic)) if (apic_lvtt_period(apic) || apic_lvtt_oneshot(apic))
start_sw_period(apic); start_sw_period(apic);
else if (apic_lvtt_tscdeadline(apic)) { else if (apic_lvtt_tscdeadline(apic)) {
if (!(kvm_x86_ops->set_hv_timer && start_hv_tscdeadline(apic))) if (!(kvm_x86_ops->set_hv_timer && start_hv_timer(apic)))
start_sw_tscdeadline(apic); start_sw_tscdeadline(apic);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment