From nobody Thu Dec 18 17:55:27 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1532357270195777.4640905630556; Mon, 23 Jul 2018 07:47:50 -0700 (PDT) Received: from localhost ([::1]:35001 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhc7p-0003L3-8r for importer@patchew.org; Mon, 23 Jul 2018 10:47:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43754) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhc2A-0007XG-Vv for qemu-devel@nongnu.org; Mon, 23 Jul 2018 10:42:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fhc2A-00083i-65 for qemu-devel@nongnu.org; Mon, 23 Jul 2018 10:41:59 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:43686) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fhc29-00082M-Ty for qemu-devel@nongnu.org; Mon, 23 Jul 2018 10:41:58 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1fhc28-0007jO-Mg for qemu-devel@nongnu.org; Mon, 23 Jul 2018 15:41:56 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 23 Jul 2018 15:41:52 +0100 Message-Id: <20180723144152.13885-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180723144152.13885-1-peter.maydell@linaro.org> References: <20180723144152.13885-1-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 5/5] hw/intc/exynos4210_gic: Turn instance_init into realize function 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth The instance_init function of the "exynos4210.gic" device creates a new "arm_gic" device and immediately realizes it with qdev_init_nofail(). This will leave a lot of object in the QOM tree during introspection of the "exynos4210.gic" device, e.g. reproducible by starting QEMU like this: qemu-system-aarch64 -M none -nodefaults -nographic -monitor stdio And then by running "info qom-tree" at the HMP monitor, followed by "device_add exynos4210.gic,help" and finally checking "info qom-tree" again. Also note that qdev_init_nofail() can exit QEMU in case of errors - and this must never happen during an instance_init function, otherwise QEMU could terminate unexpectedly during introspection of a device. Since most of the code that follows the qdev_init_nofail() depends on the realized "gicbusdev", the easiest solution to the problem is to turn the whole instance_init function into a realize function instead. Signed-off-by: Thomas Huth Message-id: 1532337784-334-1-git-send-email-thuth@redhat.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/intc/exynos4210_gic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/intc/exynos4210_gic.c b/hw/intc/exynos4210_gic.c index b6b00a4f589..69f9c18d736 100644 --- a/hw/intc/exynos4210_gic.c +++ b/hw/intc/exynos4210_gic.c @@ -281,9 +281,9 @@ static void exynos4210_gic_set_irq(void *opaque, int ir= q, int level) qemu_set_irq(qdev_get_gpio_in(s->gic, irq), level); } =20 -static void exynos4210_gic_init(Object *obj) +static void exynos4210_gic_realize(DeviceState *dev, Error **errp) { - DeviceState *dev =3D DEVICE(obj); + Object *obj =3D OBJECT(dev); Exynos4210GicState *s =3D EXYNOS4210_GIC(obj); SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); const char cpu_prefix[] =3D "exynos4210-gic-alias_cpu"; @@ -347,13 +347,13 @@ static void exynos4210_gic_class_init(ObjectClass *kl= ass, void *data) DeviceClass *dc =3D DEVICE_CLASS(klass); =20 dc->props =3D exynos4210_gic_properties; + dc->realize =3D exynos4210_gic_realize; } =20 static const TypeInfo exynos4210_gic_info =3D { .name =3D TYPE_EXYNOS4210_GIC, .parent =3D TYPE_SYS_BUS_DEVICE, .instance_size =3D sizeof(Exynos4210GicState), - .instance_init =3D exynos4210_gic_init, .class_init =3D exynos4210_gic_class_init, }; =20 --=20 2.17.1