[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH v4 12/14] spapr/irq: initialize the IRQ device only on
From: |
Cédric Le Goater |
Subject: |
[Qemu-ppc] [PATCH v4 12/14] spapr/irq: initialize the IRQ device only once |
Date: |
Mon, 13 May 2019 10:42:43 +0200 |
Add a check to make sure that the routine initializing the emulated
IRQ device is called once. We don't have much to test on the XICS
side, so we introduce a 'init' boolean under ICSState.
Signed-off-by: Cédric Le Goater <address@hidden>
---
Changes since v3:
- introduced a 'init' boolean under ICSState
include/hw/ppc/xics.h | 1 +
hw/intc/spapr_xive.c | 9 +++++++++
hw/intc/xics_spapr.c | 7 +++++++
3 files changed, 17 insertions(+)
diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h
index eb65ad7e43b7..d6f8e4c4c282 100644
--- a/include/hw/ppc/xics.h
+++ b/include/hw/ppc/xics.h
@@ -119,6 +119,7 @@ struct ICSState {
uint32_t offset;
ICSIRQState *irqs;
XICSFabric *xics;
+ bool init; /* sPAPR ICS device initialized */
};
#define ICS_PROP_XICS "xics"
diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c
index 246b21ae7f31..1e649d6cdbe1 100644
--- a/hw/intc/spapr_xive.c
+++ b/hw/intc/spapr_xive.c
@@ -338,6 +338,15 @@ void spapr_xive_init(SpaprXive *xive, Error **errp)
XiveSource *xsrc = &xive->source;
XiveENDSource *end_xsrc = &xive->end_source;
+ /*
+ * The emulated XIVE device can only be initialized once. If the
+ * ESB memory region has been already mapped, it means we have been
+ * through there.
+ */
+ if (memory_region_is_mapped(&xsrc->esb_mmio)) {
+ return;
+ }
+
/* TIMA initialization */
memory_region_init_io(&xive->tm_mmio, OBJECT(xive), &xive_tm_ops, xive,
"xive.tima", 4ull << TM_SHIFT);
diff --git a/hw/intc/xics_spapr.c b/hw/intc/xics_spapr.c
index 9d2b8adef7c5..5a1835e8b1ed 100644
--- a/hw/intc/xics_spapr.c
+++ b/hw/intc/xics_spapr.c
@@ -239,6 +239,13 @@ static void rtas_int_on(PowerPCCPU *cpu, SpaprMachineState
*spapr,
void xics_spapr_init(SpaprMachineState *spapr)
{
+ /* Emulated mode can only be initialized once. */
+ if (spapr->ics->init) {
+ return;
+ }
+
+ spapr->ics->init = true;
+
/* Registration of global state belongs into realize */
spapr_rtas_register(RTAS_IBM_SET_XIVE, "ibm,set-xive", rtas_set_xive);
spapr_rtas_register(RTAS_IBM_GET_XIVE, "ibm,get-xive", rtas_get_xive);
--
2.20.1
- [Qemu-ppc] [PATCH v4 00/14] spapr: add KVM support to the XIVE interrupt mode, Cédric Le Goater, 2019/05/13
- [Qemu-ppc] [PATCH v4 02/14] spapr/xive: add KVM support, Cédric Le Goater, 2019/05/13
- [Qemu-ppc] [PATCH v4 03/14] spapr/xive: add hcall support when under KVM, Cédric Le Goater, 2019/05/13
- [Qemu-ppc] [PATCH v4 13/14] ppc/xics: fix irq priority in ics_set_irq_type(), Cédric Le Goater, 2019/05/13
- [Qemu-ppc] [PATCH v4 14/14] spapr/irq: add KVM support to the 'dual' machine, Cédric Le Goater, 2019/05/13
- [Qemu-ppc] [PATCH v4 12/14] spapr/irq: initialize the IRQ device only once,
Cédric Le Goater <=
- [Qemu-ppc] [PATCH v4 11/14] spapr/irq: introduce a spapr_irq_init_device() helper, Cédric Le Goater, 2019/05/13
- [Qemu-ppc] [PATCH v4 10/14] spapr: check for the activation of the KVM IRQ device, Cédric Le Goater, 2019/05/13
- [Qemu-ppc] [PATCH v4 07/14] spapr/xive: activate KVM support, Cédric Le Goater, 2019/05/13
- [Qemu-ppc] [PATCH v4 08/14] sysbus: add a sysbus_mmio_unmap() helper, Cédric Le Goater, 2019/05/13
- [Qemu-ppc] [PATCH v4 09/14] spapr: introduce routines to delete the KVM IRQ device, Cédric Le Goater, 2019/05/13
- [Qemu-ppc] [PATCH v4 05/14] spapr/xive: introduce a VM state change handler, Cédric Le Goater, 2019/05/13
- [Qemu-ppc] [PATCH v4 04/14] spapr/xive: add state synchronization with KVM, Cédric Le Goater, 2019/05/13
- [Qemu-ppc] [PATCH v4 06/14] spapr/xive: add migration support for KVM, Cédric Le Goater, 2019/05/13