diff options
Diffstat (limited to 'virt/kvm')
-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 44589088941f..d0c668c6959e 100644 --- a/virt/kvm/ioapic.c +++ b/virt/kvm/ioapic.c | |||
@@ -146,6 +146,11 @@ static int ioapic_inj_irq(struct kvm_ioapic *ioapic, | |||
146 | return kvm_apic_set_irq(vcpu, vector, trig_mode); | 146 | return kvm_apic_set_irq(vcpu, vector, trig_mode); |
147 | } | 147 | } |
148 | 148 | ||
149 | static void ioapic_inj_nmi(struct kvm_vcpu *vcpu) | ||
150 | { | ||
151 | kvm_inject_nmi(vcpu); | ||
152 | } | ||
153 | |||
149 | static u32 ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest, | 154 | static u32 ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest, |
150 | u8 dest_mode) | 155 | u8 dest_mode) |
151 | { | 156 | { |
@@ -239,8 +244,19 @@ static int ioapic_deliver(struct kvm_ioapic *ioapic, int irq) | |||
239 | } | 244 | } |
240 | } | 245 | } |
241 | break; | 246 | break; |
242 | 247 | case IOAPIC_NMI: | |
243 | /* TODO: NMI */ | 248 | for (vcpu_id = 0; deliver_bitmask != 0; vcpu_id++) { |
249 | if (!(deliver_bitmask & (1 << vcpu_id))) | ||
250 | continue; | ||
251 | deliver_bitmask &= ~(1 << vcpu_id); | ||
252 | vcpu = ioapic->kvm->vcpus[vcpu_id]; | ||
253 | if (vcpu) | ||
254 | ioapic_inj_nmi(vcpu); | ||
255 | else | ||
256 | ioapic_debug("NMI to vcpu %d failed\n", | ||
257 | vcpu->vcpu_id); | ||
258 | } | ||
259 | break; | ||
244 | default: | 260 | default: |
245 | printk(KERN_WARNING "Unsupported delivery mode %d\n", | 261 | printk(KERN_WARNING "Unsupported delivery mode %d\n", |
246 | delivery_mode); | 262 | delivery_mode); |