diff options
Diffstat (limited to 'virt/kvm/ioapic.c')
-rw-r--r-- | virt/kvm/ioapic.c | 46 |
1 files changed, 3 insertions, 43 deletions
diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c index 7c2cb2bd1199..ea268a8c37da 100644 --- a/virt/kvm/ioapic.c +++ b/virt/kvm/ioapic.c | |||
@@ -161,45 +161,6 @@ static void ioapic_inj_nmi(struct kvm_vcpu *vcpu) | |||
161 | kvm_vcpu_kick(vcpu); | 161 | kvm_vcpu_kick(vcpu); |
162 | } | 162 | } |
163 | 163 | ||
164 | void kvm_ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest, | ||
165 | u8 dest_mode, unsigned long *mask) | ||
166 | { | ||
167 | int i; | ||
168 | struct kvm *kvm = ioapic->kvm; | ||
169 | struct kvm_vcpu *vcpu; | ||
170 | |||
171 | ioapic_debug("dest %d dest_mode %d\n", dest, dest_mode); | ||
172 | |||
173 | *mask = 0; | ||
174 | if (dest_mode == 0) { /* Physical mode. */ | ||
175 | if (dest == 0xFF) { /* Broadcast. */ | ||
176 | for (i = 0; i < KVM_MAX_VCPUS; ++i) | ||
177 | if (kvm->vcpus[i] && kvm->vcpus[i]->arch.apic) | ||
178 | *mask |= 1 << i; | ||
179 | return; | ||
180 | } | ||
181 | for (i = 0; i < KVM_MAX_VCPUS; ++i) { | ||
182 | vcpu = kvm->vcpus[i]; | ||
183 | if (!vcpu) | ||
184 | continue; | ||
185 | if (kvm_apic_match_physical_addr(vcpu->arch.apic, dest)) { | ||
186 | if (vcpu->arch.apic) | ||
187 | *mask = 1 << i; | ||
188 | break; | ||
189 | } | ||
190 | } | ||
191 | } else if (dest != 0) /* Logical mode, MDA non-zero. */ | ||
192 | for (i = 0; i < KVM_MAX_VCPUS; ++i) { | ||
193 | vcpu = kvm->vcpus[i]; | ||
194 | if (!vcpu) | ||
195 | continue; | ||
196 | if (vcpu->arch.apic && | ||
197 | kvm_apic_match_logical_addr(vcpu->arch.apic, dest)) | ||
198 | *mask |= 1 << vcpu->vcpu_id; | ||
199 | } | ||
200 | ioapic_debug("mask %x\n", *mask); | ||
201 | } | ||
202 | |||
203 | static int ioapic_deliver(struct kvm_ioapic *ioapic, int irq) | 164 | static int ioapic_deliver(struct kvm_ioapic *ioapic, int irq) |
204 | { | 165 | { |
205 | union kvm_ioapic_redirect_entry entry = ioapic->redirtbl[irq]; | 166 | union kvm_ioapic_redirect_entry entry = ioapic->redirtbl[irq]; |
@@ -213,13 +174,12 @@ static int ioapic_deliver(struct kvm_ioapic *ioapic, int irq) | |||
213 | entry.fields.delivery_mode, entry.fields.vector, | 174 | entry.fields.delivery_mode, entry.fields.vector, |
214 | entry.fields.trig_mode); | 175 | entry.fields.trig_mode); |
215 | 176 | ||
216 | bitmap_zero(deliver_bitmask, KVM_MAX_VCPUS); | ||
217 | |||
218 | /* Always delivery PIT interrupt to vcpu 0 */ | 177 | /* Always delivery PIT interrupt to vcpu 0 */ |
219 | #ifdef CONFIG_X86 | 178 | #ifdef CONFIG_X86 |
220 | if (irq == 0) | 179 | if (irq == 0) { |
180 | bitmap_zero(deliver_bitmask, KVM_MAX_VCPUS); | ||
221 | __set_bit(0, deliver_bitmask); | 181 | __set_bit(0, deliver_bitmask); |
222 | else | 182 | } else |
223 | #endif | 183 | #endif |
224 | kvm_get_intr_delivery_bitmask(ioapic, &entry, deliver_bitmask); | 184 | kvm_get_intr_delivery_bitmask(ioapic, &entry, deliver_bitmask); |
225 | 185 | ||