xen: if mapping GSIs we run out of pirq < nr_irqs_gsi, use the others
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>
Tue, 13 Sep 2011 09:32:24 +0000 (10:32 +0100)
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>
Tue, 13 Sep 2011 09:32:24 +0000 (10:32 +0100)
PV on HVM guests can have more GSIs than the host, in that case we
could run out of pirq < nr_irqs_gsi. When that happens use pirq >=
nr_irqs_gsi rather than returning an error.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Tested-by: Benjamin Schweikert <b.schweikert@googlemail.com>
xen/arch/x86/irq.c

index 71fea2d74f78cc5430c144204877feb2547d9a96..9ea29bac76bac9d68cd39c45370a2276272497b2 100644 (file)
@@ -1646,15 +1646,12 @@ int get_free_pirq(struct domain *d, int type, int index)
                 return i;
             }
     }
-    else
-    {
-        for ( i = d->nr_pirqs - 1; i >= nr_irqs_gsi; i-- )
-            if ( is_free_pirq(d, pirq_info(d, i)) )
-            {
-                pirq_get_info(d, i);
-                return i;
-            }
-    }
+    for ( i = d->nr_pirqs - 1; i >= nr_irqs_gsi; i-- )
+        if ( is_free_pirq(d, pirq_info(d, i)) )
+        {
+            pirq_get_info(d, i);
+            return i;
+        }
 
     return -ENOSPC;
 }