diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2008-09-26 03:30:52 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2008-12-31 09:51:41 -0500 |
commit | 23930f9521c9c4d4aa96cdb9d1e1703f3782bb94 (patch) | |
tree | f5bf96bdc4515cc976e1dcf1fb950454276aabf8 /arch/x86/kvm/i8254.c | |
parent | 66a5a347c2690db4c0756524a8eb5a05e0437aa8 (diff) |
KVM: x86: Enable NMI Watchdog via in-kernel PIT source
LINT0 of the LAPIC can be used to route PIT events as NMI watchdog ticks
into the guest. This patch aligns the in-kernel irqchip emulation with
the user space irqchip with already supports this feature. The trick is
to route PIT interrupts to all LAPIC's LVT0 lines.
Rebased and slightly polished patch originally posted by Sheng Yang.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Sheng Yang <sheng.yang@intel.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/i8254.c')
-rw-r--r-- | arch/x86/kvm/i8254.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index 59ebd37ad79e..580cc1d01c7d 100644 --- a/arch/x86/kvm/i8254.c +++ b/arch/x86/kvm/i8254.c | |||
@@ -603,10 +603,25 @@ void kvm_free_pit(struct kvm *kvm) | |||
603 | 603 | ||
604 | static void __inject_pit_timer_intr(struct kvm *kvm) | 604 | static void __inject_pit_timer_intr(struct kvm *kvm) |
605 | { | 605 | { |
606 | struct kvm_vcpu *vcpu; | ||
607 | int i; | ||
608 | |||
606 | mutex_lock(&kvm->lock); | 609 | mutex_lock(&kvm->lock); |
607 | kvm_set_irq(kvm, kvm->arch.vpit->irq_source_id, 0, 1); | 610 | kvm_set_irq(kvm, kvm->arch.vpit->irq_source_id, 0, 1); |
608 | kvm_set_irq(kvm, kvm->arch.vpit->irq_source_id, 0, 0); | 611 | kvm_set_irq(kvm, kvm->arch.vpit->irq_source_id, 0, 0); |
609 | mutex_unlock(&kvm->lock); | 612 | mutex_unlock(&kvm->lock); |
613 | |||
614 | /* | ||
615 | * Provides NMI watchdog support in IOAPIC mode. | ||
616 | * The route is: PIT -> PIC -> LVT0 in NMI mode, | ||
617 | * timer IRQs will continue to flow through the IOAPIC. | ||
618 | */ | ||
619 | for (i = 0; i < KVM_MAX_VCPUS; ++i) { | ||
620 | vcpu = kvm->vcpus[i]; | ||
621 | if (!vcpu) | ||
622 | continue; | ||
623 | kvm_apic_local_deliver(vcpu, APIC_LVT0); | ||
624 | } | ||
610 | } | 625 | } |
611 | 626 | ||
612 | void kvm_inject_pit_timer_irqs(struct kvm_vcpu *vcpu) | 627 | void kvm_inject_pit_timer_irqs(struct kvm_vcpu *vcpu) |