Commit c69518c8 authored by Wanpeng Li's avatar Wanpeng Li Committed by Paolo Bonzini

KVM: LAPIC: Fix lapic timer mode transition

SDM 10.5.4.1 TSC-Deadline Mode mentioned that "Transitioning between TSC-Deadline
mode and other timer modes also disarms the timer". So the APIC Timer Initial Count
Register for one-shot/periodic mode should be reset. This patch do it.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: default avatarWanpeng Li <wanpeng.li@hotmail.com>
[Removed unnecessary definition of APIC_LVT_TIMER_MASK.]
Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
parent 9cc5fbbb
...@@ -1307,6 +1307,9 @@ static void apic_update_lvtt(struct kvm_lapic *apic) ...@@ -1307,6 +1307,9 @@ static void apic_update_lvtt(struct kvm_lapic *apic)
apic->lapic_timer.timer_mode_mask; apic->lapic_timer.timer_mode_mask;
if (apic->lapic_timer.timer_mode != timer_mode) { if (apic->lapic_timer.timer_mode != timer_mode) {
if (apic_lvtt_tscdeadline(apic) != (timer_mode ==
APIC_LVT_TIMER_TSCDEADLINE))
kvm_lapic_set_reg(apic, APIC_TMICT, 0);
apic->lapic_timer.timer_mode = timer_mode; apic->lapic_timer.timer_mode = timer_mode;
hrtimer_cancel(&apic->lapic_timer.timer); hrtimer_cancel(&apic->lapic_timer.timer);
} }
......
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