From nobody Tue Feb 10 00:59:44 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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 (zohomail.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=1576558456; cv=none; d=zohomail.com; s=zohoarc; b=C0fWd7BKmgQRwRQChd1jYS0Dp/l/dm6URaGhgHTWKhGP8iyEaTUnGm4fbp2VCfc5QfmYcTjb8u6n/zWFPUMABhaN/dMk4um+p1Yu/hWody0yv94xZsJ8r87ep9heeJliPEzEGTnwwLzl3Vdw+wDYiP6aj/eE8eaKqTc/jE/JeFI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576558456; 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; bh=4pCJAY7aQOP0N8GAhivi2zK9rJBQeik3rUXyFnLvPr0=; b=mKTkADjzIvd3+gtzchebH9DRpWsc0irrGM3EVI4zOIuAzzsD58h163S2tV8ZfCPvxZUsIPpT+JBdU2dYh/YOfdQamHfclJ/dNzllTI6T9R0D2mWXE74GViZ4RANnD+zQbbH3mgVibrD7LlJOnRylDqLagPq9+ZxOLhOXyvEsjBk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 1576558456237884.5922944818268; Mon, 16 Dec 2019 20:54:16 -0800 (PST) Received: from localhost ([::1]:35218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ih4sA-0004lj-HL for importer@patchew.org; Mon, 16 Dec 2019 23:54:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33485) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ih4i0-00088F-4r for qemu-devel@nongnu.org; Mon, 16 Dec 2019 23:43:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ih4hy-0005PY-Tp for qemu-devel@nongnu.org; Mon, 16 Dec 2019 23:43:44 -0500 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:34677 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ih4hy-0005Ip-Il; Mon, 16 Dec 2019 23:43:42 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 47cQWQ5YMDz9sSZ; Tue, 17 Dec 2019 15:43:29 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1576557810; bh=pG34byp+FTDvxI9Olx4WbQLypc0hfrTikv9BQlYsOr8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CkIFCxxSJ4asBZRXXQ82IHNZKUR8ILRXCT0PIbs0n6b5oC2UgJG+EW2VrkKmiW9aJ XOQ3GTIEftefNbc2fVTjV7CXXVp3DPetrhBVpaUOqeDRm+UkUYqUhcEWtrIK8BfEVd elfS4k9ntMJ/VVVzr1PNP5OBL5+SvyXnD2TsvWFc= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 13/88] xics: Link ICP_PROP_XICS property to ICPState::xics pointer Date: Tue, 17 Dec 2019 15:42:07 +1100 Message-Id: <20191217044322.351838-14-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191217044322.351838-1-david@gibson.dropbear.id.au> References: <20191217044322.351838-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, aik@ozlabs.ru, 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: Greg Kurz The ICP object has both a pointer and an ICP_PROP_XICS property pointing to the XICS fabric. Confusing bugs could arise if these ever go out of sync. Change the property definition so that it explicitly sets the pointer. The property isn't optional : not being able to set the link is a bug and QEMU should rather abort than exit in this case. Signed-off-by: Greg Kurz Message-Id: <157403284152.409804.17114564311521923733.stgit@bahia.lan> Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: David Gibson --- hw/intc/xics.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index f7a4548089..35dddb8867 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -310,15 +310,7 @@ static void icp_realize(DeviceState *dev, Error **errp) Object *obj; Error *err =3D NULL; =20 - obj =3D object_property_get_link(OBJECT(dev), ICP_PROP_XICS, &err); - if (!obj) { - error_propagate_prepend(errp, err, - "required link '" ICP_PROP_XICS - "' not found: "); - return; - } - - icp->xics =3D XICS_FABRIC(obj); + assert(icp->xics); =20 obj =3D object_property_get_link(OBJECT(dev), ICP_PROP_CPU, &err); if (!obj) { @@ -368,12 +360,19 @@ static void icp_unrealize(DeviceState *dev, Error **e= rrp) vmstate_unregister(NULL, &vmstate_icp_server, icp); } =20 +static Property icp_properties[] =3D { + DEFINE_PROP_LINK(ICP_PROP_XICS, ICPState, xics, TYPE_XICS_FABRIC, + XICSFabric *), + DEFINE_PROP_END_OF_LIST(), +}; + static void icp_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); =20 dc->realize =3D icp_realize; dc->unrealize =3D icp_unrealize; + dc->props =3D icp_properties; /* * Reason: part of XICS interrupt controller, needs to be wired up * by icp_create(). @@ -397,9 +396,7 @@ Object *icp_create(Object *cpu, const char *type, XICSF= abric *xi, Error **errp) obj =3D object_new(type); object_property_add_child(cpu, type, obj, &error_abort); object_unref(obj); - object_ref(OBJECT(xi)); - object_property_add_const_link(obj, ICP_PROP_XICS, OBJECT(xi), - &error_abort); + object_property_set_link(obj, OBJECT(xi), ICP_PROP_XICS, &error_abort); object_ref(cpu); object_property_add_const_link(obj, ICP_PROP_CPU, cpu, &error_abort); object_property_set_bool(obj, true, "realized", &local_err); @@ -417,7 +414,6 @@ void icp_destroy(ICPState *icp) Object *obj =3D OBJECT(icp); =20 object_unref(object_property_get_link(obj, ICP_PROP_CPU, &error_abort)= ); - object_unref(object_property_get_link(obj, ICP_PROP_XICS, &error_abort= )); object_unparent(obj); } =20 --=20 2.23.0