[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 28/38] openpic: switch IRQQueue queue from inline to
From: |
Alexander Graf |
Subject: |
[Qemu-devel] [PULL 28/38] openpic: switch IRQQueue queue from inline to bitmap |
Date: |
Sun, 8 Mar 2015 09:44:47 +0100 |
From: Mark Cave-Ayland <address@hidden>
This is in preparation for using VMSTATE_BITMAP in a followup vmstate
migration patch.
Signed-off-by: Mark Cave-Ayland <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
---
hw/intc/openpic.c | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/hw/intc/openpic.c b/hw/intc/openpic.c
index 9d3beb1..6bde495 100644
--- a/hw/intc/openpic.c
+++ b/hw/intc/openpic.c
@@ -200,11 +200,13 @@ typedef enum IRQType {
IRQ_TYPE_FSLSPECIAL, /* FSL timer/IPI interrupt, edge, no polarity */
} IRQType;
+/* Round up to the nearest 64 IRQs so that the queue length
+ * won't change when moving between 32 and 64 bit hosts.
+ */
+#define IRQQUEUE_SIZE_BITS ((OPENPIC_MAX_IRQ + 63) & ~63)
+
typedef struct IRQQueue {
- /* Round up to the nearest 64 IRQs so that the queue length
- * won't change when moving between 32 and 64 bit hosts.
- */
- unsigned long queue[BITS_TO_LONGS((OPENPIC_MAX_IRQ + 63) & ~63)];
+ unsigned long *queue;
int next;
int priority;
} IRQQueue;
@@ -1291,7 +1293,7 @@ static void openpic_save_IRQ_queue(QEMUFile* f, IRQQueue
*q)
{
unsigned int i;
- for (i = 0; i < ARRAY_SIZE(q->queue); i++) {
+ for (i = 0; i < BITS_TO_LONGS(IRQQUEUE_SIZE_BITS); i++) {
/* Always put the lower half of a 64-bit long first, in case we
* restore on a 32-bit host. The least significant bits correspond
* to lower IRQ numbers in the bitmap.
@@ -1345,7 +1347,7 @@ static void openpic_load_IRQ_queue(QEMUFile* f, IRQQueue
*q)
{
unsigned int i;
- for (i = 0; i < ARRAY_SIZE(q->queue); i++) {
+ for (i = 0; i < BITS_TO_LONGS(IRQQUEUE_SIZE_BITS); i++) {
unsigned long val;
val = qemu_get_be32(f);
@@ -1444,12 +1446,14 @@ static void openpic_reset(DeviceState *d)
write_IRQreg_idr(opp, i, opp->idr_reset);
}
/* Initialise IRQ destinations */
- for (i = 0; i < MAX_CPU; i++) {
+ for (i = 0; i < opp->nb_cpus; i++) {
opp->dst[i].ctpr = 15;
- memset(&opp->dst[i].raised, 0, sizeof(IRQQueue));
opp->dst[i].raised.next = -1;
- memset(&opp->dst[i].servicing, 0, sizeof(IRQQueue));
+ opp->dst[i].raised.priority = 0;
+ bitmap_clear(opp->dst[i].raised.queue, 0, IRQQUEUE_SIZE_BITS);
opp->dst[i].servicing.next = -1;
+ opp->dst[i].servicing.priority = 0;
+ bitmap_clear(opp->dst[i].servicing.queue, 0, IRQQUEUE_SIZE_BITS);
}
/* Initialise timers */
for (i = 0; i < OPENPIC_MAX_TMR; i++) {
@@ -1629,6 +1633,9 @@ static void openpic_realize(DeviceState *dev, Error
**errp)
for (j = 0; j < OPENPIC_OUTPUT_NB; j++) {
sysbus_init_irq(d, &opp->dst[i].irqs[j]);
}
+
+ opp->dst[i].raised.queue = bitmap_new(IRQQUEUE_SIZE_BITS);
+ opp->dst[i].servicing.queue = bitmap_new(IRQQUEUE_SIZE_BITS);
}
register_savevm(dev, "openpic", 0, 2,
--
1.8.1.4
- [Qemu-devel] [PULL 33/38] ppc64-softmmu: Remove duplicated OPENPIC from config, (continued)
- [Qemu-devel] [PULL 33/38] ppc64-softmmu: Remove duplicated OPENPIC from config, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 25/38] target-ppc: force update of msr bits in cpu_post_load, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 38/38] sPAPR: Implement sPAPRPHBClass EEH callbacks, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 14/38] pseries: Export RTC time via QOM, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 11/38] pseries: Make RTAS time of day functions respect -rtc options, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 20/38] display cpu id dump state, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 04/38] spapr: Add pseries-2.3 machine, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 08/38] pseries: Move sPAPR RTC code into its own file, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 31/38] Revert "default-configs/ppc64: add all components of i82378 SuperIO chip used by prep", Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 32/38] ppc64-softmmu: Remove unsupported FDC from config, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 28/38] openpic: switch IRQQueue queue from inline to bitmap,
Alexander Graf <=
- [Qemu-devel] [PULL 21/38] macio.c: include parent PCIDevice state in VMStateDescription, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 12/38] pseries: Make the PAPR RTC a qdev device, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 18/38] pseries: Switch VGA endian on H_SET_MODE, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 35/38] PPC: Introduce the Virtual Time Base (VTB) SPR register, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 07/38] Add more VMSTATE_*_TEST variants for integers, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 19/38] Openpic: check that cpu id is within the number of cpus, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 30/38] spapr_vio: Convert to realize(), Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 10/38] pseries: Add spapr_rtc_read() helper function, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 26/38] openpic: fix segfault on -M mac99 savevm, Alexander Graf, 2015/03/08
- [Qemu-devel] [PULL 36/38] target-ppc: Add versions to server CPU descriptions, Alexander Graf, 2015/03/08