[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 18/24] pseries: added allocator for a block of IRQs
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PATCH 18/24] pseries: added allocator for a block of IRQs |
Date: |
Wed, 15 Aug 2012 11:58:56 +0200 |
From: Alexey Kardashevskiy <address@hidden>
The patch adds a simple helper which allocates a consecutive sequence
of IRQs calling spapr_allocate_irq for each and checks that allocated
IRQs go consequently.
The patch is required for upcoming support of MSI/MSIX on POWER.
Signed-off-by: Alexey Kardashevskiy <address@hidden>
Signed-off-by: David Gibson <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
---
hw/spapr.c | 26 ++++++++++++++++++++++++++
hw/spapr.h | 1 +
2 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/hw/spapr.c b/hw/spapr.c
index 8153c05..afbdbc5 100644
--- a/hw/spapr.c
+++ b/hw/spapr.c
@@ -105,6 +105,32 @@ int spapr_allocate_irq(int hint, enum xics_irq_type type)
return irq;
}
+/* Allocate block of consequtive IRQs, returns a number of the first */
+int spapr_allocate_irq_block(int num, enum xics_irq_type type)
+{
+ int first = -1;
+ int i;
+
+ for (i = 0; i < num; ++i) {
+ int irq;
+
+ irq = spapr_allocate_irq(0, type);
+ if (!irq) {
+ return -1;
+ }
+
+ if (0 == i) {
+ first = irq;
+ }
+
+ /* If the above doesn't create a consecutive block then that's
+ * an internal bug */
+ assert(irq == (first + i));
+ }
+
+ return first;
+}
+
static int spapr_set_associativity(void *fdt, sPAPREnvironment *spapr)
{
int ret = 0, offset;
diff --git a/hw/spapr.h b/hw/spapr.h
index b5cf6af..6229769 100644
--- a/hw/spapr.h
+++ b/hw/spapr.h
@@ -290,6 +290,7 @@ target_ulong spapr_hypercall(CPUPPCState *env, target_ulong
opcode,
target_ulong *args);
int spapr_allocate_irq(int hint, enum xics_irq_type type);
+int spapr_allocate_irq_block(int num, enum xics_irq_type type);
static inline int spapr_allocate_msi(int hint)
{
--
1.6.0.2
- [Qemu-ppc] [PATCH 17/24] pseries: Separate PCI RTAS setup from common from emulation specific PCI setup, (continued)
- [Qemu-ppc] [PATCH 17/24] pseries: Separate PCI RTAS setup from common from emulation specific PCI setup, Alexander Graf, 2012/08/15
- [Qemu-ppc] [PATCH 19/24] pseries: Export find_phb() utility function for PCI code, Alexander Graf, 2012/08/15
- [Qemu-ppc] [PATCH 16/24] pseries: Rework irq assignment to avoid carrying qemu_irqs around, Alexander Graf, 2012/08/15
- [Qemu-ppc] [PATCH 21/24] pseries: Add PCI MSI/MSI-X support, Alexander Graf, 2012/08/15
- [Qemu-ppc] [PATCH 23/24] pseries: Update SLOF firmware image, Alexander Graf, 2012/08/15
- [Qemu-ppc] [PATCH 24/24] openpic: Added BRR1 register, Alexander Graf, 2012/08/15
- [Qemu-ppc] [PATCH 20/24] pseries: Add trace event for PCI irqs, Alexander Graf, 2012/08/15
- [Qemu-ppc] [PATCH 22/24] pseries dma: DMA window params added to PHB and DT population changed, Alexander Graf, 2012/08/15
- [Qemu-ppc] [PATCH 18/24] pseries: added allocator for a block of IRQs,
Alexander Graf <=
- [Qemu-ppc] [PATCH 14/24] pseries: Update SLOF, Alexander Graf, 2012/08/15
- Re: [Qemu-ppc] [Qemu-devel] [PULL 00/24] ppc patch queue 2012-08-15, Anthony Liguori, 2012/08/15