From nobody Mon Feb 9 22:20:06 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; 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=1578324155; cv=none; d=zohomail.com; s=zohoarc; b=dnUTmH07KbpxRXl9NOlem3qOf8WDDLr1BmxMJ3nci9bJtaBtaSiLvFB9w/OmC9fhQ/Xby0xnbtEJVzjtWe8Hj9b0NpgYF52QVy5XzlWPZccZP9Dx3ucR6ZLaZtxpN9DhQ88iYbk3NR64NwCF6TpcEak+JO5wkT85bAeZRAsEkDM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578324155; 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=gMCMoarNUFevJdiMeM8lS0bIWpcLMWiE6GGYcfScUNY=; b=CV9ntxwC0f/pTh3Ovoe/ql9NNE5VFFYXIX056wUeOvQEog4CVDt6ndsj/7lJMkrzXBzrSSOgZdKwyA4PAlV1rTUNA9szdM/IO4MJdLQ9+NxDtbybvGK6xSE98wInMr01TX88DWr2Uh4ZTutzcGneOertVz6ahkpyQB4LumU3phU= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1578324155520125.77708585975006; Mon, 6 Jan 2020 07:22:35 -0800 (PST) Received: from localhost ([::1]:53412 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioUDB-0006hT-Nm for importer@patchew.org; Mon, 06 Jan 2020 10:22:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49490) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioTom-0000W5-OT for qemu-devel@nongnu.org; Mon, 06 Jan 2020 09:57:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioTol-0000io-Dj for qemu-devel@nongnu.org; Mon, 06 Jan 2020 09:57:20 -0500 Received: from 1.mo69.mail-out.ovh.net ([178.33.251.173]:41206) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ioTol-0000iM-6S for qemu-devel@nongnu.org; Mon, 06 Jan 2020 09:57:19 -0500 Received: from player731.ha.ovh.net (unknown [10.109.146.76]) by mo69.mail-out.ovh.net (Postfix) with ESMTP id E979F7AE3B for ; Mon, 6 Jan 2020 15:57:17 +0100 (CET) Received: from kaod.org (deibp9eh1--blueice1n4.emea.ibm.com [195.212.29.166]) (Authenticated sender: clg@kaod.org) by player731.ha.ovh.net (Postfix) with ESMTPSA id 41633DB3A5F9; Mon, 6 Jan 2020 14:57:12 +0000 (UTC) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Subject: [PATCH v3 04/12] spapr, pnv, xive: Add a "xive-fabric" link to the XIVE router Date: Mon, 6 Jan 2020 15:56:37 +0100 Message-Id: <20200106145645.4539-5-clg@kaod.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200106145645.4539-1-clg@kaod.org> References: <20200106145645.4539-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 5389964332362992614 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrvdehtddgjedvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojghfgggtgfesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucfkpheptddrtddrtddrtddpudelhedrvdduvddrvdelrdduieeinecurfgrrhgrmhepmhhouggvpehsmhhtphdqohhuthdphhgvlhhopehplhgrhigvrhejfedurdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomheptghlgheskhgrohgurdhorhhgpdhrtghpthhtohepqhgvmhhuqdguvghvvghlsehnohhnghhnuhdrohhrghenucevlhhushhtvghrufhiiigvpedu 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: 178.33.251.173 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: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , qemu-ppc@nongnu.org, Greg Kurz , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Greg Kurz In order to get rid of qdev_get_machine(), first add a pointer to the XIVE fabric under the XIVE router and make it configurable through a QOM link property. Configure it in the spapr and pnv machine. In the case of pnv, the XIVE routers are under the chip, so this is done with a QOM alias property of the POWER9 pnv chip. Signed-off-by: Greg Kurz Signed-off-by: C=C3=A9dric Le Goater --- include/hw/ppc/xive.h | 5 +++-- hw/intc/xive.c | 8 ++++++++ hw/ppc/pnv.c | 6 ++++++ hw/ppc/spapr_irq.c | 2 ++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/include/hw/ppc/xive.h b/include/hw/ppc/xive.h index 1b7b89098f71..1ded82b1cda8 100644 --- a/include/hw/ppc/xive.h +++ b/include/hw/ppc/xive.h @@ -324,9 +324,12 @@ typedef struct XiveTCTX { /* * XIVE Router */ +typedef struct XiveFabric XiveFabric; =20 typedef struct XiveRouter { SysBusDevice parent; + + XiveFabric *xfb; } XiveRouter; =20 #define TYPE_XIVE_ROUTER "xive-router" @@ -402,8 +405,6 @@ int xive_presenter_tctx_match(XivePresenter *xptr, Xive= TCTX *tctx, * XIVE Fabric (Interface between Interrupt Controller and Machine) */ =20 -typedef struct XiveFabric XiveFabric; - #define TYPE_XIVE_FABRIC "xive-fabric" #define XIVE_FABRIC(obj) \ INTERFACE_CHECK(XiveFabric, (obj), TYPE_XIVE_FABRIC) diff --git a/hw/intc/xive.c b/hw/intc/xive.c index d4c6e21703b3..6df89b06da38 100644 --- a/hw/intc/xive.c +++ b/hw/intc/xive.c @@ -1714,12 +1714,19 @@ void xive_router_notify(XiveNotifier *xn, uint32_t = lisn) xive_get_field64(EAS_END_DATA, eas.w)); } =20 +static Property xive_router_properties[] =3D { + DEFINE_PROP_LINK("xive-fabric", XiveRouter, xfb, + TYPE_XIVE_FABRIC, XiveFabric *), + DEFINE_PROP_END_OF_LIST(), +}; + static void xive_router_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); XiveNotifierClass *xnc =3D XIVE_NOTIFIER_CLASS(klass); =20 dc->desc =3D "XIVE Router Engine"; + dc->props =3D xive_router_properties; xnc->notify =3D xive_router_notify; } =20 @@ -1727,6 +1734,7 @@ static const TypeInfo xive_router_info =3D { .name =3D TYPE_XIVE_ROUTER, .parent =3D TYPE_SYS_BUS_DEVICE, .abstract =3D true, + .instance_size =3D sizeof(XiveRouter), .class_size =3D sizeof(XiveRouterClass), .class_init =3D xive_router_class_init, .interfaces =3D (InterfaceInfo[]) { diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index a0e0e43610a2..6d003144b6fc 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -797,6 +797,10 @@ static void pnv_init(MachineState *machine) if (object_dynamic_cast(OBJECT(pnv), TYPE_XICS_FABRIC)) { object_property_set_link(chip, OBJECT(pnv), "xics", &error_abo= rt); } + if (object_dynamic_cast(OBJECT(pnv), TYPE_XIVE_FABRIC)) { + object_property_set_link(chip, OBJECT(pnv), "xive-fabric", + &error_abort); + } object_property_set_bool(chip, true, "realized", &error_fatal); } g_free(chip_typename); @@ -1215,6 +1219,8 @@ static void pnv_chip_power9_instance_init(Object *obj) =20 object_initialize_child(obj, "xive", &chip9->xive, sizeof(chip9->xive), TYPE_PNV_XIVE, &error_abort, NULL); + object_property_add_alias(obj, "xive-fabric", OBJECT(&chip9->xive), + "xive-fabric", &error_abort); =20 object_initialize_child(obj, "psi", &chip9->psi, sizeof(chip9->psi), TYPE_PNV9_PSI, &error_abort, NULL); diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c index 373505d28b9a..1f630f296bd5 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -332,6 +332,8 @@ void spapr_irq_init(SpaprMachineState *spapr, Error **e= rrp) * priority */ qdev_prop_set_uint32(dev, "nr-ends", nr_servers << 3); + object_property_set_link(OBJECT(dev), OBJECT(spapr), "xive-fabric", + &error_abort); qdev_init_nofail(dev); =20 spapr->xive =3D SPAPR_XIVE(dev); --=20 2.21.1