Skip to contentSkip to conversation

xen: fix de/assert_irq checks

PATCH New Stefano Stabellini 1 participant 1 message May 11, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen: fix de/assert_irq checks

The checks in assert_irq and deassert_irq to distinguish interrupts that have been remapped onto event channels from the others that have to be injected using the emulated lapic are wrong.

Fix the condition checks using the convenient hvm_domain_use_pirq function.

This patch should be backported to xen 4.1.

xen/arch/x86/hvm/irq.c +3 -2
diff -r 4b0692880dfa xen/arch/x86/hvm/irq.c
@@ -31,7 +31,7 @@
 static void assert_irq(struct domain *d, unsigned ioapic_gsi, unsigned pic_irq)
 {
     int pirq = domain_emuirq_to_pirq(d, ioapic_gsi);
-    if ( pirq != IRQ_UNBOUND )
+    if ( hvm_domain_use_pirq(d, pirq) )
     {
         send_guest_pirq(d, pirq);
         return;
@@ -43,7 +43,8 @@ static void assert_irq(struct domain *d,
 /* Must be called with hvm_domain->irq_lock hold */
 static void deassert_irq(struct domain *d, unsigned isa_irq)
 {
-    if ( domain_emuirq_to_pirq(d, isa_irq) != IRQ_UNBOUND )
+    int pirq = domain_emuirq_to_pirq(d, isa_irq);
+    if ( !hvm_domain_use_pirq(d, pirq) )
         vpic_irq_negative_edge(d, isa_irq);
 }