[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 40/44] spapr/xive: fix multiple resets when using the '
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 40/44] spapr/xive: fix multiple resets when using the 'dual' interrupt mode |
Date: |
Wed, 29 May 2019 16:50:13 +1000 |
From: Cédric Le Goater <address@hidden>
Today, when a reset occurs on a pseries machine using the 'dual'
interrupt mode, the KVM devices are released and recreated depending
on the interrupt mode selected by CAS. If XIVE is selected, the SysBus
memory regions of the SpaprXive model are initialized by the KVM
backend initialization routine each time a reset occurs. This leads to
a crash after a couple of resets because the machine reaches the
QDEV_MAX_MMIO limit of SysBusDevice :
qemu-system-ppc64: hw/core/sysbus.c:193: sysbus_init_mmio: Assertion
`dev->num_mmio < QDEV_MAX_MMIO' failed.
To fix, initialize the SysBus memory regions in spapr_xive_realize()
called only once and remove the same inits from the QEMU and KVM
backend initialization routines which are called at each reset.
Reported-by: Satheesh Rajendran <address@hidden>
Signed-off-by: Cédric Le Goater <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Greg Kurz <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/intc/spapr_xive.c | 11 +++++------
hw/intc/spapr_xive_kvm.c | 4 ----
2 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c
index f6f6c29d6a..62e0ef8fa5 100644
--- a/hw/intc/spapr_xive.c
+++ b/hw/intc/spapr_xive.c
@@ -331,12 +331,16 @@ static void spapr_xive_realize(DeviceState *dev, Error
**errp)
xive->tm_base + XIVE_TM_USER_PAGE * (1 <<
TM_SHIFT));
qemu_register_reset(spapr_xive_reset, dev);
+
+ /* Define all XIVE MMIO regions on SysBus */
+ sysbus_init_mmio(SYS_BUS_DEVICE(xive), &xsrc->esb_mmio);
+ sysbus_init_mmio(SYS_BUS_DEVICE(xive), &end_xsrc->esb_mmio);
+ sysbus_init_mmio(SYS_BUS_DEVICE(xive), &xive->tm_mmio);
}
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
@@ -351,11 +355,6 @@ void spapr_xive_init(SpaprXive *xive, Error **errp)
memory_region_init_io(&xive->tm_mmio, OBJECT(xive), &xive_tm_ops, xive,
"xive.tima", 4ull << TM_SHIFT);
- /* Define all XIVE MMIO regions on SysBus */
- sysbus_init_mmio(SYS_BUS_DEVICE(xive), &xsrc->esb_mmio);
- sysbus_init_mmio(SYS_BUS_DEVICE(xive), &end_xsrc->esb_mmio);
- sysbus_init_mmio(SYS_BUS_DEVICE(xive), &xive->tm_mmio);
-
/* Map all regions */
spapr_xive_map_mmio(xive);
}
diff --git a/hw/intc/spapr_xive_kvm.c b/hw/intc/spapr_xive_kvm.c
index ec170b3045..b48f135838 100644
--- a/hw/intc/spapr_xive_kvm.c
+++ b/hw/intc/spapr_xive_kvm.c
@@ -693,7 +693,6 @@ static void *kvmppc_xive_mmap(SpaprXive *xive, int pgoff,
size_t len,
void kvmppc_xive_connect(SpaprXive *xive, Error **errp)
{
XiveSource *xsrc = &xive->source;
- XiveENDSource *end_xsrc = &xive->end_source;
Error *local_err = NULL;
size_t esb_len = (1ull << xsrc->esb_shift) * xsrc->nr_irqs;
size_t tima_len = 4ull << TM_SHIFT;
@@ -731,12 +730,10 @@ void kvmppc_xive_connect(SpaprXive *xive, Error **errp)
memory_region_init_ram_device_ptr(&xsrc->esb_mmio, OBJECT(xsrc),
"xive.esb", esb_len, xsrc->esb_mmap);
- sysbus_init_mmio(SYS_BUS_DEVICE(xive), &xsrc->esb_mmio);
/*
* 2. END ESB pages (No KVM support yet)
*/
- sysbus_init_mmio(SYS_BUS_DEVICE(xive), &end_xsrc->esb_mmio);
/*
* 3. TIMA pages - KVM mapping
@@ -749,7 +746,6 @@ void kvmppc_xive_connect(SpaprXive *xive, Error **errp)
}
memory_region_init_ram_device_ptr(&xive->tm_mmio, OBJECT(xive),
"xive.tima", tima_len, xive->tm_mmap);
- sysbus_init_mmio(SYS_BUS_DEVICE(xive), &xive->tm_mmio);
xive->change = qemu_add_vm_change_state_handler(
kvmppc_xive_change_state_handler, xive);
--
2.21.0
- [Qemu-ppc] [PULL 31/44] spapr/xive: activate KVM support, (continued)
- [Qemu-ppc] [PULL 31/44] spapr/xive: activate KVM support, David Gibson, 2019/05/29
- [Qemu-ppc] [PULL 27/44] spapr/xive: add hcall support when under KVM, David Gibson, 2019/05/29
- [Qemu-ppc] [PULL 21/44] target/ppc: Set PSSCR_EC on cpu halt to prevent spurious wakeup, David Gibson, 2019/05/29
- [Qemu-ppc] [PULL 32/44] sysbus: add a sysbus_mmio_unmap() helper, David Gibson, 2019/05/29
- [Qemu-ppc] [PULL 44/44] ppc/pnv: add dummy XSCOM registers for PRD initialization, David Gibson, 2019/05/29
- [Qemu-ppc] [PULL 43/44] ppc/pnv: introduce new skiboot platform properties, David Gibson, 2019/05/29
- [Qemu-ppc] [PULL 36/44] spapr/irq: initialize the IRQ device only once, David Gibson, 2019/05/29
- [Qemu-ppc] [PULL 41/44] spapr: change default interrupt mode to 'dual', David Gibson, 2019/05/29
- [Qemu-ppc] [PULL 42/44] spapr: Don't migrate the hpt_maxpagesize cap to older machine types, David Gibson, 2019/05/29
- [Qemu-ppc] [PULL 38/44] spapr/irq: add KVM support to the 'dual' machine, David Gibson, 2019/05/29
- [Qemu-ppc] [PULL 40/44] spapr/xive: fix multiple resets when using the 'dual' interrupt mode,
David Gibson <=
- [Qemu-ppc] [PULL 35/44] spapr/irq: introduce a spapr_irq_init_device() helper, David Gibson, 2019/05/29
- [Qemu-ppc] [PULL 37/44] ppc/xics: fix irq priority in ics_set_irq_type(), David Gibson, 2019/05/29
- [Qemu-ppc] [PULL 33/44] spapr: introduce routines to delete the KVM IRQ device, David Gibson, 2019/05/29
- [Qemu-ppc] [PULL 39/44] docs: provide documentation on the POWER9 XIVE interrupt controller, David Gibson, 2019/05/29
- [Qemu-ppc] [PULL 30/44] spapr/xive: add migration support for KVM, David Gibson, 2019/05/29
- Re: [Qemu-ppc] [PULL 00/44] ppc-for-4.1 queue 20190529, Peter Maydell, 2019/05/30