From nobody Mon Feb 9 18:45:31 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=1558503041; cv=none; d=zoho.com; s=zohoarc; b=CCH8hAN5ns9eXyeOZAIVcmWhlxU1xe30QlxRavt2aY6/yYfLBPtVtjj8WKQIuC87JhdZ3vpBAJzM5by1ah4LKPvKTKpcq1nHEREn+PWFvjH8FYSSEdInNiphJLn9D4hWl7VNtEL0noxPVCJQY+Cb1wav6mgFCIg+9kkGNOj0LgI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558503041; 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=gaBSvx9RYXlT3jwYAbRILQyfuHiASSjfNLqlQ4QVDTQ=; b=W1H6FrRBhktYaYilV+E2rDcmAluM0zHtUDTflUTiRGDFsL0qRhqbEbdWx1kV55GD2mzCJp/6mWyr/IFBI8iOs9sMi/QZK/K3HpAHN6QLKHAfUalTecT7aj3QfrvR5K8tbuaS4VUrcKP1IaTxR2CdNbGpUEONmUCjv3BIZyjhRqw= 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 1558503041255129.82929749449625; Tue, 21 May 2019 22:30:41 -0700 (PDT) Received: from localhost ([127.0.0.1]:36461 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTJpf-00010i-GM for importer@patchew.org; Wed, 22 May 2019 01:30:34 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48503) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTJAR-0004kA-9T for qemu-devel@nongnu.org; Wed, 22 May 2019 00:47:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTJAQ-0007Xi-6l for qemu-devel@nongnu.org; Wed, 22 May 2019 00:47:55 -0400 Received: from ozlabs.org ([203.11.71.1]:41411) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hTJAP-0007IN-Qg; Wed, 22 May 2019 00:47:54 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 4580T340Xhz9sR1; Wed, 22 May 2019 14:46:11 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1558500375; bh=GUZhhj9ktzjORPqE5ENQeBsjM9/HbMGBpQ2Ql0E1fAc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e8UXYb2oxOZX/YIEnFo/D32OgwzdJ3NAQOIfCiTRqmJYS9mB+qDosPfAnf8pyUieP DUL19ybzYQ8x4RyW41HsB742F1BL7VuBQJRa1wv6jGQc1RjfQVFgu6Y16V4SoZ08QZ Nj8u9K/rlfdlIf8vAoZqsKL6K7K3fPBcaw/nZF6M= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 22 May 2019 14:45:57 +1000 Message-Id: <20190522044600.16534-36-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190522044600.16534-1-david@gibson.dropbear.id.au> References: <20190522044600.16534-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 35/38] spapr/irq: initialize the IRQ device only once 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, David Gibson 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 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=C3=A9dric Le Goater Message-Id: <20190513084245.25755-13-clg@kaod.org> Signed-off-by: David Gibson --- 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 =3D &xive->source; XiveENDSource *end_xsrc =3D &xive->end_source; =20 + /* + * 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, SpaprMachineS= tate *spapr, =20 void xics_spapr_init(SpaprMachineState *spapr) { + /* Emulated mode can only be initialized once. */ + if (spapr->ics->init) { + return; + } + + spapr->ics->init =3D 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 */ }; =20 #define ICS_PROP_XICS "xics" --=20 2.21.0