From: Andrii Tseglytskyi <andrii.tseglyts...@globallogic.com>

Patch allows reassigning of hardware interrupts from dom0 to
other guest domain.

Signed-off-by: Andrii Tseglytskyi <andrii.tseglyts...@globallogic.com>
Signed-off-by: Iurii Konovalenko <iurii.konovale...@globallogic.com>
---
 xen/arch/arm/irq.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index 1f38605..c470613 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -481,12 +481,23 @@ int route_irq_to_guest(struct domain *d, unsigned int 
virq,
         }
 
         if ( test_bit(_IRQ_GUEST, &desc->status) )
-            printk(XENLOG_G_ERR "IRQ %u is already used by domain %u\n",
-                   irq, ad->domain_id);
+        {
+            printk(XENLOG_G_DEBUG "IRQ %u is reassigned from domain %u to 
domain %u\n",
+                    irq, ad->domain_id, d->domain_id);
+
+            retval = gic_remove_irq_from_guest(ad, irq, desc);
+            if ( retval )
+                printk(XENLOG_G_ERR "failed to remove IRQ %u from domain %u 
(%d)\n",
+                        irq, ad->domain_id, retval);
+            xfree(desc->action);
+            desc->action = NULL;
+        }
         else
+        {
             printk(XENLOG_G_ERR "IRQ %u is already used by Xen\n", irq);
-        retval = -EBUSY;
-        goto out;
+                       retval = -EBUSY;
+                       goto out;
+        }
     }
 
     retval = __setup_irq(desc, 0, action);
-- 
2.8.2


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to