[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 05/10] pseries: added allocator for a block of IRQs
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PATCH 05/10] pseries: added allocator for a block of IRQs |
Date: |
Wed, 8 Aug 2012 12:10:34 +1000 |
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>
---
hw/spapr.c | 26 ++++++++++++++++++++++++++
hw/spapr.h | 1 +
2 files changed, 27 insertions(+)
diff --git a/hw/spapr.c b/hw/spapr.c
index 8b4af62..2b66f54 100644
--- a/hw/spapr.c
+++ b/hw/spapr.c
@@ -104,6 +104,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 c5de18d..76493cb 100644
--- a/hw/spapr.h
+++ b/hw/spapr.h
@@ -289,6 +289,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.7.10.4
- [Qemu-ppc] [0/10] pseries updates and cleanups, David Gibson, 2012/08/07
- [Qemu-ppc] [PATCH 05/10] pseries: added allocator for a block of IRQs,
David Gibson <=
- [Qemu-ppc] [PATCH 04/10] pseries: Separate PCI RTAS setup from common from emulation specific PCI setup, David Gibson, 2012/08/07
- [Qemu-ppc] [PATCH 02/10] pseries: Remove extraneous prints, David Gibson, 2012/08/07
- [Qemu-ppc] [PATCH 03/10] pseries: Rework irq assignment to avoid carrying qemu_irqs around, David Gibson, 2012/08/07
- [Qemu-ppc] [PATCH 06/10] pseries: Export find_phb() utility function for PCI code, David Gibson, 2012/08/07
- [Qemu-ppc] [PATCH 10/10] pseries: Update SLOF firmware image, David Gibson, 2012/08/07
- [Qemu-ppc] [PATCH 09/10] pseries dma: DMA window params added to PHB and DT population changed, David Gibson, 2012/08/07
- [Qemu-ppc] [PATCH 08/10] pseries: Add PCI MSI/MSI-X support, David Gibson, 2012/08/07
- [Qemu-ppc] [PATCH 07/10] pseries: Add trace event for PCI irqs, David Gibson, 2012/08/07