From nobody Mon Feb 9 07:26:50 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; 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=1558510952; cv=none; d=zoho.com; s=zohoarc; b=VExM/0gsPca5rcO53zTd9EnLkMsP1QvzEMjnEk5beTRQxOVFRCEmwWvKkbqHylKm3ralJnrffomYLcSYk+zAKqZTyDvePZzTZbtdC5JuXiz9vO0nC9A5vPPExr+Jx7sfhruhdmqk3YegpblK8aLU1qyD/kidPMNElrT4N2T7GGQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558510952; 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=jFqa23zDQLcQfnS/dzOOECabqdUZUBgvRR0GVSVpgcg=; b=R2gRT+zqkPa697yWt8ifSlM6VakqjYAkslfy35GNzQF9SB6sHTSCiIsNFlFCuW24nqRkseCTuqmABLhVg/sXQWGhRe6GobiUVNkn8LMp9fhCUnRRLz4Vmi3akQHhCnGCxonCbEbuk3Yv/dWkieGYgyVI6Qh8ONBWnJD58FRVtNA= ARC-Authentication-Results: i=1; mx.zoho.com; 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558510952801626.0436436845606; Wed, 22 May 2019 00:42:32 -0700 (PDT) Received: from localhost ([127.0.0.1]:37822 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTLtE-00058m-PY for importer@patchew.org; Wed, 22 May 2019 03:42:20 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51108) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTLrh-0003yB-8E for qemu-devel@nongnu.org; Wed, 22 May 2019 03:40:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTLrc-0002Rb-K2 for qemu-devel@nongnu.org; Wed, 22 May 2019 03:40:42 -0400 Received: from 8.mo4.mail-out.ovh.net ([188.165.33.112]:50025) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hTLra-0002GH-IA for qemu-devel@nongnu.org; Wed, 22 May 2019 03:40:40 -0400 Received: from player761.ha.ovh.net (unknown [10.108.57.153]) by mo4.mail-out.ovh.net (Postfix) with ESMTP id CE5801F28F7 for ; Wed, 22 May 2019 09:40:34 +0200 (CEST) Received: from kaod.org (lfbn-1-10649-41.w90-89.abo.wanadoo.fr [90.89.235.41]) (Authenticated sender: clg@kaod.org) by player761.ha.ovh.net (Postfix) with ESMTPSA id AD3B5609C884; Wed, 22 May 2019 07:40:26 +0000 (UTC) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Wed, 22 May 2019 09:40:15 +0200 Message-Id: <20190522074016.10521-2-clg@kaod.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190522074016.10521-1-clg@kaod.org> References: <20190522074016.10521-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 18226630644379061222 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduuddrudduuddguddvfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 188.165.33.112 Subject: [Qemu-devel] [PATCH 1/2] 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: Peter Maydell , qemu-devel@nongnu.org, Greg Kurz , Satheesh Rajendran , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , qemu-ppc@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Greg Kurz --- 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 f6f6c29d6ae4..62e0ef8fa5b4 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 ec170b304555..b48f135838f2 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.20.1 From nobody Mon Feb 9 07:26:50 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; 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=1558510963; cv=none; d=zoho.com; s=zohoarc; b=NDXRcQzIRuAy4NeMv1cAJaNiLQiUe0aaQq/zac0D5g+DqIuyRAbAkSltlt3EQbUcTEma4QzV7DdPC1h2hHZs5dk6cYXhOYO8DpXOODau0lpRwTZEL36eV+Ph38OFD7WemF9wdA7cdRdbkYApQuUqPqa1jE3Qa49340Wnan1QkDM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558510963; 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=Cl6PIJvw/k2aBLvePdDIErquerV421t3jEgfYU0PBk4=; b=gIwdDjQX78+aw6iM6LICTib1Mdd44ejmvyqFRjyyLHJJ1DmzM9JdG2CkQK5wvMvr2qa7RDAjhd+AjiL3sJfxh5AekMKu85J9pHbzPp4hOPqYOfUrbABy/3Zw2AXDpSZ0iosKacvlK+U7sz7fWDLwvESySB2Ihb71J6kR/HbTPg0= ARC-Authentication-Results: i=1; mx.zoho.com; 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558510963866871.7797601082826; Wed, 22 May 2019 00:42:43 -0700 (PDT) Received: from localhost ([127.0.0.1]:37824 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTLtZ-0005QX-06 for importer@patchew.org; Wed, 22 May 2019 03:42:41 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51178) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTLrn-00042r-8q for qemu-devel@nongnu.org; Wed, 22 May 2019 03:40:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTLrm-0002hL-AN for qemu-devel@nongnu.org; Wed, 22 May 2019 03:40:51 -0400 Received: from 15.mo3.mail-out.ovh.net ([87.98.150.177]:52359) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hTLri-0002Tb-BI for qemu-devel@nongnu.org; Wed, 22 May 2019 03:40:48 -0400 Received: from player761.ha.ovh.net (unknown [10.108.57.178]) by mo3.mail-out.ovh.net (Postfix) with ESMTP id 3AD832156B0 for ; Wed, 22 May 2019 09:40:40 +0200 (CEST) Received: from kaod.org (lfbn-1-10649-41.w90-89.abo.wanadoo.fr [90.89.235.41]) (Authenticated sender: clg@kaod.org) by player761.ha.ovh.net (Postfix) with ESMTPSA id 8EA5E609C8C5; Wed, 22 May 2019 07:40:34 +0000 (UTC) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Wed, 22 May 2019 09:40:16 +0200 Message-Id: <20190522074016.10521-3-clg@kaod.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190522074016.10521-1-clg@kaod.org> References: <20190522074016.10521-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 18228319494834064358 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduuddrudduuddguddvfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 87.98.150.177 Subject: [Qemu-devel] [PATCH 2/2] spapr: change default interrupt mode to 'dual' 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: Peter Maydell , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , qemu-ppc@nongnu.org, qemu-devel@nongnu.org, Greg Kurz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Now that XIVE support is complete (QEMU emulated and KVM devices), change the pseries machine to advertise both interrupt modes: XICS (P7/P8) and XIVE (P9). The machine default interrupt modes depends on the version. Current settings are: pseries default interrupt mode 4.1 dual 4.0 xics 3.1 xics 3.0 legacy xics (different IRQ number space layout) Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz --- hw/ppc/spapr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 39e698e9b013..4fd16b43f014 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -4352,7 +4352,7 @@ static void spapr_machine_class_init(ObjectClass *oc,= void *data) smc->default_caps.caps[SPAPR_CAP_LARGE_DECREMENTER] =3D SPAPR_CAP_ON; smc->default_caps.caps[SPAPR_CAP_CCF_ASSIST] =3D SPAPR_CAP_OFF; spapr_caps_add_properties(smc, &error_abort); - smc->irq =3D &spapr_irq_xics; + smc->irq =3D &spapr_irq_dual; smc->dr_phb_enabled =3D true; } =20 @@ -4430,6 +4430,7 @@ static void spapr_machine_4_0_class_options(MachineCl= ass *mc) spapr_machine_4_1_class_options(mc); compat_props_add(mc->compat_props, hw_compat_4_0, hw_compat_4_0_len); smc->phb_placement =3D phb_placement_4_0; + smc->irq =3D &spapr_irq_xics; } =20 DEFINE_SPAPR_MACHINE(4_0, "4.0", false); --=20 2.20.1