From nobody Mon Feb 9 20:32:35 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1559115943; cv=none; d=zoho.com; s=zohoarc; b=od8RNb5hjPBVhTQjI7ww5qJTANFppWBCVTWx/u38/LNX/WplKLFCvBCpVMbT+i+CoSBV6NTa6fvcpn/WN7t4n0Kg6EPe8axPynYyQ6ZzZOVpisSkkcoFfK1+/RiS94jxovP1472xRlnQTV61vrrhJs/rS6yZwOmD3WcCNYAU4xU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559115943; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=a2kf7KvasQpirftWl3RAhpl25FKILDw+Qh6PAdH4LNo=; b=B6Cp2BrP5WKoZWW7vw0b4fG9eeyQiS26RVNfBD66ArkZO8BKiHWHu6T8OZN00qoVymF9X/IA6xuAes9b3d8frkiQIRSRxggdgBEisbA+d9OB6743GnSGV+W2MEgVoeQbSsoh8sSsFpfBm4Dr4PtBnK30KHMbHDoj6uBHEgtzQ4k= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1559115942354884.2835720387005; Wed, 29 May 2019 00:45:42 -0700 (PDT) Received: from localhost ([127.0.0.1]:49276 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hVtHD-0003p2-Ca for importer@patchew.org; Wed, 29 May 2019 03:45:35 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48415) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hVsQq-0000qd-Tq for qemu-devel@nongnu.org; Wed, 29 May 2019 02:51:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hVsQp-00033d-KO for qemu-devel@nongnu.org; Wed, 29 May 2019 02:51:28 -0400 Received: from ozlabs.org ([203.11.71.1]:60525) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hVsQp-0002uL-1I; Wed, 29 May 2019 02:51:27 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 45DLv73zgQz9sPf; Wed, 29 May 2019 16:50:26 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1559112627; bh=In/zhhcSNnkbkU5M1g1bCBLSGVt2Svo9eVmPwlqUPIQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TamXp5ev1bVHV2H81E3o1ajeNzXGKuUHwrRZVBCdxJOM/2D+32r58vWYzaeCisWo2 0Aw3gYwcg4cBAYaRj7uHdIHkZlYrZecyf+hwC00J59pjwYAlK1hPKTWVlSGQuOnxzM r6FWTnPzst3T9B1GKNwt6GZgpb7q84X3cQaW14LQ= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 29 May 2019 16:50:13 +1000 Message-Id: <20190529065017.15149-41-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190529065017.15149-1-david@gibson.dropbear.id.au> References: <20190529065017.15149-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 40/44] spapr/xive: fix multiple resets when using the 'dual' interrupt mode X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, Satheesh Rajendran , David Gibson , rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: C=C3=A9dric Le Goater 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 Signed-off-by: C=C3=A9dric Le Goater Message-Id: <20190522074016.10521-2-clg@kaod.org> Reviewed-by: Greg Kurz Signed-off-by: David Gibson --- 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, Erro= r **errp) xive->tm_base + XIVE_TM_USER_PAGE * (1 << TM_SH= IFT)); =20 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); } =20 void spapr_xive_init(SpaprXive *xive, Error **errp) { XiveSource *xsrc =3D &xive->source; - XiveENDSource *end_xsrc =3D &xive->end_source; =20 /* * 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); =20 - /* 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 pgof= f, size_t len, void kvmppc_xive_connect(SpaprXive *xive, Error **errp) { XiveSource *xsrc =3D &xive->source; - XiveENDSource *end_xsrc =3D &xive->end_source; Error *local_err =3D NULL; size_t esb_len =3D (1ull << xsrc->esb_shift) * xsrc->nr_irqs; size_t tima_len =3D 4ull << TM_SHIFT; @@ -731,12 +730,10 @@ void kvmppc_xive_connect(SpaprXive *xive, Error **err= p) =20 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); =20 /* * 2. END ESB pages (No KVM support yet) */ - sysbus_init_mmio(SYS_BUS_DEVICE(xive), &end_xsrc->esb_mmio); =20 /* * 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); =20 xive->change =3D qemu_add_vm_change_state_handler( kvmppc_xive_change_state_handler, xive); --=20 2.21.0