diff options
author | Sheng Yang <sheng.yang@intel.com> | 2008-05-15 09:52:48 +0800 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-07-20 12:42:25 +0300 |
commit | 3419ffc8e45a5344abc87684cbca6cdc5c9c8a01 (patch) | |
tree | 53d00e67ba8844800d1f73242ce42fad117f0eaf /virt | |
parent | 50d40d7fb9b09e68a657c68837fcfa067b70cc42 (diff) |
KVM: IOAPIC/LAPIC: Enable NMI support
[avi: fix ia64 build breakage]
Signed-off-by: Sheng Yang <sheng.yang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/ioapic.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c index 44589088941..d0c668c6959 100644 --- a/virt/kvm/ioapic.c +++ b/virt/kvm/ioapic.c @@ -146,6 +146,11 @@ static int ioapic_inj_irq(struct kvm_ioapic *ioapic, return kvm_apic_set_irq(vcpu, vector, trig_mode); } +static void ioapic_inj_nmi(struct kvm_vcpu *vcpu) +{ + kvm_inject_nmi(vcpu); +} + static u32 ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest, u8 dest_mode) { @@ -239,8 +244,19 @@ static int ioapic_deliver(struct kvm_ioapic *ioapic, int irq) } } break; - - /* TODO: NMI */ + case IOAPIC_NMI: + for (vcpu_id = 0; deliver_bitmask != 0; vcpu_id++) { + if (!(deliver_bitmask & (1 << vcpu_id))) + continue; + deliver_bitmask &= ~(1 << vcpu_id); + vcpu = ioapic->kvm->vcpus[vcpu_id]; + if (vcpu) + ioapic_inj_nmi(vcpu); + else + ioapic_debug("NMI to vcpu %d failed\n", + vcpu->vcpu_id); + } + break; default: printk(KERN_WARNING "Unsupported delivery mode %d\n", delivery_mode); |