From nobody Tue Feb 10 05:46:27 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=1576780033; cv=none; d=zohomail.com; s=zohoarc; b=Z743e9XOHKraSNd2jKceoKb52ZM4nf/oZJAR4bCe3esDxXabyFyuAnTykrQLTq9dojRWHrm5+SFa0rZO4dOIx5hruTTze1QE89ZwwOcjtpgqyi3aLl0Webnwfr5Z6H+csDClK7t9y1ImdTlcqqlwcgRParT6eh7LsIwP8YyUuvM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576780033; 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=85Qs9i8UNLTv0o5VMMo6UVB/PJbSOeQoAJzZR0MVNsg=; b=CEHUyy1HDEi1HvdRiVzhJi6sNcSVqYwr3Qi9rNf2O1YXTdRhZEo3Bt3wKsX+K6akKzems8LNx2Y41JQ+TApedvnotjRqkgwE84PKw/2RLljrLgmDOwmViTn9uzLDoYSJqJAFquS2tXrkmKvh1NzGwRhS5cDlgo2cLNzWYPcwYQA= 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 1576780033658320.4561090793692; Thu, 19 Dec 2019 10:27:13 -0800 (PST) Received: from localhost ([::1]:46420 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii0Vz-0001Y8-W9 for importer@patchew.org; Thu, 19 Dec 2019 13:27:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43805) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii0IS-0001KY-Fi for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:13:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ii0IQ-0006UV-6p for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:13:12 -0500 Received: from 13.mo5.mail-out.ovh.net ([87.98.182.191]:44537) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ii0IP-0006Ok-V6 for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:13:10 -0500 Received: from player734.ha.ovh.net (unknown [10.108.16.238]) by mo5.mail-out.ovh.net (Postfix) with ESMTP id DC875263786 for ; Thu, 19 Dec 2019 19:13:08 +0100 (CET) Received: from kaod.org (lfbn-tou-1-1227-223.w90-76.abo.wanadoo.fr [90.76.50.223]) (Authenticated sender: clg@kaod.org) by player734.ha.ovh.net (Postfix) with ESMTPSA id 7FED1D6D640F; Thu, 19 Dec 2019 18:13:03 +0000 (UTC) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Subject: [PATCH v2 11/13] xive: Add a "presenter" link property to the TCTX object Date: Thu, 19 Dec 2019 19:11:53 +0100 Message-Id: <20191219181155.32530-12-clg@kaod.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191219181155.32530-1-clg@kaod.org> References: <20191219181155.32530-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 13669550770366942182 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrvdduuddguddtkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgsehtkeertdertdejnecuhfhrohhmpeevrogurhhitgcunfgvucfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecukfhppedtrddtrddtrddtpdeltddrjeeirdehtddrvddvfeenucfrrghrrghmpehmohguvgepshhmthhpqdhouhhtpdhhvghlohepphhlrgihvghrjeefgedrhhgrrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopehqvghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgnecuvehluhhsthgvrhfuihiivgepge 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: 87.98.182.191 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" This will be used in subsequent patches to access the XIVE associated to a TCTX without reaching out to the machine through qdev_get_machine(). Signed-off-by: C=C3=A9dric Le Goater [ groug: - split patch - write subject and changelog ] Signed-off-by: Greg Kurz Signed-off-by: C=C3=A9dric Le Goater --- include/hw/ppc/xive.h | 8 +++++--- hw/intc/spapr_xive.c | 2 +- hw/intc/xive.c | 6 +++++- hw/ppc/pnv.c | 3 ++- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/include/hw/ppc/xive.h b/include/hw/ppc/xive.h index 1ded82b1cda8..705cf48176fc 100644 --- a/include/hw/ppc/xive.h +++ b/include/hw/ppc/xive.h @@ -311,6 +311,8 @@ void xive_source_set_irq(void *opaque, int srcno, int v= al); #define XIVE_TM_RING_COUNT 4 #define XIVE_TM_RING_SIZE 0x10 =20 +typedef struct XivePresenter XivePresenter; + typedef struct XiveTCTX { DeviceState parent_obj; =20 @@ -319,6 +321,8 @@ typedef struct XiveTCTX { qemu_irq os_output; =20 uint8_t regs[XIVE_TM_RING_COUNT * XIVE_TM_RING_SIZE]; + + XivePresenter *xptr; } XiveTCTX; =20 /* @@ -378,8 +382,6 @@ typedef struct XiveTCTXMatch { uint8_t ring; } XiveTCTXMatch; =20 -typedef struct XivePresenter XivePresenter; - #define TYPE_XIVE_PRESENTER "xive-presenter" #define XIVE_PRESENTER(obj) \ INTERFACE_CHECK(XivePresenter, (obj), TYPE_XIVE_PRESENTER) @@ -467,7 +469,7 @@ uint64_t xive_tctx_tm_read(XivePresenter *xptr, XiveTCT= X *tctx, hwaddr offset, unsigned size); =20 void xive_tctx_pic_print_info(XiveTCTX *tctx, Monitor *mon); -Object *xive_tctx_create(Object *cpu, XiveRouter *xrtr, Error **errp); +Object *xive_tctx_create(Object *cpu, XivePresenter *xptr, Error **errp); void xive_tctx_reset(XiveTCTX *tctx); void xive_tctx_destroy(XiveTCTX *tctx); void xive_tctx_ipb_update(XiveTCTX *tctx, uint8_t ring, uint8_t ipb); diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c index 32322470a8b8..76631238783e 100644 --- a/hw/intc/spapr_xive.c +++ b/hw/intc/spapr_xive.c @@ -601,7 +601,7 @@ static int spapr_xive_cpu_intc_create(SpaprInterruptCon= troller *intc, Object *obj; SpaprCpuState *spapr_cpu =3D spapr_cpu_state(cpu); =20 - obj =3D xive_tctx_create(OBJECT(cpu), XIVE_ROUTER(xive), errp); + obj =3D xive_tctx_create(OBJECT(cpu), XIVE_PRESENTER(xive), errp); if (!obj) { return -1; } diff --git a/hw/intc/xive.c b/hw/intc/xive.c index 12a362b681a6..bc8019c4c973 100644 --- a/hw/intc/xive.c +++ b/hw/intc/xive.c @@ -654,6 +654,7 @@ static void xive_tctx_realize(DeviceState *dev, Error *= *errp) Error *local_err =3D NULL; =20 assert(tctx->cs); + assert(tctx->xptr); =20 cpu =3D POWERPC_CPU(tctx->cs); env =3D &cpu->env; @@ -727,6 +728,8 @@ static const VMStateDescription vmstate_xive_tctx =3D { =20 static Property xive_tctx_properties[] =3D { DEFINE_PROP_LINK("cpu", XiveTCTX, cs, TYPE_CPU, CPUState *), + DEFINE_PROP_LINK("presenter", XiveTCTX, xptr, TYPE_XIVE_PRESENTER, + XivePresenter *), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -752,7 +755,7 @@ static const TypeInfo xive_tctx_info =3D { .class_init =3D xive_tctx_class_init, }; =20 -Object *xive_tctx_create(Object *cpu, XiveRouter *xrtr, Error **errp) +Object *xive_tctx_create(Object *cpu, XivePresenter *xptr, Error **errp) { Error *local_err =3D NULL; Object *obj; @@ -761,6 +764,7 @@ Object *xive_tctx_create(Object *cpu, XiveRouter *xrtr,= Error **errp) object_property_add_child(cpu, TYPE_XIVE_TCTX, obj, &error_abort); object_unref(obj); object_property_set_link(obj, cpu, "cpu", &error_abort); + object_property_set_link(obj, OBJECT(xptr), "presenter", &error_abort); object_property_set_bool(obj, true, "realized", &local_err); if (local_err) { goto error; diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 34549aefa2fc..d100b6f559e2 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -920,7 +920,8 @@ static void pnv_chip_power9_intc_create(PnvChip *chip, = PowerPCCPU *cpu, * controller object is initialized afterwards. Hopefully, it's * only used at runtime. */ - obj =3D xive_tctx_create(OBJECT(cpu), XIVE_ROUTER(&chip9->xive), &loca= l_err); + obj =3D xive_tctx_create(OBJECT(cpu), XIVE_PRESENTER(&chip9->xive), + &local_err); if (local_err) { error_propagate(errp, local_err); return; --=20 2.21.0