[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 35/38] spapr/irq: initialize the IRQ device only once
From: |
David Gibson |
Subject: |
[Qemu-devel] [PULL 35/38] spapr/irq: initialize the IRQ device only once |
Date: |
Wed, 22 May 2019 14:45:57 +1000 |
From: Cédric Le Goater <address@hidden>
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>
Message-Id: <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/intc/spapr_xive.c | 9 +++++++++
hw/intc/xics_spapr.c | 7 +++++++
include/hw/ppc/xics.h | 1 +
3 files changed, 17 insertions(+)
diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c
index a79574b23c..f6f6c29d6a 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 9d2b8adef7..5a1835e8b1 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);
diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h
index eb65ad7e43..d6f8e4c4c2 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"
--
2.21.0
- [Qemu-devel] [PULL 32/38] spapr: introduce routines to delete the KVM IRQ device, (continued)
- [Qemu-devel] [PULL 32/38] spapr: introduce routines to delete the KVM IRQ device, David Gibson, 2019/05/22
- [Qemu-devel] [PULL 31/38] sysbus: add a sysbus_mmio_unmap() helper, David Gibson, 2019/05/22
- [Qemu-devel] [PULL 23/38] spapr: Fix phb_placement backwards compatibility, David Gibson, 2019/05/22
- [Qemu-devel] [PULL 30/38] spapr/xive: activate KVM support, David Gibson, 2019/05/22
- [Qemu-devel] [PULL 26/38] spapr/xive: add hcall support when under KVM, David Gibson, 2019/05/22
- [Qemu-devel] [PULL 25/38] spapr/xive: add KVM support, David Gibson, 2019/05/22
- [Qemu-devel] [PULL 29/38] spapr/xive: add migration support for KVM, David Gibson, 2019/05/22
- [Qemu-devel] [PULL 27/38] spapr/xive: add state synchronization with KVM, David Gibson, 2019/05/22
- [Qemu-devel] [PULL 34/38] spapr/irq: introduce a spapr_irq_init_device() helper, David Gibson, 2019/05/22
- [Qemu-devel] [PULL 37/38] spapr/irq: add KVM support to the 'dual' machine, David Gibson, 2019/05/22
- [Qemu-devel] [PULL 35/38] spapr/irq: initialize the IRQ device only once,
David Gibson <=
- [Qemu-devel] [PULL 36/38] ppc/xics: fix irq priority in ics_set_irq_type(), David Gibson, 2019/05/22
- [Qemu-devel] [PULL 38/38] docs: provide documentation on the POWER9 XIVE interrupt controller, David Gibson, 2019/05/22
- Re: [Qemu-devel] [PULL 00/38] ppc-for-4.1 queue 20190522, Peter Maydell, 2019/05/23