[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH v3 7/9] xics: Implement xics_ics_free()
From: |
Alexey Kardashevskiy |
Subject: |
[Qemu-ppc] [PATCH v3 7/9] xics: Implement xics_ics_free() |
Date: |
Fri, 30 May 2014 19:34:18 +1000 |
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 <address@hidden>
---
Changes:
v3:
* xics_free() now accepts "irq" instead of server:srcno and does sanity
checks
---
hw/intc/xics.c | 27 +++++++++++++++++++++++++++
include/hw/ppc/xics.h | 1 +
trace-events | 2 ++
3 files changed, 30 insertions(+)
diff --git a/hw/intc/xics.c b/hw/intc/xics.c
index 0dfd173..01dbc3e 100644
--- a/hw/intc/xics.c
+++ b/hw/intc/xics.c
@@ -767,6 +767,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
*/
diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h
index 0d8af1b..d4931f9 100644
--- a/include/hw/ppc/xics.h
+++ b/include/hw/ppc/xics.h
@@ -159,6 +159,7 @@ struct ICSIRQState {
qemu_irq xics_get_qirq(XICSState *icp, int irq);
int xics_alloc(XICSState *icp, int src, int irq_hint, bool lsi);
int xics_alloc_block(XICSState *icp, int src, int num, bool lsi, bool align);
+void xics_free(XICSState *icp, int irq, int num);
void xics_cpu_setup(XICSState *icp, PowerPCCPU *cpu);
diff --git a/trace-events b/trace-events
index f1b6571..0f9f54d 100644
--- a/trace-events
+++ b/trace-events
@@ -1186,6 +1186,8 @@ xics_alloc(int src, int irq) "source#%d, irq %d"
xics_alloc_failed_hint(int src, int irq) "source#%d, irq %d is already in use"
xics_alloc_failed_no_left(int src) "source#%d, no irq left"
xics_alloc_block(int src, int first, int num, bool lsi, int align) "source#%d,
first irq %d, %d irqs, lsi=%d, alignnum %d"
+xics_ics_free(int src, int irq, int num) "Source#%d, first irq %d, %d irqs"
+xics_ics_free_warn(int src, int irq) "Source#%d, irq %d is already free"
# hw/ppc/spapr.c
spapr_cas_failed(unsigned long n) "DT diff buffer is too small: %ld bytes"
--
2.0.0
- [Qemu-ppc] [PATCH v3 0/9] Move interrupts from spapr to xics, Alexey Kardashevskiy, 2014/05/30
- [Qemu-ppc] [PATCH v3 4/9] spapr: Move interrupt allocator to xics, Alexey Kardashevskiy, 2014/05/30
- [Qemu-ppc] [PATCH v3 8/9] vmstate: Add preallocation for migrating arrays (VMS_ALLOC flag), Alexey Kardashevskiy, 2014/05/30
- [Qemu-ppc] [PATCH v3 2/9] xics: Add xics_find_source(), Alexey Kardashevskiy, 2014/05/30
- [Qemu-ppc] [PATCH v3 1/9] xics: Add flags for interrupts, Alexey Kardashevskiy, 2014/05/30
- [Qemu-ppc] [PATCH v3 6/9] spapr: Remove @next_irq, Alexey Kardashevskiy, 2014/05/30
- [Qemu-ppc] [PATCH v3 7/9] xics: Implement xics_ics_free(),
Alexey Kardashevskiy <=
- [Qemu-ppc] [PATCH v3 5/9] xics: Remove obsolete xics_set_irq_type(), Alexey Kardashevskiy, 2014/05/30
- [Qemu-ppc] [PATCH v3 9/9] spapr_pci: Use XICS interrupt allocator and do not cache interrupts in PHB, Alexey Kardashevskiy, 2014/05/30
- [Qemu-ppc] [PATCH v3 3/9] xics: Disable flags reset on xics reset, Alexey Kardashevskiy, 2014/05/30