aboutsummaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2010-07-11 08:32:23 -0400
committerAvi Kivity <avi@redhat.com>2010-08-01 23:40:39 -0400
commit4a994358b919c3b14de61be5e30d9edc9089ba3f (patch)
tree122e0cc88dbb97733b02aac0e5e30e33d592444a /virt
parent2e2602ca5df09e4c4e2b593bc30abead9a8617d4 (diff)
KVM: Convert mask notifiers to use irqchip/pin instead of gsi
Devices register mask notifier using gsi, but irqchip knows about irqchip/pin, so conversion from irqchip/pin to gsi should be done before looking for mask notifier to call. 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.c2
-rw-r--r--virt/kvm/irq_comm.c12
2 files changed, 9 insertions, 5 deletions
diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c
index 1149c60b198f..0b9df8303dcf 100644
--- a/virt/kvm/ioapic.c
+++ b/virt/kvm/ioapic.c
@@ -152,7 +152,7 @@ static void ioapic_write_indirect(struct kvm_ioapic *ioapic, u32 val)
152 update_handled_vectors(ioapic); 152 update_handled_vectors(ioapic);
153 mask_after = e->fields.mask; 153 mask_after = e->fields.mask;
154 if (mask_before != mask_after) 154 if (mask_before != mask_after)
155 kvm_fire_mask_notifiers(ioapic->kvm, index, mask_after); 155 kvm_fire_mask_notifiers(ioapic->kvm, KVM_IRQCHIP_IOAPIC, index, mask_after);
156 if (e->fields.trig_mode == IOAPIC_LEVEL_TRIG 156 if (e->fields.trig_mode == IOAPIC_LEVEL_TRIG
157 && ioapic->irr & (1 << index)) 157 && ioapic->irr & (1 << index))
158 ioapic_service(ioapic, index); 158 ioapic_service(ioapic, index);
diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
index 06cf61e729d2..369e38010ad5 100644
--- a/virt/kvm/irq_comm.c
+++ b/virt/kvm/irq_comm.c
@@ -279,15 +279,19 @@ void kvm_unregister_irq_mask_notifier(struct kvm *kvm, int irq,
279 synchronize_rcu(); 279 synchronize_rcu();
280} 280}
281 281
282void kvm_fire_mask_notifiers(struct kvm *kvm, int irq, bool mask) 282void kvm_fire_mask_notifiers(struct kvm *kvm, unsigned irqchip, unsigned pin,
283 bool mask)
283{ 284{
284 struct kvm_irq_mask_notifier *kimn; 285 struct kvm_irq_mask_notifier *kimn;
285 struct hlist_node *n; 286 struct hlist_node *n;
287 int gsi;
286 288
287 rcu_read_lock(); 289 rcu_read_lock();
288 hlist_for_each_entry_rcu(kimn, n, &kvm->mask_notifier_list, link) 290 gsi = rcu_dereference(kvm->irq_routing)->chip[irqchip][pin];
289 if (kimn->irq == irq) 291 if (gsi != -1)
290 kimn->func(kimn, mask); 292 hlist_for_each_entry_rcu(kimn, n, &kvm->mask_notifier_list, link)
293 if (kimn->irq == gsi)
294 kimn->func(kimn, mask);
291 rcu_read_unlock(); 295 rcu_read_unlock();
292} 296}
293 297