aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm/ioapic.c
diff options
context:
space:
mode:
Diffstat (limited to 'virt/kvm/ioapic.c')
-rw-r--r--virt/kvm/ioapic.c40
1 files changed, 6 insertions, 34 deletions
diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c
index ea268a8c37da..d4a7948b010c 100644
--- a/virt/kvm/ioapic.c
+++ b/virt/kvm/ioapic.c
@@ -142,25 +142,6 @@ static void ioapic_write_indirect(struct kvm_ioapic *ioapic, u32 val)
142 } 142 }
143} 143}
144 144
145static int ioapic_inj_irq(struct kvm_ioapic *ioapic,
146 struct kvm_vcpu *vcpu,
147 u8 vector, u8 trig_mode, u8 delivery_mode)
148{
149 ioapic_debug("irq %d trig %d deliv %d\n", vector, trig_mode,
150 delivery_mode);
151
152 ASSERT((delivery_mode == IOAPIC_FIXED) ||
153 (delivery_mode == IOAPIC_LOWEST_PRIORITY));
154
155 return kvm_apic_set_irq(vcpu, vector, trig_mode);
156}
157
158static void ioapic_inj_nmi(struct kvm_vcpu *vcpu)
159{
160 kvm_inject_nmi(vcpu);
161 kvm_vcpu_kick(vcpu);
162}
163
164static int ioapic_deliver(struct kvm_ioapic *ioapic, int irq) 145static int ioapic_deliver(struct kvm_ioapic *ioapic, int irq)
165{ 146{
166 union kvm_ioapic_redirect_entry entry = ioapic->redirtbl[irq]; 147 union kvm_ioapic_redirect_entry entry = ioapic->redirtbl[irq];
@@ -193,21 +174,12 @@ static int ioapic_deliver(struct kvm_ioapic *ioapic, int irq)
193 __clear_bit(vcpu_id, deliver_bitmask); 174 __clear_bit(vcpu_id, deliver_bitmask);
194 vcpu = ioapic->kvm->vcpus[vcpu_id]; 175 vcpu = ioapic->kvm->vcpus[vcpu_id];
195 if (vcpu) { 176 if (vcpu) {
196 if (entry.fields.delivery_mode == 177 if (r < 0)
197 IOAPIC_LOWEST_PRIORITY || 178 r = 0;
198 entry.fields.delivery_mode == IOAPIC_FIXED) { 179 r += kvm_apic_set_irq(vcpu,
199 if (r < 0) 180 entry.fields.vector,
200 r = 0; 181 entry.fields.trig_mode,
201 r += ioapic_inj_irq(ioapic, vcpu, 182 entry.fields.delivery_mode);
202 entry.fields.vector,
203 entry.fields.trig_mode,
204 entry.fields.delivery_mode);
205 } else if (entry.fields.delivery_mode == IOAPIC_NMI) {
206 r = 1;
207 ioapic_inj_nmi(vcpu);
208 } else
209 ioapic_debug("unsupported delivery mode %x!\n",
210 entry.fields.delivery_mode);
211 } else 183 } else
212 ioapic_debug("null destination vcpu: " 184 ioapic_debug("null destination vcpu: "
213 "mask=%x vector=%x delivery_mode=%x\n", 185 "mask=%x vector=%x delivery_mode=%x\n",