diff options
author | Gleb Natapov <gleb@redhat.com> | 2009-03-05 09:34:44 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-06-10 04:48:26 -0400 |
commit | 6da7e3f643cf7099965d75fda8606b9d3a8650b9 (patch) | |
tree | af1ae2e8e3cca59c127d252b3f84efda1dfadc5d /virt | |
parent | f5a1e9f89504f57b2b45645a7239dc8a8ddb0f4c (diff) |
KVM: APIC: kvm_apic_set_irq deliver all kinds of interrupts
Get rid of ioapic_inj_irq() and ioapic_inj_nmi() functions.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/ioapic.c | 40 | ||||
-rw-r--r-- | virt/kvm/irq_comm.c | 1 |
2 files changed, 7 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 | ||
145 | static 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 | |||
158 | static void ioapic_inj_nmi(struct kvm_vcpu *vcpu) | ||
159 | { | ||
160 | kvm_inject_nmi(vcpu); | ||
161 | kvm_vcpu_kick(vcpu); | ||
162 | } | ||
163 | |||
164 | static int ioapic_deliver(struct kvm_ioapic *ioapic, int irq) | 145 | static 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", |
diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c index 1c6ff6d1b842..325c6685f206 100644 --- a/virt/kvm/irq_comm.c +++ b/virt/kvm/irq_comm.c | |||
@@ -148,6 +148,7 @@ static int kvm_set_msi(struct kvm_kernel_irq_routing_entry *e, | |||
148 | if (r < 0) | 148 | if (r < 0) |
149 | r = 0; | 149 | r = 0; |
150 | r += kvm_apic_set_irq(vcpu, entry.fields.vector, | 150 | r += kvm_apic_set_irq(vcpu, entry.fields.vector, |
151 | entry.fields.dest_mode, | ||
151 | entry.fields.trig_mode); | 152 | entry.fields.trig_mode); |
152 | } | 153 | } |
153 | } | 154 | } |