aboutsummaryrefslogtreecommitdiff
path: root/hw/intc
diff options
context:
space:
mode:
authorAlexey Kardashevskiy <aik@ozlabs.ru>2014-05-30 19:34:18 +1000
committerAlexander Graf <agraf@suse.de>2014-06-27 13:48:26 +0200
commit51bba713fe1120ba7b0542216278f10e48349589 (patch)
tree237f4370c8ef7fe34b4243ad109754e0ad493771 /hw/intc
parentba0e5bf8de38a33ea2e09b40e0493d30b62fcbf0 (diff)
xics: Implement xics_ics_free()
This implements interrupt release function so IRQs can be returned back to the pool for reuse in cases such as PCI hot plug. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'hw/intc')
-rw-r--r--hw/intc/xics.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/hw/intc/xics.c b/hw/intc/xics.c
index 6cd980a735..0fd2a84c7b 100644
--- a/hw/intc/xics.c
+++ b/hw/intc/xics.c
@@ -775,6 +775,33 @@ int xics_alloc_block(XICSState *icp, int src, int num, bool lsi, bool align)
return first;
}
+static void ics_free(ICSState *ics, int srcno, int num)
+{
+ int i;
+
+ for (i = srcno; i < srcno + num; ++i) {
+ if (ICS_IRQ_FREE(ics, i)) {
+ trace_xics_ics_free_warn(ics - ics->icp->ics, i + ics->offset);
+ }
+ memset(&ics->irqs[i], 0, sizeof(ICSIRQState));
+ }
+}
+
+void xics_free(XICSState *icp, int irq, int num)
+{
+ int src = xics_find_source(icp, irq);
+
+ if (src >= 0) {
+ ICSState *ics = &icp->ics[src];
+
+ /* FIXME: implement multiple sources */
+ assert(src == 0);
+
+ trace_xics_ics_free(ics - icp->ics, irq, num);
+ ics_free(ics, irq - ics->offset, num);
+ }
+}
+
/*
* Guest interfaces
*/