From nobody Mon Feb 9 23:02:49 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=1576558225; cv=none; d=zohomail.com; s=zohoarc; b=VZDB1oMlH8fUMOxt6Hcb71m6IirYc32rMnoPV+mTNGeN7oASokjTkBfz/uqV5WKhLhy68Q48cANgVsdbpGLgX7azyurE5/Affm3wHK0rSrANIXuoU4cZuuVRGBrLDHIMzUFdgmiEBRll46+9vyuDGd55Q/QUrzvLXkICNj8qY3A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576558225; h=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=wgrf3RoVtf9oXn5NYMMi5/bal+SFccY7u+BNEWyRkVE=; b=aAMjt/tskMsp5yJikg0nWcdLTmcWOdXLYPD7JEdFgxY4bY3wJGFk5aSsACpmpTvhRPaTYJG3ahc8WfUa7DUNfJc0Ravj2F2SEhqPhF/GlwQBNvHE0QWsEwwsxXm7SaxgmAamct3S2dyxTU+iB+BCyMtAZhZSksOBJ8r6b6gzbjY= 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 1576558225392602.9706402948937; Mon, 16 Dec 2019 20:50:25 -0800 (PST) Received: from localhost ([::1]:35154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ih4oR-0007X0-OW for importer@patchew.org; Mon, 16 Dec 2019 23:50:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33243) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ih4hu-0007xh-1E for qemu-devel@nongnu.org; Mon, 16 Dec 2019 23:43:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ih4hs-0005Hj-QK for qemu-devel@nongnu.org; Mon, 16 Dec 2019 23:43:37 -0500 Received: from ozlabs.org ([203.11.71.1]:48911) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ih4hs-0005C9-Er; Mon, 16 Dec 2019 23:43:36 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 47cQWN6Sbzz9sSK; Tue, 17 Dec 2019 15:43:28 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1576557808; bh=3OB/+PigK7cKnLJGlLXLbBDqK/mIpgH/LS3KK12fuxY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PAeF7c4+d9nDESaL37rmN2tFtoBquzv9Q+lUAIN/EmM3QGd/G/+oI+xSTPS7MzL5M Szx2e5vM/SZwwRH1Km9vSKSp8bzGo8TQhqJNWmOuKvGOkNTbYpoAUpjmCuVogsb90I QKm4bWAi0QyvwbHYrV+dBcAXPlnctzoChaRfaLg8= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 05/88] xive: Link "xive" property to XiveSource::xive pointer Date: Tue, 17 Dec 2019 15:41:59 +1100 Message-Id: <20191217044322.351838-6-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: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 203.11.71.1 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 source object has both a pointer and a "xive" property pointing to the notifier object. Confusing bugs could arise if these ever go out of sync. Change the property definition so that it explicitely 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: <157383333227.165747.12901571295951957951.stgit@bahia.lan> Signed-off-by: David Gibson --- hw/intc/pnv_xive.c | 4 ++-- hw/intc/spapr_xive.c | 4 ++-- hw/intc/xive.c | 13 +++---------- hw/ppc/pnv_psi.c | 3 +-- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/hw/intc/pnv_xive.c b/hw/intc/pnv_xive.c index 348f2fdd26..9e23dc705d 100644 --- a/hw/intc/pnv_xive.c +++ b/hw/intc/pnv_xive.c @@ -1695,8 +1695,8 @@ static void pnv_xive_realize(DeviceState *dev, Error = **errp) */ object_property_set_int(OBJECT(xsrc), PNV_XIVE_NR_IRQS, "nr-irqs", &error_fatal); - object_property_add_const_link(OBJECT(xsrc), "xive", OBJECT(xive), - &error_fatal); + object_property_set_link(OBJECT(xsrc), OBJECT(xive), "xive", + &error_abort); object_property_set_bool(OBJECT(xsrc), true, "realized", &local_err); if (local_err) { error_propagate(errp, local_err); diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c index 9cb8d38a3b..10890aeeeb 100644 --- a/hw/intc/spapr_xive.c +++ b/hw/intc/spapr_xive.c @@ -276,8 +276,8 @@ static void spapr_xive_realize(DeviceState *dev, Error = **errp) */ object_property_set_int(OBJECT(xsrc), xive->nr_irqs, "nr-irqs", &error_fatal); - object_property_add_const_link(OBJECT(xsrc), "xive", OBJECT(xive), - &error_fatal); + object_property_set_link(OBJECT(xsrc), OBJECT(xive), "xive", + &error_abort); object_property_set_bool(OBJECT(xsrc), true, "realized", &local_err); if (local_err) { error_propagate(errp, local_err); diff --git a/hw/intc/xive.c b/hw/intc/xive.c index 9376e84aff..2eac15efa6 100644 --- a/hw/intc/xive.c +++ b/hw/intc/xive.c @@ -1060,17 +1060,8 @@ static void xive_source_reset(void *dev) static void xive_source_realize(DeviceState *dev, Error **errp) { XiveSource *xsrc =3D XIVE_SOURCE(dev); - Object *obj; - Error *local_err =3D NULL; - - obj =3D object_property_get_link(OBJECT(dev), "xive", &local_err); - if (!obj) { - error_propagate(errp, local_err); - error_prepend(errp, "required link 'xive' not found: "); - return; - } =20 - xsrc->xive =3D XIVE_NOTIFIER(obj); + assert(xsrc->xive); =20 if (!xsrc->nr_irqs) { error_setg(errp, "Number of interrupt needs to be greater than 0"); @@ -1116,6 +1107,8 @@ static Property xive_source_properties[] =3D { DEFINE_PROP_UINT64("flags", XiveSource, esb_flags, 0), DEFINE_PROP_UINT32("nr-irqs", XiveSource, nr_irqs, 0), DEFINE_PROP_UINT32("shift", XiveSource, esb_shift, XIVE_ESB_64K_2PAGE), + DEFINE_PROP_LINK("xive", XiveSource, xive, TYPE_XIVE_NOTIFIER, + XiveNotifier *), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/hw/ppc/pnv_psi.c b/hw/ppc/pnv_psi.c index 68d0dfacfe..a360515a86 100644 --- a/hw/ppc/pnv_psi.c +++ b/hw/ppc/pnv_psi.c @@ -851,8 +851,7 @@ static void pnv_psi_power9_realize(DeviceState *dev, Er= ror **errp) &error_fatal); object_property_set_int(OBJECT(xsrc), PSIHB9_NUM_IRQS, "nr-irqs", &error_fatal); - object_property_add_const_link(OBJECT(xsrc), "xive", OBJECT(psi), - &error_fatal); + object_property_set_link(OBJECT(xsrc), OBJECT(psi), "xive", &error_abo= rt); object_property_set_bool(OBJECT(xsrc), true, "realized", &local_err); if (local_err) { error_propagate(errp, local_err); --=20 2.23.0