From nobody Fri May 3 09:44:18 2024 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=1576779273; cv=none; d=zohomail.com; s=zohoarc; b=kompQmXYklDX4m38WBQXJc1ovY8mUqSnZBafeoGFgtxop4/kYvDtROxg1vU2OpSMAv06Q+RLvLMP1xG4eJMc3pDh7YfpUsUT4ADUdDqodqqXSur408RlNiZjHCAalGIuKXD0FaqGpHyLEE/7boqbVyvjg7LfYoXC5sGkjFatjF0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576779273; 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=sDNDh/ZW/Evq2GTlj6ORMgIfH+KAJoksc8z05rCv5KE=; b=NZ2bGmB3YyhJa76o4FfbI4e29ZkaHiz3y1gjV2tIh2KJlyWXQwfEkIfy2d3ObpHFbN3f+58ZxhY4DYsztETL4N429VNdILLMg/8rgITcJM1AQv/b/mQCe1rYIY1wEhrbimi++78kYrTPh88aBqXnPYS0y4AIukbSAkjompqvl8I= 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 1576779273741608.4357528348341; Thu, 19 Dec 2019 10:14:33 -0800 (PST) Received: from localhost ([::1]:46216 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii0Jk-0002IL-05 for importer@patchew.org; Thu, 19 Dec 2019 13:14:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37758) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii0Ha-0008Pb-3y for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:12:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ii0HX-0001ml-Rx for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:12:16 -0500 Received: from 4.mo7.mail-out.ovh.net ([178.32.122.254]:42614) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ii0HX-0001dC-Ka for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:12:15 -0500 Received: from player734.ha.ovh.net (unknown [10.108.16.68]) by mo7.mail-out.ovh.net (Postfix) with ESMTP id E09A2147AA3 for ; Thu, 19 Dec 2019 19:12:13 +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 63298D6D6255; Thu, 19 Dec 2019 18:12:08 +0000 (UTC) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Subject: [PATCH v2 01/13] ppc/pnv: Modify the powerdown notifier to get the PowerNV machine Date: Thu, 19 Dec 2019 19:11:43 +0100 Message-Id: <20191219181155.32530-2-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: 13654069647169588198 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrvdduuddguddtkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgsehtkeertdertdejnecuhfhrohhmpeevrogurhhitgcunfgvucfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecukfhppedtrddtrddtrddtpdeltddrjeeirdehtddrvddvfeenucfrrghrrghmpehmohguvgepshhmthhpqdhouhhtpdhhvghlohepphhlrgihvghrjeefgedrhhgrrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopehqvghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgnecuvehluhhsthgvrhfuihiivgeptd 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.32.122.254 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" Use container_of() instead of qdev_get_machine() Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz Signed-off-by: C=C3=A9dric Le Goater --- hw/ppc/pnv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index f77e7ca84ede..855254f28263 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -561,7 +561,7 @@ static void *pnv_dt_create(MachineState *machine) =20 static void pnv_powerdown_notify(Notifier *n, void *opaque) { - PnvMachineState *pnv =3D PNV_MACHINE(qdev_get_machine()); + PnvMachineState *pnv =3D container_of(n, PnvMachineState, powerdown_no= tifier); =20 if (pnv->bmc) { pnv_bmc_powerdown(pnv->bmc); --=20 2.21.0 From nobody Fri May 3 09:44:18 2024 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=1576779465; cv=none; d=zohomail.com; s=zohoarc; b=FyupKJrbV/QU/+pbTTjeyxsnJOzoLGdaRKmWMxKc50ERd8YRUb/4qlu0dDOaGzyaAM4Xke2Sfs3N7+gv2DAhRIwtx+uX4jtVmFAby9vvVAxo72QVyOdn+426iUEP/TGHnZzRkDPMTgrfXBM+L6pNdyLnYBS0fvlfRKJfG3MjIrc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576779465; 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=d+BQWWRwK7R3LovyBKCMYWsaTUgYbDV+nVuU9HLviBE=; b=FzuBT8WYWHTB2iqyojXVCKY+jXuboJlgUXYF7inSVeGkrH4UkNQZuauQSbCkz4nLqTn1+bg2jIG8tvtWJtcm7nPZ6L10jfaOzN80o4SkAr6XPFMAZ/nBxFD0QnQivC9tzfjpR80hhDiNgMshQWJunVzljBDAhp5O59GgyMIBnGY= 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 1576779465280962.4620171690465; Thu, 19 Dec 2019 10:17:45 -0800 (PST) Received: from localhost ([::1]:46254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii0Mp-00061A-JM for importer@patchew.org; Thu, 19 Dec 2019 13:17:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38479) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii0Hg-00005C-Iu for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:12:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ii0Hd-0002KX-Ld for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:12:24 -0500 Received: from 5.mo177.mail-out.ovh.net ([46.105.39.154]:37868) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ii0Hd-0002Bz-BW for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:12:21 -0500 Received: from player734.ha.ovh.net (unknown [10.108.57.43]) by mo177.mail-out.ovh.net (Postfix) with ESMTP id A73C011B894 for ; Thu, 19 Dec 2019 19:12:19 +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 E5971D6D6287; Thu, 19 Dec 2019 18:12:13 +0000 (UTC) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Subject: [PATCH v2 02/13] ppc/pnv: Introduce a "system-memory" property Date: Thu, 19 Dec 2019 19:11:44 +0100 Message-Id: <20191219181155.32530-3-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: 13655758498386119654 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrvdduuddguddtkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgsehtkeertdertdejnecuhfhrohhmpeevrogurhhitgcunfgvucfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecukfhppedtrddtrddtrddtpdeltddrjeeirdehtddrvddvfeenucfrrghrrghmpehmohguvgepshhmthhpqdhouhhtpdhhvghlohepphhlrgihvghrjeefgedrhhgrrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopehqvghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgnecuvehluhhsthgvrhfuihiivgeptd 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: 46.105.39.154 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" and use a link to pass the system memory to the device models that require it to map/unmap BARs. This replace the use of get_system_memory() Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz --- include/hw/ppc/pnv.h | 2 ++ include/hw/ppc/pnv_psi.h | 1 + include/hw/ppc/pnv_xive.h | 2 ++ hw/intc/pnv_xive.c | 5 ++++- hw/ppc/pnv.c | 33 ++++++++++++++++++++++++++------- hw/ppc/pnv_psi.c | 13 ++++++++++--- 6 files changed, 45 insertions(+), 11 deletions(-) diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h index f78fd0dd967c..f31180618672 100644 --- a/include/hw/ppc/pnv.h +++ b/include/hw/ppc/pnv.h @@ -56,6 +56,8 @@ typedef struct PnvChip { AddressSpace xscom_as; =20 gchar *dt_isa_nodename; + + MemoryRegion *system_memory; } PnvChip; =20 #define TYPE_PNV8_CHIP "pnv8-chip" diff --git a/include/hw/ppc/pnv_psi.h b/include/hw/ppc/pnv_psi.h index f0f5b5519767..f85babaff0be 100644 --- a/include/hw/ppc/pnv_psi.h +++ b/include/hw/ppc/pnv_psi.h @@ -35,6 +35,7 @@ typedef struct PnvPsi { =20 MemoryRegion regs_mr; uint64_t bar; + MemoryRegion *system_memory; =20 /* FSP region not supported */ /* MemoryRegion fsp_mr; */ diff --git a/include/hw/ppc/pnv_xive.h b/include/hw/ppc/pnv_xive.h index f4c7caad40ee..4d641db691c8 100644 --- a/include/hw/ppc/pnv_xive.h +++ b/include/hw/ppc/pnv_xive.h @@ -30,6 +30,8 @@ typedef struct PnvXive { /* Owning chip */ struct PnvChip *chip; =20 + MemoryRegion *system_memory; + /* XSCOM addresses giving access to the controller registers */ MemoryRegion xscom_regs; =20 diff --git a/hw/intc/pnv_xive.c b/hw/intc/pnv_xive.c index a0a69b98a713..66970a60733b 100644 --- a/hw/intc/pnv_xive.c +++ b/hw/intc/pnv_xive.c @@ -853,7 +853,7 @@ static void pnv_xive_ic_reg_write(void *opaque, hwaddr = offset, uint64_t val, unsigned size) { PnvXive *xive =3D PNV_XIVE(opaque); - MemoryRegion *sysmem =3D get_system_memory(); + MemoryRegion *sysmem =3D xive->system_memory; uint32_t reg =3D offset >> 3; bool is_chip0 =3D xive->chip->chip_id =3D=3D 0; =20 @@ -1821,6 +1821,7 @@ static void pnv_xive_realize(DeviceState *dev, Error = **errp) Error *local_err =3D NULL; =20 assert(xive->chip); + assert(xive->system_memory); =20 /* * The XiveSource and XiveENDSource objects are realized with the @@ -1937,6 +1938,8 @@ static Property pnv_xive_properties[] =3D { DEFINE_PROP_UINT64("tm-bar", PnvXive, tm_base, 0), /* The PnvChip id identifies the XIVE interrupt controller. */ DEFINE_PROP_LINK("chip", PnvXive, chip, TYPE_PNV_CHIP, PnvChip *), + DEFINE_PROP_LINK("system-memory", PnvXive, system_memory, + TYPE_MEMORY_REGION, MemoryRegion *), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 855254f28263..1d8bfb164a32 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -674,6 +674,7 @@ static void pnv_chip_power10_pic_print_info(PnvChip *ch= ip, Monitor *mon) =20 static void pnv_init(MachineState *machine) { + MemoryRegion *sysmem =3D get_system_memory(); PnvMachineState *pnv =3D PNV_MACHINE(machine); MachineClass *mc =3D MACHINE_GET_CLASS(machine); MemoryRegion *ram; @@ -692,7 +693,7 @@ static void pnv_init(MachineState *machine) ram =3D g_new(MemoryRegion, 1); memory_region_allocate_system_memory(ram, NULL, "pnv.ram", machine->ram_size); - memory_region_add_subregion(get_system_memory(), 0, ram); + memory_region_add_subregion(sysmem, 0, ram); =20 /* * Create our simple PNOR device @@ -790,6 +791,12 @@ static void pnv_init(MachineState *machine) &error_fatal); object_property_set_int(chip, machine->smp.cores, "nr-cores", &error_fatal); + /* + * TODO: Only the MMIO range should be of interest for the + * controllers + */ + object_property_set_link(chip, OBJECT(sysmem), "system-memory", + &error_abort); object_property_set_bool(chip, true, "realized", &error_fatal); } g_free(chip_typename); @@ -1060,6 +1067,8 @@ static void pnv_chip_power8_realize(DeviceState *dev,= Error **errp) /* Processor Service Interface (PSI) Host Bridge */ object_property_set_int(OBJECT(&chip8->psi), PNV_PSIHB_BASE(chip), "bar", &error_fatal); + object_property_set_link(OBJECT(&chip8->psi), OBJECT(chip->system_memo= ry), + "system-memory", &error_abort); object_property_set_bool(OBJECT(&chip8->psi), true, "realized", &local= _err); if (local_err) { error_propagate(errp, local_err); @@ -1100,7 +1109,7 @@ static void pnv_chip_power8_realize(DeviceState *dev,= Error **errp) pnv_xscom_add_subregion(chip, PNV_XSCOM_OCC_BASE, &chip8->occ.xscom_re= gs); =20 /* OCC SRAM model */ - memory_region_add_subregion(get_system_memory(), PNV_OCC_SENSOR_BASE(c= hip), + memory_region_add_subregion(chip->system_memory, PNV_OCC_SENSOR_BASE(c= hip), &chip8->occ.sram_regs); =20 /* HOMER */ @@ -1116,7 +1125,7 @@ static void pnv_chip_power8_realize(DeviceState *dev,= Error **errp) pnv_xscom_add_subregion(chip, PNV_XSCOM_PBA_BASE, &chip8->homer.pba_re= gs); =20 /* Homer mmio region */ - memory_region_add_subregion(get_system_memory(), PNV_HOMER_BASE(chip), + memory_region_add_subregion(chip->system_memory, PNV_HOMER_BASE(chip), &chip8->homer.regs); } =20 @@ -1280,6 +1289,8 @@ static void pnv_chip_power9_realize(DeviceState *dev,= Error **errp) "tm-bar", &error_fatal); object_property_set_link(OBJECT(&chip9->xive), OBJECT(chip), "chip", &error_abort); + object_property_set_link(OBJECT(&chip9->xive), OBJECT(chip->system_mem= ory), + "system-memory", &error_abort); object_property_set_bool(OBJECT(&chip9->xive), true, "realized", &local_err); if (local_err) { @@ -1292,6 +1303,8 @@ static void pnv_chip_power9_realize(DeviceState *dev,= Error **errp) /* Processor Service Interface (PSI) Host Bridge */ object_property_set_int(OBJECT(&chip9->psi), PNV9_PSIHB_BASE(chip), "bar", &error_fatal); + object_property_set_link(OBJECT(&chip9->psi), OBJECT(chip->system_memo= ry), + "system-memory", &error_abort); object_property_set_bool(OBJECT(&chip9->psi), true, "realized", &local= _err); if (local_err) { error_propagate(errp, local_err); @@ -1308,7 +1321,7 @@ static void pnv_chip_power9_realize(DeviceState *dev,= Error **errp) error_propagate(errp, local_err); return; } - memory_region_add_subregion(get_system_memory(), PNV9_LPCM_BASE(chip), + memory_region_add_subregion(chip->system_memory, PNV9_LPCM_BASE(chip), &chip9->lpc.xscom_regs); =20 chip->dt_isa_nodename =3D g_strdup_printf("/lpcm-opb@%" PRIx64 "/lpc@0= ", @@ -1325,7 +1338,7 @@ static void pnv_chip_power9_realize(DeviceState *dev,= Error **errp) pnv_xscom_add_subregion(chip, PNV9_XSCOM_OCC_BASE, &chip9->occ.xscom_r= egs); =20 /* OCC SRAM model */ - memory_region_add_subregion(get_system_memory(), PNV9_OCC_SENSOR_BASE(= chip), + memory_region_add_subregion(chip->system_memory, PNV9_OCC_SENSOR_BASE(= chip), &chip9->occ.sram_regs); =20 /* HOMER */ @@ -1341,7 +1354,7 @@ static void pnv_chip_power9_realize(DeviceState *dev,= Error **errp) pnv_xscom_add_subregion(chip, PNV9_XSCOM_PBA_BASE, &chip9->homer.pba_r= egs); =20 /* Homer mmio region */ - memory_region_add_subregion(get_system_memory(), PNV9_HOMER_BASE(chip), + memory_region_add_subregion(chip->system_memory, PNV9_HOMER_BASE(chip), &chip9->homer.regs); } =20 @@ -1408,6 +1421,8 @@ static void pnv_chip_power10_realize(DeviceState *dev= , Error **errp) /* Processor Service Interface (PSI) Host Bridge */ object_property_set_int(OBJECT(&chip10->psi), PNV10_PSIHB_BASE(chip), "bar", &error_fatal); + object_property_set_link(OBJECT(&chip10->psi), OBJECT(chip->system_mem= ory), + "system-memory", &error_abort); object_property_set_bool(OBJECT(&chip10->psi), true, "realized", &local_err); if (local_err) { @@ -1426,7 +1441,7 @@ static void pnv_chip_power10_realize(DeviceState *dev= , Error **errp) error_propagate(errp, local_err); return; } - memory_region_add_subregion(get_system_memory(), PNV10_LPCM_BASE(chip), + memory_region_add_subregion(chip->system_memory, PNV10_LPCM_BASE(chip), &chip10->lpc.xscom_regs); =20 chip->dt_isa_nodename =3D g_strdup_printf("/lpcm-opb@%" PRIx64 "/lpc@0= ", @@ -1556,6 +1571,8 @@ static void pnv_chip_realize(DeviceState *dev, Error = **errp) PnvChip *chip =3D PNV_CHIP(dev); Error *error =3D NULL; =20 + assert(chip->system_memory); + /* Cores */ pnv_chip_core_realize(chip, &error); if (error) { @@ -1570,6 +1587,8 @@ static Property pnv_chip_properties[] =3D { DEFINE_PROP_UINT64("ram-size", PnvChip, ram_size, 0), DEFINE_PROP_UINT32("nr-cores", PnvChip, nr_cores, 1), DEFINE_PROP_UINT64("cores-mask", PnvChip, cores_mask, 0x0), + DEFINE_PROP_LINK("system-memory", PnvChip, system_memory, + TYPE_MEMORY_REGION, MemoryRegion *), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/hw/ppc/pnv_psi.c b/hw/ppc/pnv_psi.c index 75e20d9da08b..28d34e5c193a 100644 --- a/hw/ppc/pnv_psi.c +++ b/hw/ppc/pnv_psi.c @@ -126,7 +126,7 @@ static void pnv_psi_set_bar(PnvPsi *psi, uint64_t bar) { PnvPsiClass *ppc =3D PNV_PSI_GET_CLASS(psi); - MemoryRegion *sysmem =3D get_system_memory(); + MemoryRegion *sysmem =3D psi->system_memory; uint64_t old =3D psi->regs[PSIHB_XSCOM_BAR]; =20 psi->regs[PSIHB_XSCOM_BAR] =3D bar & (ppc->bar_mask | PSIHB_BAR_EN); @@ -489,6 +489,8 @@ static void pnv_psi_power8_realize(DeviceState *dev, Er= ror **errp) Error *err =3D NULL; unsigned int i; =20 + assert(psi->system_memory); + obj =3D object_property_get_link(OBJECT(dev), "xics", &err); if (!obj) { error_setg(errp, "%s: required link 'xics' not found: %s", @@ -562,6 +564,8 @@ static int pnv_psi_dt_xscom(PnvXScomInterface *dev, voi= d *fdt, int xscom_offset) static Property pnv_psi_properties[] =3D { DEFINE_PROP_UINT64("bar", PnvPsi, bar, 0), DEFINE_PROP_UINT64("fsp-bar", PnvPsi, fsp_bar, 0), + DEFINE_PROP_LINK("system-memory", PnvPsi, system_memory, + TYPE_MEMORY_REGION, MemoryRegion *), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -701,7 +705,7 @@ static void pnv_psi_p9_mmio_write(void *opaque, hwaddr = addr, PnvPsi *psi =3D PNV_PSI(opaque); Pnv9Psi *psi9 =3D PNV9_PSI(psi); uint32_t reg =3D PSIHB_REG(addr); - MemoryRegion *sysmem =3D get_system_memory(); + MemoryRegion *sysmem =3D psi->system_memory; =20 switch (addr) { case PSIHB9_CR: @@ -819,11 +823,12 @@ static void pnv_psi_power9_irq_set(PnvPsi *psi, int i= rq, bool state) static void pnv_psi_power9_reset(void *dev) { Pnv9Psi *psi =3D PNV9_PSI(dev); + MemoryRegion *sysmem =3D PNV_PSI(psi)->system_memory; =20 pnv_psi_reset(dev); =20 if (memory_region_is_mapped(&psi->source.esb_mmio)) { - memory_region_del_subregion(get_system_memory(), &psi->source.esb_= mmio); + memory_region_del_subregion(sysmem, &psi->source.esb_mmio); } } =20 @@ -842,6 +847,8 @@ static void pnv_psi_power9_realize(DeviceState *dev, Er= ror **errp) Error *local_err =3D NULL; int i; =20 + assert(psi->system_memory); + /* This is the only device with 4k ESB pages */ object_property_set_int(OBJECT(xsrc), XIVE_ESB_4K, "shift", &error_fatal); --=20 2.21.0 From nobody Fri May 3 09:44:18 2024 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=1576779622; cv=none; d=zohomail.com; s=zohoarc; b=VE84XNX5uzhU3xou7KABVFYyo0CVUfV4nFqN9d05ZOqVyNeqycqYwFbPceU+fJNDTrpSzQCpwWDYJKJCIA46mAHVk4Ujp4xRI/VALlKSqFR3x3ubr7QD/oYnXYh8JU6Ju1WVBGczodMjtyN2O5yQ4xsHwqXKyAE80CftroBI9sU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576779622; 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=t4C8K0QvQLQT3WhMlB9mTuX6w0zErJfrLutDorAYNCQ=; b=GXtr4fQAeO2yvUcqPXPUd1Alznc6cQPshV4x53rHbUUyKqCofAOBWXoPewzyg7j40mfVU9rxyguuIkvlnISXpIpgk9HFf7IvzM1HhW8JkWF72xxQ52pbqbImn3K6PWUda59Dsx08XsjeaReY/qzuauCgX0I1nia0FElF+UY7tyw= 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 1576779622064810.3655758624595; Thu, 19 Dec 2019 10:20:22 -0800 (PST) Received: from localhost ([::1]:46284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii0PL-0000Xe-U1 for importer@patchew.org; Thu, 19 Dec 2019 13:20:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38858) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii0Hk-0000BI-1O for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:12:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ii0Hi-0002rE-Sc for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:12:27 -0500 Received: from 13.mo5.mail-out.ovh.net ([87.98.182.191]:39580) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ii0Hi-0002i6-KB for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:12:26 -0500 Received: from player734.ha.ovh.net (unknown [10.108.35.223]) by mo5.mail-out.ovh.net (Postfix) with ESMTP id F2719263592 for ; Thu, 19 Dec 2019 19:12:24 +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 6A3A3D6D62BE; Thu, 19 Dec 2019 18:12:19 +0000 (UTC) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Subject: [PATCH v2 03/13] ppc/pnv: Introduce a "xics" property alias under the PSI model Date: Thu, 19 Dec 2019 19:11:45 +0100 Message-Id: <20191219181155.32530-4-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: 13657165873883679718 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrvdduuddguddtkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgsehtkeertdertdejnecuhfhrohhmpeevrogurhhitgcunfgvucfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecukfhppedtrddtrddtrddtpdeltddrjeeirdehtddrvddvfeenucfrrghrrghmpehmohguvgepshhmthhpqdhouhhtpdhhvghlohepphhlrgihvghrjeefgedrhhgrrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopehqvghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgnecuvehluhhsthgvrhfuihiivgepud 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 removes the need of the intermediate link under PSI to pass the XICS link to the underlying ICSState object. Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz Signed-off-by: C=C3=A9dric Le Goater --- hw/ppc/pnv.c | 4 ++-- hw/ppc/pnv_psi.c | 11 ++--------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 1d8bfb164a32..163a658806e2 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -999,8 +999,6 @@ static void pnv_chip_power8_instance_init(Object *obj) =20 object_initialize_child(obj, "psi", &chip8->psi, sizeof(chip8->psi), TYPE_PNV8_PSI, &error_abort, NULL); - object_property_add_const_link(OBJECT(&chip8->psi), "xics", - OBJECT(qdev_get_machine()), &error_abor= t); =20 object_initialize_child(obj, "lpc", &chip8->lpc, sizeof(chip8->lpc), TYPE_PNV8_LPC, &error_abort, NULL); @@ -1069,6 +1067,8 @@ static void pnv_chip_power8_realize(DeviceState *dev,= Error **errp) "bar", &error_fatal); object_property_set_link(OBJECT(&chip8->psi), OBJECT(chip->system_memo= ry), "system-memory", &error_abort); + object_property_set_link(OBJECT(&chip8->psi), OBJECT(qdev_get_machine(= )), + ICS_PROP_XICS, &error_abort); object_property_set_bool(OBJECT(&chip8->psi), true, "realized", &local= _err); if (local_err) { error_propagate(errp, local_err); diff --git a/hw/ppc/pnv_psi.c b/hw/ppc/pnv_psi.c index 28d34e5c193a..d3124f673571 100644 --- a/hw/ppc/pnv_psi.c +++ b/hw/ppc/pnv_psi.c @@ -470,6 +470,8 @@ static void pnv_psi_power8_instance_init(Object *obj) =20 object_initialize_child(obj, "ics-psi", &psi8->ics, sizeof(psi8->ics), TYPE_ICS, &error_abort, NULL); + object_property_add_alias(obj, ICS_PROP_XICS, OBJECT(&psi8->ics), + ICS_PROP_XICS, &error_abort); } =20 static const uint8_t irq_to_xivr[] =3D { @@ -485,21 +487,12 @@ static void pnv_psi_power8_realize(DeviceState *dev, = Error **errp) { PnvPsi *psi =3D PNV_PSI(dev); ICSState *ics =3D &PNV8_PSI(psi)->ics; - Object *obj; Error *err =3D NULL; unsigned int i; =20 assert(psi->system_memory); =20 - obj =3D object_property_get_link(OBJECT(dev), "xics", &err); - if (!obj) { - error_setg(errp, "%s: required link 'xics' not found: %s", - __func__, error_get_pretty(err)); - return; - } - /* Create PSI interrupt control source */ - object_property_set_link(OBJECT(ics), obj, ICS_PROP_XICS, &error_abort= ); object_property_set_int(OBJECT(ics), PSI_NUM_INTERRUPTS, "nr-irqs", &e= rr); if (err) { error_propagate(errp, err); --=20 2.21.0 From nobody Fri May 3 09:44:18 2024 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=1576779380; cv=none; d=zohomail.com; s=zohoarc; b=Rkh0F+xcXiT+jejAGxgs8SaIvY1CKrUhnOnvRX0c4wvdBbUq5kbAQhEZlSGV3ecsoRmtfemy6zZcHqbxoUPFmXWq8YAgP8BIRRGwFEviGhshR/JnQ0gVurzAvqazzFeoVVCO8mXBGenMlbKxotU+OKC80bcHH3AJJ0JNPYA2DmM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576779380; 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=DHBUOhZ4icX558RySHSdYgnBuV+1JktrciXYuTEfEO8=; b=NIMSyOjq/OwW4QIBlMWJWnhFr2JXhFFwRKFYtO5rlWsJU2Kt3SsKj5o6tpTsZ9hOeKCOGqXu6dHbZ/y9Dxdl2lkW+F3Mff8xQjmGhl+FJtAErjzY3xVyR/bLDonLnlBPJbz7N/BLAtdVjJrgHMoNkm6SxSXwpqU0T4nlPoOyfTc= 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 1576779380613399.2766052346931; Thu, 19 Dec 2019 10:16:20 -0800 (PST) Received: from localhost ([::1]:46234 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii0LS-0004Ap-Ss for importer@patchew.org; Thu, 19 Dec 2019 13:16:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39506) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii0Hp-0000LF-NT for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:12:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ii0Ho-0003M9-DR for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:12:33 -0500 Received: from 15.mo5.mail-out.ovh.net ([178.33.107.29]:42168) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ii0Ho-0003DH-4A for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:12:32 -0500 Received: from player734.ha.ovh.net (unknown [10.108.16.42]) by mo5.mail-out.ovh.net (Postfix) with ESMTP id 83238263637 for ; Thu, 19 Dec 2019 19:12:30 +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 DB1BAD6D632E; Thu, 19 Dec 2019 18:12:24 +0000 (UTC) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Subject: [PATCH v2 04/13] ppc/pnv: Introduce a "xics" property under the POWER8 chip Date: Thu, 19 Dec 2019 19:11:46 +0100 Message-Id: <20191219181155.32530-5-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: 13658854720716966886 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrvdduuddguddtkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgsehtkeertdertdejnecuhfhrohhmpeevrogurhhitgcunfgvucfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecukfhppedtrddtrddtrddtpdeltddrjeeirdehtddrvddvfeenucfrrghrrghmpehmohguvgepshhmthhpqdhouhhtpdhhvghlohepphhlrgihvghrjeefgedrhhgrrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopehqvghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgnecuvehluhhsthgvrhfuihiivgepud 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.107.29 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" POWER8 is the only chip using the XICS interface. Add a "xics" link and a XICSFabric attribute under this chip to remove the use of qdev_get_machine() Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: David Gibson --- include/hw/ppc/pnv.h | 2 ++ hw/ppc/pnv.c | 26 ++++++++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h index f31180618672..8b957dfb5736 100644 --- a/include/hw/ppc/pnv.h +++ b/include/hw/ppc/pnv.h @@ -74,6 +74,8 @@ typedef struct Pnv8Chip { Pnv8Psi psi; PnvOCC occ; PnvHomer homer; + + XICSFabric *xics; } Pnv8Chip; =20 #define TYPE_PNV9_CHIP "pnv9-chip" diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 163a658806e2..2a1b15a69aed 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -797,6 +797,13 @@ static void pnv_init(MachineState *machine) */ object_property_set_link(chip, OBJECT(sysmem), "system-memory", &error_abort); + /* + * The POWER8 machine use the XICS interrupt interface. + * Propagate the XICS fabric to the chip and its controllers. + */ + if (object_dynamic_cast(OBJECT(pnv), TYPE_XICS_FABRIC)) { + object_property_set_link(chip, OBJECT(pnv), "xics", &error_abo= rt); + } object_property_set_bool(chip, true, "realized", &error_fatal); } g_free(chip_typename); @@ -838,12 +845,12 @@ static uint32_t pnv_chip_core_pir_p8(PnvChip *chip, u= int32_t core_id) static void pnv_chip_power8_intc_create(PnvChip *chip, PowerPCCPU *cpu, Error **errp) { + Pnv8Chip *chip8 =3D PNV8_CHIP(chip); Error *local_err =3D NULL; Object *obj; PnvCPUState *pnv_cpu =3D pnv_cpu_state(cpu); =20 - obj =3D icp_create(OBJECT(cpu), TYPE_PNV_ICP, XICS_FABRIC(qdev_get_mac= hine()), - &local_err); + obj =3D icp_create(OBJECT(cpu), TYPE_PNV_ICP, chip8->xics, &local_err); if (local_err) { error_propagate(errp, local_err); return; @@ -997,6 +1004,12 @@ static void pnv_chip_power8_instance_init(Object *obj) { Pnv8Chip *chip8 =3D PNV8_CHIP(obj); =20 + object_property_add_link(obj, "xics", TYPE_XICS_FABRIC, + (Object **)&chip8->xics, + object_property_allow_set_link, + OBJ_PROP_LINK_STRONG, + &error_abort); + object_initialize_child(obj, "psi", &chip8->psi, sizeof(chip8->psi), TYPE_PNV8_PSI, &error_abort, NULL); =20 @@ -1016,7 +1029,6 @@ static void pnv_chip_icp_realize(Pnv8Chip *chip8, Err= or **errp) PnvChipClass *pcc =3D PNV_CHIP_GET_CLASS(chip); int i, j; char *name; - XICSFabric *xi =3D XICS_FABRIC(qdev_get_machine()); =20 name =3D g_strdup_printf("icp-%x", chip->chip_id); memory_region_init(&chip8->icp_mmio, OBJECT(chip), name, PNV_ICP_SIZE); @@ -1032,7 +1044,7 @@ static void pnv_chip_icp_realize(Pnv8Chip *chip8, Err= or **errp) =20 for (j =3D 0; j < CPU_CORE(pnv_core)->nr_threads; j++) { uint32_t pir =3D pcc->core_pir(chip, core_hwid) + j; - PnvICPState *icp =3D PNV_ICP(xics_icp_get(xi, pir)); + PnvICPState *icp =3D PNV_ICP(xics_icp_get(chip8->xics, pir)); =20 memory_region_add_subregion(&chip8->icp_mmio, pir << 12, &icp->mmio); @@ -1048,6 +1060,8 @@ static void pnv_chip_power8_realize(DeviceState *dev,= Error **errp) Pnv8Psi *psi8 =3D &chip8->psi; Error *local_err =3D NULL; =20 + assert(chip8->xics); + /* XSCOM bridge is first */ pnv_xscom_realize(chip, PNV_XSCOM_SIZE, &local_err); if (local_err) { @@ -1067,8 +1081,8 @@ static void pnv_chip_power8_realize(DeviceState *dev,= Error **errp) "bar", &error_fatal); object_property_set_link(OBJECT(&chip8->psi), OBJECT(chip->system_memo= ry), "system-memory", &error_abort); - object_property_set_link(OBJECT(&chip8->psi), OBJECT(qdev_get_machine(= )), - ICS_PROP_XICS, &error_abort); + object_property_set_link(OBJECT(&chip8->psi), OBJECT(chip8->xics), + ICS_PROP_XICS, &error_abort); object_property_set_bool(OBJECT(&chip8->psi), true, "realized", &local= _err); if (local_err) { error_propagate(errp, local_err); --=20 2.21.0 From nobody Fri May 3 09:44:18 2024 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=1576779557; cv=none; d=zohomail.com; s=zohoarc; b=iQe/MEUvn2vq6sTAN3MVziZQZt1Ojo0o4kzxjxESQYWCi+pQ9NQ5s8EdDxtdvIhbssszS1SljVsn8zKC/J/21VJbfog28/djQ8+zRjjs9Tc7EVYC6dqX0vx2jBHGj3gm/ux4tbffvtk8GN1HdEC9IBOaYIkZ+Z/fg1wxMVxofc8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576779557; 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=jWujchfmcWqi+lk6MsqW5o3btPJ3+PYqu6emFLj6zGg=; b=ldB3111caYzUHETPe6mf2kAZyfwOAAAu9mbyQr4W99uvADrHbqumLIAdmY1Eaux25MAsoHBthXlL+DXL9Byuvz+4FSBEGdHNnL3iMYB3Y2mfztvo0JbRTbLXEC5py1jxQFjk+xvO5vdabXoIxcpjnUF/2KZEVU1Pu0t9qxBS11g= 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 1576779557379249.81234550438535; Thu, 19 Dec 2019 10:19:17 -0800 (PST) Received: from localhost ([::1]:46274 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii0OJ-0007kw-Ln for importer@patchew.org; Thu, 19 Dec 2019 13:19:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40322) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii0Hw-0000UW-M4 for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:12:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ii0Hv-0003xT-BJ for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:12:40 -0500 Received: from 20.mo4.mail-out.ovh.net ([46.105.33.73]:60448) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ii0Hv-0003iz-4G for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:12:39 -0500 Received: from player734.ha.ovh.net (unknown [10.108.35.110]) by mo4.mail-out.ovh.net (Postfix) with ESMTP id 2DCC021BE3F for ; Thu, 19 Dec 2019 19:12:35 +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 87F0ED6D637D; Thu, 19 Dec 2019 18:12:30 +0000 (UTC) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Subject: [PATCH v2 05/13] spapr/xive: Use device_class_set_parent_realize() Date: Thu, 19 Dec 2019 19:11:47 +0100 Message-Id: <20191219181155.32530-6-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: 13660262095190133734 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrvdduuddguddtkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgsehtkeertdertdejnecuhfhrohhmpeevrogurhhitgcunfgvucfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecukfhppedtrddtrddtrddtpdeltddrjeeirdehtddrvddvfeenucfrrghrrghmpehmohguvgepshhmthhpqdhouhhtpdhhvghlohepphhlrgihvghrjeefgedrhhgrrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopehqvghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgnecuvehluhhsthgvrhfuihiivgeptd 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: 46.105.33.73 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 The XIVE router base class currently inherits an empty realize hook from the sysbus device base class, but it will soon implement one of its own to perform some sanity checks. Do the preliminary plumbing to have it called. Signed-off-by: Greg Kurz Signed-off-by: C=C3=A9dric Le Goater --- include/hw/ppc/spapr_xive.h | 10 ++++++++++ hw/intc/spapr_xive.c | 12 +++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/include/hw/ppc/spapr_xive.h b/include/hw/ppc/spapr_xive.h index 3a103c224d44..93d09d68deb7 100644 --- a/include/hw/ppc/spapr_xive.h +++ b/include/hw/ppc/spapr_xive.h @@ -15,6 +15,10 @@ =20 #define TYPE_SPAPR_XIVE "spapr-xive" #define SPAPR_XIVE(obj) OBJECT_CHECK(SpaprXive, (obj), TYPE_SPAPR_XIVE) +#define SPAPR_XIVE_CLASS(klass) \ + OBJECT_CLASS_CHECK(SpaprXiveClass, (klass), TYPE_SPAPR_XIVE) +#define SPAPR_XIVE_GET_CLASS(obj) \ + OBJECT_GET_CLASS(SpaprXiveClass, (obj), TYPE_SPAPR_XIVE) =20 typedef struct SpaprXive { XiveRouter parent; @@ -47,6 +51,12 @@ typedef struct SpaprXive { VMChangeStateEntry *change; } SpaprXive; =20 +typedef struct SpaprXiveClass { + XiveRouterClass parent; + + DeviceRealize parent_realize; +} SpaprXiveClass; + /* * The sPAPR machine has a unique XIVE IC device. Assign a fixed value * to the controller block id value. It can nevertheless be changed diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c index 57305c56d707..32322470a8b8 100644 --- a/hw/intc/spapr_xive.c +++ b/hw/intc/spapr_xive.c @@ -286,10 +286,17 @@ static void spapr_xive_instance_init(Object *obj) static void spapr_xive_realize(DeviceState *dev, Error **errp) { SpaprXive *xive =3D SPAPR_XIVE(dev); + SpaprXiveClass *sxc =3D SPAPR_XIVE_GET_CLASS(xive); XiveSource *xsrc =3D &xive->source; XiveENDSource *end_xsrc =3D &xive->end_source; Error *local_err =3D NULL; =20 + sxc->parent_realize(dev, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } + if (!xive->nr_irqs) { error_setg(errp, "Number of interrupt needs to be greater 0"); return; @@ -760,10 +767,12 @@ static void spapr_xive_class_init(ObjectClass *klass,= void *data) XiveRouterClass *xrc =3D XIVE_ROUTER_CLASS(klass); SpaprInterruptControllerClass *sicc =3D SPAPR_INTC_CLASS(klass); XivePresenterClass *xpc =3D XIVE_PRESENTER_CLASS(klass); + SpaprXiveClass *sxc =3D SPAPR_XIVE_CLASS(klass); =20 dc->desc =3D "sPAPR XIVE Interrupt Controller"; dc->props =3D spapr_xive_properties; - dc->realize =3D spapr_xive_realize; + device_class_set_parent_realize(dc, spapr_xive_realize, + &sxc->parent_realize); dc->vmsd =3D &vmstate_spapr_xive; =20 xrc->get_eas =3D spapr_xive_get_eas; @@ -794,6 +803,7 @@ static const TypeInfo spapr_xive_info =3D { .instance_init =3D spapr_xive_instance_init, .instance_size =3D sizeof(SpaprXive), .class_init =3D spapr_xive_class_init, + .class_size =3D sizeof(SpaprXiveClass), .interfaces =3D (InterfaceInfo[]) { { TYPE_SPAPR_INTC }, { } --=20 2.21.0 From nobody Fri May 3 09:44:18 2024 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=1576779819; cv=none; d=zohomail.com; s=zohoarc; b=S6mgPTFeboEe2Sb8VCtj8epwiDXKQFg4aiQIm/6khA2TeaapCOI6G4dKzX8UmnwyLnIv+defwTcYokJBXLr5U2AAJ4DEdM03aHBEul0Y+8mrL0PgPM2hlQo4+yZeATVpMIGUfvrJpzZWHUa19FRx+DZxQuJkYzN0OLQOs6sLGUA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576779819; 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=jF/XcCzYU8m2tcybP7YUuy3rSlUGXFmgCm3SXc5zjCM=; b=QSx/XfCqmxclAKavX8WDaRTTzrVLJUbqFw8zXTD+r2OLOFCtRp/ow4jISB/qJfbcojDvY4nRTPzBEnoFvurxL6gJAlDYGu8weGSjI89qBZ+fKBnFpp6nSnufK6N7uD47ozv4XBjg/qnkCQTWX+s6flJUx5dPu86GemKyHWLXtlk= 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 1576779819809747.1887000905406; Thu, 19 Dec 2019 10:23:39 -0800 (PST) Received: from localhost ([::1]:46346 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii0SY-00051P-6D for importer@patchew.org; Thu, 19 Dec 2019 13:23:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40739) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii0I0-0000bN-FQ for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:12:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ii0Hz-0004HZ-5a for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:12:44 -0500 Received: from 4.mo173.mail-out.ovh.net ([46.105.34.219]:54552) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ii0Hy-0004CE-Rl for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:12:43 -0500 Received: from player734.ha.ovh.net (unknown [10.108.54.97]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id 60CCE129E37 for ; Thu, 19 Dec 2019 19:12:41 +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 E93AFD6D6398; Thu, 19 Dec 2019 18:12:35 +0000 (UTC) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Subject: [PATCH v2 06/13] pnv/xive: Use device_class_set_parent_realize() Date: Thu, 19 Dec 2019 19:11:48 +0100 Message-Id: <20191219181155.32530-7-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: 13661950946887699430 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrvdduuddguddtkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgsehtkeertdertdejnecuhfhrohhmpeevrogurhhitgcunfgvucfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecukfhppedtrddtrddtrddtpdeltddrjeeirdehtddrvddvfeenucfrrghrrghmpehmohguvgepshhmthhpqdhouhhtpdhhvghlohepphhlrgihvghrjeefgedrhhgrrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopehqvghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgnecuvehluhhsthgvrhfuihiivgepud 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: 46.105.34.219 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 The XIVE router base class currently inherits an empty realize hook from the sysbus device base class, but it will soon implement one of its own to perform some sanity checks. Do the preliminary plumbing to have it called. Signed-off-by: Greg Kurz Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: David Gibson --- include/hw/ppc/pnv_xive.h | 10 ++++++++++ hw/intc/pnv_xive.c | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/hw/ppc/pnv_xive.h b/include/hw/ppc/pnv_xive.h index 4d641db691c8..ba9bbeab88c3 100644 --- a/include/hw/ppc/pnv_xive.h +++ b/include/hw/ppc/pnv_xive.h @@ -16,6 +16,10 @@ struct PnvChip; =20 #define TYPE_PNV_XIVE "pnv-xive" #define PNV_XIVE(obj) OBJECT_CHECK(PnvXive, (obj), TYPE_PNV_XIVE) +#define PNV_XIVE_CLASS(klass) \ + OBJECT_CLASS_CHECK(PnvXiveClass, (klass), TYPE_PNV_XIVE) +#define PNV_XIVE_GET_CLASS(obj) \ + OBJECT_GET_CLASS(PnvXiveClass, (obj), TYPE_PNV_XIVE) =20 #define XIVE_BLOCK_MAX 16 =20 @@ -87,6 +91,12 @@ typedef struct PnvXive { uint64_t edt[XIVE_TABLE_EDT_MAX]; } PnvXive; =20 +typedef struct PnvXiveClass { + XiveRouterClass parent_class; + + DeviceRealize parent_realize; +} PnvXiveClass; + void pnv_xive_pic_print_info(PnvXive *xive, Monitor *mon); =20 #endif /* PPC_PNV_XIVE_H */ diff --git a/hw/intc/pnv_xive.c b/hw/intc/pnv_xive.c index 66970a60733b..1962f884d6de 100644 --- a/hw/intc/pnv_xive.c +++ b/hw/intc/pnv_xive.c @@ -1816,10 +1816,17 @@ static void pnv_xive_init(Object *obj) static void pnv_xive_realize(DeviceState *dev, Error **errp) { PnvXive *xive =3D PNV_XIVE(dev); + PnvXiveClass *pxc =3D PNV_XIVE_GET_CLASS(dev); XiveSource *xsrc =3D &xive->ipi_source; XiveENDSource *end_xsrc =3D &xive->end_source; Error *local_err =3D NULL; =20 + pxc->parent_realize(dev, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } + assert(xive->chip); assert(xive->system_memory); =20 @@ -1950,10 +1957,12 @@ static void pnv_xive_class_init(ObjectClass *klass,= void *data) XiveRouterClass *xrc =3D XIVE_ROUTER_CLASS(klass); XiveNotifierClass *xnc =3D XIVE_NOTIFIER_CLASS(klass); XivePresenterClass *xpc =3D XIVE_PRESENTER_CLASS(klass); + PnvXiveClass *pxc =3D PNV_XIVE_CLASS(klass); =20 xdc->dt_xscom =3D pnv_xive_dt_xscom; =20 dc->desc =3D "PowerNV XIVE Interrupt Controller"; + device_class_set_parent_realize(dc, pnv_xive_realize, &pxc->parent_rea= lize); dc->realize =3D pnv_xive_realize; dc->props =3D pnv_xive_properties; =20 @@ -1974,6 +1983,7 @@ static const TypeInfo pnv_xive_info =3D { .instance_init =3D pnv_xive_init, .instance_size =3D sizeof(PnvXive), .class_init =3D pnv_xive_class_init, + .class_size =3D sizeof(PnvXiveClass), .interfaces =3D (InterfaceInfo[]) { { TYPE_PNV_XSCOM_INTERFACE }, { } --=20 2.21.0 From nobody Fri May 3 09:44:18 2024 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=1576779669; cv=none; d=zohomail.com; s=zohoarc; b=Sg1MezWvdkwAGv82bxkY927z0dx3wZyRzapufPFqHzD1ze3EWS6mFpWBrisXJ4V1togIElstz7YgqVhaBoDaFq/mh5uBS2SIIzpX4+FAjVUlTyq3OdYZeZmRicAh6JfINouzu8GBE/+qKdQMTlIXVvfxKdDsyN1DMTquA5ebHPk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576779669; 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=HZyTGdvv4nmdDMpoAWjddOzQEKp3XD762wsvfDwZK1o=; b=c/yZKuHZEWtWMmYaTnW/0IG8Nvh/L4fFMZiCpXIoVD5TCy0zaJh85mEhwPMqcwqPkV7R8DOTWvrG0cFgtgAe02E/wszuryUpWyCK25B/ZgFmiq7bwNxizAWP7o29dS6+CztXzT+gx0iujKdqwVBab62K+QI21LWtncH6u32iSNE= 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 1576779669117539.9348437175911; Thu, 19 Dec 2019 10:21:09 -0800 (PST) Received: from localhost ([::1]:46292 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii0Q7-00018r-N2 for importer@patchew.org; Thu, 19 Dec 2019 13:21:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41398) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii0I6-0000ml-CW for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:12:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ii0I4-0004mQ-Ue for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:12:50 -0500 Received: from 15.mo6.mail-out.ovh.net ([188.165.39.161]:56011) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ii0I4-0004dq-I8 for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:12:48 -0500 Received: from player734.ha.ovh.net (unknown [10.109.143.216]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id CC4441F5215 for ; Thu, 19 Dec 2019 19:12:46 +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 5596DD6D63A8; Thu, 19 Dec 2019 18:12:41 +0000 (UTC) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Subject: [PATCH v2 07/13] spapr, pnv, xive: Add a "xive-fabric" link to the XIVE router Date: Thu, 19 Dec 2019 19:11:49 +0100 Message-Id: <20191219181155.32530-8-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: 13663358321985883110 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrvdduuddguddtkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgsehtkeertdertdejnecuhfhrohhmpeevrogurhhitgcunfgvucfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecukfhppedtrddtrddtrddtpdeltddrjeeirdehtddrvddvfeenucfrrghrrghmpehmohguvgepshhmthhpqdhouhhtpdhhvghlohepphhlrgihvghrjeefgedrhhgrrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopehqvghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgnecuvehluhhsthgvrhfuihiivgepud 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: 188.165.39.161 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 2a1b15a69aed..915c80a24b3e 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -804,6 +804,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); @@ -1224,6 +1228,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 07e08d6544a0..2b656649ad6a 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -340,6 +340,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.0 From nobody Fri May 3 09:44:18 2024 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=1576779747; cv=none; d=zohomail.com; s=zohoarc; b=BLs4XISp56oMYLKMu5G6g5kh2GCvWfGOa6Gm1EBLh/X4mPfHEgT8FIPkzJeMEHVubhPcCjqmt9cCNBI5zPj7O069oDUFdjMyxcfbR0lD6j/65VQv/Qg50NSSiPUyaDjHZINDrqfUIk5eASSaDUxaJ0eN5rwzHZQAikOSKxJ8Z2U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576779747; 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=PMj/DM0Yh2utV1tACmnwolApM3Y+YyKR4KXlVV9Dwog=; b=hC5MfJL1Vl9Kewn3izAMPBmkJE9z7R/7pWxbbmQzj+Lc2zwPE/cUielfiNAWj6VCCjEymMmOmx0myfaglTuy1O/kOGMmesKi1bsOrfUlFFyHHhwXFxggBYwFEWrPHBX/PSq9fiNwvbVepikWQx1cf5gnPAcLosmE2dnLJd4FfYw= 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 1576779747105352.23610561982696; Thu, 19 Dec 2019 10:22:27 -0800 (PST) Received: from localhost ([::1]:46324 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii0RN-00034w-7n for importer@patchew.org; Thu, 19 Dec 2019 13:22:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42021) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii0IB-0000vM-LD for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:12:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ii0IA-0005EL-EI for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:12:55 -0500 Received: from 8.mo173.mail-out.ovh.net ([46.105.46.122]:55382) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ii0IA-00057M-6O for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:12:54 -0500 Received: from player734.ha.ovh.net (unknown [10.108.1.121]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id 989CD1225FF for ; Thu, 19 Dec 2019 19:12:52 +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 B8384D6D63C4; Thu, 19 Dec 2019 18:12:46 +0000 (UTC) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Subject: [PATCH v2 08/13] xive: Use the XIVE fabric link under the XIVE router Date: Thu, 19 Dec 2019 19:11:50 +0100 Message-Id: <20191219181155.32530-9-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: 13665047171326970854 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrvdduuddguddtkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgsehtkeertdertdejnecuhfhrohhmpeevrogurhhitgcunfgvucfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecukfhppedtrddtrddtrddtpdeltddrjeeirdehtddrvddvfeenucfrrghrrghmpehmohguvgepshhmthhpqdhouhhtpdhhvghlohepphhlrgihvghrjeefgedrhhgrrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopehqvghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgnecuvehluhhsthgvrhfuihiivgepfe 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: 46.105.46.122 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 Now that the spapr and pnv machines do set the "xive-fabric" link, the use of the XIVE fabric pointer becomes mandatory. This is checked with an assert() in a new realize hook. Since the XIVE router is realized at machine init for the all the machine's life time, no risk to abort an already running guest (ie. not a hotplug path). This gets rid of a qdev_get_machine() call. Signed-off-by: Greg Kurz Signed-off-by: C=C3=A9dric Le Goater --- hw/intc/xive.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/hw/intc/xive.c b/hw/intc/xive.c index 6df89b06da38..12a362b681a6 100644 --- a/hw/intc/xive.c +++ b/hw/intc/xive.c @@ -1378,6 +1378,13 @@ static int xive_router_get_block_id(XiveRouter *xrtr) return xrc->get_block_id(xrtr); } =20 +static void xive_router_realize(DeviceState *dev, Error **errp) +{ + XiveRouter *xrtr =3D XIVE_ROUTER(dev); + + assert(xrtr->xfb); +} + /* * Encode the HW CAM line in the block group mode format : * @@ -1470,12 +1477,11 @@ int xive_presenter_tctx_match(XivePresenter *xptr, = XiveTCTX *tctx, * * The parameters represent what is sent on the PowerBus */ -static bool xive_presenter_notify(uint8_t format, +static bool xive_presenter_notify(XiveFabric *xfb, uint8_t format, uint8_t nvt_blk, uint32_t nvt_idx, bool cam_ignore, uint8_t priority, uint32_t logic_serv) { - XiveFabric *xfb =3D XIVE_FABRIC(qdev_get_machine()); XiveFabricClass *xfc =3D XIVE_FABRIC_GET_CLASS(xfb); XiveTCTXMatch match =3D { .tctx =3D NULL, .ring =3D 0 }; int count; @@ -1607,7 +1613,7 @@ static void xive_router_end_notify(XiveRouter *xrtr, = uint8_t end_blk, return; } =20 - found =3D xive_presenter_notify(format, nvt_blk, nvt_idx, + found =3D xive_presenter_notify(xrtr->xfb, format, nvt_blk, nvt_idx, xive_get_field32(END_W7_F0_IGNORE, end.w7), priority, xive_get_field32(END_W7_F1_LOG_SERVER_ID, end.w7= )); @@ -1727,6 +1733,8 @@ static void xive_router_class_init(ObjectClass *klass= , void *data) =20 dc->desc =3D "XIVE Router Engine"; dc->props =3D xive_router_properties; + /* Parent is SysBusDeviceClass. No need to call its realize hook */ + dc->realize =3D xive_router_realize; xnc->notify =3D xive_router_notify; } =20 --=20 2.21.0 From nobody Fri May 3 09:44:18 2024 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=1576779931; cv=none; d=zohomail.com; s=zohoarc; b=aqa3ryGMmXojMaO+L1jd9dRWmcjmV21iI+y5TK24/8XuzEaxpzmA7BlGD6auHKKpqMxgW/3i4JQngYbegEa32GFoBvlHHjPFKcyXgvzkFznnBrJRZsDrXdZXRyZJLoTLgoNM1CN6FBFHI6goXCN4XBvjjfkHI8Mp+jcvoLBPbvM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576779931; 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=LSC+59zSfl24L2pVENCwzBKztE9ppE4G3pbPBw0Cw+U=; b=JcdUu62mD+TEChnh9ADEfKZt48gQJ8ePbUjDlH8rBW/8LI4wx/XDnsZgikreVQCp/kZgypEAArFb+oT+3JSEWjZcJm5XY0FrFQcJPTjIlVIZmYYcnPJTcp8PrwRdHtePH7kcekteyR5hD7EIsBpdxmEP/AeKoGYhsmSKneerlHg= 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 1576779931789989.0572975165867; Thu, 19 Dec 2019 10:25:31 -0800 (PST) Received: from localhost ([::1]:46378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii0UM-0007de-3I for importer@patchew.org; Thu, 19 Dec 2019 13:25:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42672) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii0IH-00014K-B1 for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:13:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ii0IG-0005gC-23 for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:13:01 -0500 Received: from 8.mo179.mail-out.ovh.net ([46.105.75.26]:49340) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ii0IF-0005Xi-Rr for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:12:59 -0500 Received: from player734.ha.ovh.net (unknown [10.108.54.203]) by mo179.mail-out.ovh.net (Postfix) with ESMTP id 2277A153174 for ; Thu, 19 Dec 2019 19:12:58 +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 9BB14D6D63E3; Thu, 19 Dec 2019 18:12:52 +0000 (UTC) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Subject: [PATCH v2 09/13] ppc/pnv: Add an "nr-threads" property to the base chip class Date: Thu, 19 Dec 2019 19:11:51 +0100 Message-Id: <20191219181155.32530-10-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: 13666736021224262630 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrvdduuddguddtlecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgsehtkeertdertdejnecuhfhrohhmpeevrogurhhitgcunfgvucfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecukfhppedtrddtrddtrddtpdeltddrjeeirdehtddrvddvfeenucfrrghrrghmpehmohguvgepshhmthhpqdhouhhtpdhhvghlohepphhlrgihvghrjeefgedrhhgrrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopehqvghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgnecuvehluhhsthgvrhfuihiivgepvd 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: 46.105.75.26 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 Set it at chip creation and forward it to the cores. This allows to drop a call to qdev_get_machine(). Signed-off-by: Greg Kurz Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: David Gibson --- include/hw/ppc/pnv.h | 1 + hw/ppc/pnv.c | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h index 8b957dfb5736..4c13d4394a11 100644 --- a/include/hw/ppc/pnv.h +++ b/include/hw/ppc/pnv.h @@ -48,6 +48,7 @@ typedef struct PnvChip { uint64_t ram_size; =20 uint32_t nr_cores; + uint32_t nr_threads; uint64_t cores_mask; PnvCore **cores; =20 diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 915c80a24b3e..e638cdc93091 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -791,6 +791,8 @@ static void pnv_init(MachineState *machine) &error_fatal); object_property_set_int(chip, machine->smp.cores, "nr-cores", &error_fatal); + object_property_set_int(chip, machine->smp.threads, + "nr-threads", &error_fatal); /* * TODO: Only the MMIO range should be of interest for the * controllers @@ -1529,7 +1531,6 @@ static void pnv_chip_core_sanitize(PnvChip *chip, Err= or **errp) =20 static void pnv_chip_core_realize(PnvChip *chip, Error **errp) { - MachineState *ms =3D MACHINE(qdev_get_machine()); Error *error =3D NULL; PnvChipClass *pcc =3D PNV_CHIP_GET_CLASS(chip); const char *typename =3D pnv_chip_core_typename(chip); @@ -1565,8 +1566,8 @@ static void pnv_chip_core_realize(PnvChip *chip, Erro= r **errp) object_property_add_child(OBJECT(chip), core_name, OBJECT(pnv_core= ), &error_abort); chip->cores[i] =3D pnv_core; - object_property_set_int(OBJECT(pnv_core), ms->smp.threads, "nr-thr= eads", - &error_fatal); + object_property_set_int(OBJECT(pnv_core), chip->nr_threads, + "nr-threads", &error_fatal); object_property_set_int(OBJECT(pnv_core), core_hwid, CPU_CORE_PROP_CORE_ID, &error_fatal); object_property_set_int(OBJECT(pnv_core), @@ -1609,6 +1610,7 @@ static Property pnv_chip_properties[] =3D { DEFINE_PROP_UINT64("cores-mask", PnvChip, cores_mask, 0x0), DEFINE_PROP_LINK("system-memory", PnvChip, system_memory, TYPE_MEMORY_REGION, MemoryRegion *), + DEFINE_PROP_UINT32("nr-threads", PnvChip, nr_threads, 1), DEFINE_PROP_END_OF_LIST(), }; =20 --=20 2.21.0 From nobody Fri May 3 09:44:18 2024 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=1576779797; cv=none; d=zohomail.com; s=zohoarc; b=B1eGs/NtsNh8gOlvOXqJq/wc0AQ5VUHRuAvGppUsxgqT539twGm5BbyPz6S7+0ZxQ8oZYuKPXxkjsElE5OvVgpA/kQGNB8IbuYFpcbvzqOE8hlhThVPnHFOnBzPZ+DgdpWEP8V9A6ghccl++4fmjYkW5mVr3/URLLfdGHqPtRhg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576779797; 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=3EPHGY8KtV+iQwYyWyhRypQiOT0UHg24K9kN5mPrINo=; b=jngRnScZKdSlXaK6wSimDkVdScsGJ+iRlLRHBq6njs+2P+d4JzhRbUsGAMxU78Ytm4zm9ykC4uzNXFn9FGMVlA9occ70EQWhe4CyqluHjvGHiqdxmmUj80BS4xEHF4htBj6AoyhixU2LoHlrjjjJ8R1OFf/ufwERj8Aa6uQrgtk= 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 1576779797204610.6022229762148; Thu, 19 Dec 2019 10:23:17 -0800 (PST) Received: from localhost ([::1]:46330 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii0SB-0004QU-QU for importer@patchew.org; Thu, 19 Dec 2019 13:23:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43285) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii0IN-0001DM-H7 for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:13:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ii0IL-000667-6C for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:13:07 -0500 Received: from 10.mo177.mail-out.ovh.net ([46.105.73.133]:43930) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ii0IK-0005ye-U6 for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:13:05 -0500 Received: from player734.ha.ovh.net (unknown [10.108.1.15]) by mo177.mail-out.ovh.net (Postfix) with ESMTP id 7BE6211B861 for ; Thu, 19 Dec 2019 19:13:03 +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 18CC7D6D63F9; Thu, 19 Dec 2019 18:12:58 +0000 (UTC) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Subject: [PATCH v2 10/13] ppc/pnv: Add a "pnor" const link property to the BMC internal simulator Date: Thu, 19 Dec 2019 19:11:52 +0100 Message-Id: <20191219181155.32530-11-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: 13668143398012816358 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrvdduuddguddtkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgsehtkeertdertdejnecuhfhrohhmpeevrogurhhitgcunfgvucfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecukfhppedtrddtrddtrddtpdeltddrjeeirdehtddrvddvfeenucfrrghrrghmpehmohguvgepshhmthhpqdhouhhtpdhhvghlohepphhlrgihvghrjeefgedrhhgrrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopehqvghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgnecuvehluhhsthgvrhfuihiivgephe 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: 46.105.73.133 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 This allows to get rid of a call to qdev_get_machine(). Signed-off-by: Greg Kurz Signed-off-by: C=C3=A9dric Le Goater --- include/hw/ppc/pnv.h | 2 +- hw/ppc/pnv.c | 2 +- hw/ppc/pnv_bmc.c | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h index 4c13d4394a11..d016ab0d0319 100644 --- a/include/hw/ppc/pnv.h +++ b/include/hw/ppc/pnv.h @@ -231,7 +231,7 @@ PnvChip *pnv_get_chip(uint32_t chip_id); */ void pnv_dt_bmc_sensors(IPMIBmc *bmc, void *fdt); void pnv_bmc_powerdown(IPMIBmc *bmc); -IPMIBmc *pnv_bmc_create(void); +IPMIBmc *pnv_bmc_create(PnvPnor *pnor); =20 /* * POWER8 MMIO base addresses diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index e638cdc93091..34549aefa2fc 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -815,7 +815,7 @@ static void pnv_init(MachineState *machine) g_free(chip_typename); =20 /* Create the machine BMC simulator */ - pnv->bmc =3D pnv_bmc_create(); + pnv->bmc =3D pnv_bmc_create(pnv->pnor); =20 /* Instantiate ISA bus on chip 0 */ pnv->isa_bus =3D pnv_isa_create(pnv->chips[0], &error_fatal); diff --git a/hw/ppc/pnv_bmc.c b/hw/ppc/pnv_bmc.c index 07fa1e1c7e45..8863354c1c08 100644 --- a/hw/ppc/pnv_bmc.c +++ b/hw/ppc/pnv_bmc.c @@ -143,8 +143,8 @@ static uint16_t bytes_to_blocks(uint32_t bytes) static void hiomap_cmd(IPMIBmcSim *ibs, uint8_t *cmd, unsigned int cmd_len, RspBuffer *rsp) { - PnvMachineState *pnv =3D PNV_MACHINE(qdev_get_machine()); - PnvPnor *pnor =3D pnv->pnor; + PnvPnor *pnor =3D PNV_PNOR(object_property_get_link(OBJECT(ibs), "pnor= ", + &error_abort)); uint32_t pnor_size =3D pnor->size; uint32_t pnor_addr =3D PNOR_SPI_OFFSET; bool readonly =3D false; @@ -217,11 +217,13 @@ static const IPMINetfn hiomap_netfn =3D { * Instantiate the machine BMC. PowerNV uses the QEMU internal * simulator but it could also be external. */ -IPMIBmc *pnv_bmc_create(void) +IPMIBmc *pnv_bmc_create(PnvPnor *pnor) { Object *obj; =20 obj =3D object_new(TYPE_IPMI_BMC_SIMULATOR); + object_ref(OBJECT(pnor)); + object_property_add_const_link(obj, "pnor", OBJECT(pnor), &error_abort= ); object_property_set_bool(obj, true, "realized", &error_fatal); =20 /* Install the HIOMAP protocol handlers to access the PNOR */ --=20 2.21.0 From nobody Fri May 3 09:44:18 2024 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 From nobody Fri May 3 09:44:18 2024 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=1576779433; cv=none; d=zohomail.com; s=zohoarc; b=QgwzBvoLgGdu/V/248V5NOzUT+V2xdMSvm1idBj6tQQatnmh9VMl6danaXd9OMWIAm9RJP8AFxJdRQlMRPmfjdIDQUQDTPW++uh4WCRN/su71wjaYaLfcxLN0K0rWzKVaeTwlOmrl3zHRFNuGSedkks9j51TDrsr14/0zJayyTg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576779433; 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=TzGJKnTzqiyctacfr8v8Vcctj/lMk/R1hQPiMNevdps=; b=D2sRmxgUW4VRyEvMBFpNMjfYY1zM7iBZ/kbE7GItmDjjH8NdzYClWwmRBqpzI1LgLWaK/tsMvQe13rQ/Z4xGYsGkaQaO3KjeoM614mKmVbev8ctl93465loxNBU8Icbr37ijdyjINeIo3uVI2orSIfiGZ2llFS/c3WZ1KDrEdJE= 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 1576779433696840.0396830359886; Thu, 19 Dec 2019 10:17:13 -0800 (PST) Received: from localhost ([::1]:46251 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii0MJ-0005Lz-Tf for importer@patchew.org; Thu, 19 Dec 2019 13:17:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44446) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii0IY-0001Sx-CO for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:13:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ii0IX-00072G-27 for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:13:18 -0500 Received: from 7.mo173.mail-out.ovh.net ([46.105.44.159]:41536) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ii0IW-0006t0-Pb for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:13:16 -0500 Received: from player734.ha.ovh.net (unknown [10.108.57.95]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id C6EADB0D78 for ; Thu, 19 Dec 2019 19:13:14 +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 DD5A4D6D6417; Thu, 19 Dec 2019 18:13:08 +0000 (UTC) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Subject: [PATCH v2 12/13] spapr/xive: Deduce the SpaprXive pointer from XiveTCTX::xptr Date: Thu, 19 Dec 2019 19:11:54 +0100 Message-Id: <20191219181155.32530-13-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: 13671239620888988646 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: 46.105.44.159 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 And use it instead of reaching out to the machine. This allows to get rid of a call to qdev_get_machine() and to reduce the scope of another one so that it is only used within the argument list of error_append_hint(). This is an acceptable tradeoff compared to all it would require to know about the maximum number of CPUs here without calling qdev_get_machine(). Signed-off-by: Greg Kurz Signed-off-by: C=C3=A9dric Le Goater --- hw/intc/spapr_xive_kvm.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/intc/spapr_xive_kvm.c b/hw/intc/spapr_xive_kvm.c index 32b2809210a0..edb7ee0e74f1 100644 --- a/hw/intc/spapr_xive_kvm.c +++ b/hw/intc/spapr_xive_kvm.c @@ -75,7 +75,7 @@ static void kvm_cpu_disable_all(void) =20 void kvmppc_xive_cpu_set_state(XiveTCTX *tctx, Error **errp) { - SpaprXive *xive =3D SPAPR_MACHINE(qdev_get_machine())->xive; + SpaprXive *xive =3D SPAPR_XIVE(tctx->xptr); uint64_t state[2]; int ret; =20 @@ -97,7 +97,7 @@ void kvmppc_xive_cpu_set_state(XiveTCTX *tctx, Error **er= rp) =20 void kvmppc_xive_cpu_get_state(XiveTCTX *tctx, Error **errp) { - SpaprXive *xive =3D SPAPR_MACHINE(qdev_get_machine())->xive; + SpaprXive *xive =3D SPAPR_XIVE(tctx->xptr); uint64_t state[2] =3D { 0 }; int ret; =20 @@ -152,8 +152,7 @@ void kvmppc_xive_cpu_synchronize_state(XiveTCTX *tctx, = Error **errp) =20 void kvmppc_xive_cpu_connect(XiveTCTX *tctx, Error **errp) { - MachineState *ms =3D MACHINE(qdev_get_machine()); - SpaprXive *xive =3D SPAPR_MACHINE(ms)->xive; + SpaprXive *xive =3D SPAPR_XIVE(tctx->xptr); unsigned long vcpu_id; int ret; =20 @@ -179,7 +178,7 @@ void kvmppc_xive_cpu_connect(XiveTCTX *tctx, Error **er= rp) vcpu_id, strerror(errno)); if (errno =3D=3D ENOSPC) { error_append_hint(&local_err, "Try -smp maxcpus=3DN with N < %= u\n", - ms->smp.max_cpus); + MACHINE(qdev_get_machine())->smp.max_cpus); } error_propagate(errp, local_err); return; --=20 2.21.0 From nobody Fri May 3 09:44:18 2024 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=1576779865; cv=none; d=zohomail.com; s=zohoarc; b=VNhMnkTY0/GgM5epVSxglb1bGRxUWHZB3oJVLPl2wdXkJTALIEnW304pJse8SNVRLlSxS1/pc2JsdIYctAQnpzbAB0ENmNPlqmJr+8G2X0xyBVQqZC0X1cOLviVpx+vHmbDCl/Debh4MwD9v67hxQ+IpWMME+t+w6KFiHhEQX14= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576779865; 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=MBsrAee2mA4CAIfIETfQyu6crpSfu0MmEF6SjCN8xGI=; b=TRQlu/xhelq2WmXQYnKaQGg11MwnmDoHs8mPE9CmGAcDPuvs1Pe7ZInbqgariZdehwyoj1GqPjDYIYVR1s1694kIHca6Miz8KYcLIJUEcedpmRRRUj1a26uHDJ/yvCSGpcsS2+DjHp1o0Xff52wtS+PTyfOjKG6BkuOpd7Qoni0= 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 1576779865700750.1685436671908; Thu, 19 Dec 2019 10:24:25 -0800 (PST) Received: from localhost ([::1]:46356 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii0TI-0006Lz-Ja for importer@patchew.org; Thu, 19 Dec 2019 13:24:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44941) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ii0Id-0001aK-36 for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:13:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ii0Ib-0007Si-S2 for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:13:22 -0500 Received: from 14.mo6.mail-out.ovh.net ([46.105.56.113]:48771) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ii0Ib-0007L4-Ki for qemu-devel@nongnu.org; Thu, 19 Dec 2019 13:13:21 -0500 Received: from player734.ha.ovh.net (unknown [10.108.16.7]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id 31AD11F5A7B for ; Thu, 19 Dec 2019 19:13:20 +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 BC265D6D642F; Thu, 19 Dec 2019 18:13:14 +0000 (UTC) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Subject: [PATCH v2 13/13] pnv/xive: Deduce the PnvXive pointer from XiveTCTX::xptr Date: Thu, 19 Dec 2019 19:11:55 +0100 Message-Id: <20191219181155.32530-14-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: 13672928469033454566 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrvdduuddguddtkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofgjfhggtgfgsehtkeertdertdejnecuhfhrohhmpeevrogurhhitgcunfgvucfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecukfhppedtrddtrddtrddtpdeltddrjeeirdehtddrvddvfeenucfrrghrrghmpehmohguvgepshhmthhpqdhouhhtpdhhvghlohepphhlrgihvghrjeefgedrhhgrrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopehqvghmuhdquggvvhgvlhesnhhonhhgnhhurdhorhhgnecuvehluhhsthgvrhfuihiivgepvd 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: 46.105.56.113 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 And use it instead of reaching out to the machine. This allows to get rid of pnv_get_chip(). Signed-off-by: Greg Kurz Signed-off-by: C=C3=A9dric Le Goater --- include/hw/ppc/pnv.h | 2 -- hw/intc/pnv_xive.c | 8 ++------ hw/ppc/pnv.c | 14 -------------- 3 files changed, 2 insertions(+), 22 deletions(-) diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h index d016ab0d0319..5f0b7d3374ef 100644 --- a/include/hw/ppc/pnv.h +++ b/include/hw/ppc/pnv.h @@ -221,8 +221,6 @@ struct PnvMachineState { PnvPnor *pnor; }; =20 -PnvChip *pnv_get_chip(uint32_t chip_id); - #define PNV_FDT_ADDR 0x01000000 #define PNV_TIMEBASE_FREQ 512000000ULL =20 diff --git a/hw/intc/pnv_xive.c b/hw/intc/pnv_xive.c index 1962f884d6de..79a5dfe9a858 100644 --- a/hw/intc/pnv_xive.c +++ b/hw/intc/pnv_xive.c @@ -472,12 +472,8 @@ static uint8_t pnv_xive_get_block_id(XiveRouter *xrtr) static PnvXive *pnv_xive_tm_get_xive(PowerPCCPU *cpu) { int pir =3D ppc_cpu_pir(cpu); - PnvChip *chip; - PnvXive *xive; - - chip =3D pnv_get_chip(PNV9_PIR2CHIP(pir)); - assert(chip); - xive =3D &PNV9_CHIP(chip)->xive; + XivePresenter *xptr =3D XIVE_TCTX(pnv_cpu_state(cpu)->intc)->xptr; + PnvXive *xive =3D PNV_XIVE(xptr); =20 if (!pnv_xive_is_cpu_enabled(xive, cpu)) { xive_error(xive, "IC: CPU %x is not enabled", pir); diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index d100b6f559e2..e1c218dc03f5 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -1724,20 +1724,6 @@ static int pnv_match_nvt(XiveFabric *xfb, uint8_t fo= rmat, return total_count; } =20 -PnvChip *pnv_get_chip(uint32_t chip_id) -{ - PnvMachineState *pnv =3D PNV_MACHINE(qdev_get_machine()); - int i; - - for (i =3D 0; i < pnv->num_chips; i++) { - PnvChip *chip =3D pnv->chips[i]; - if (chip->chip_id =3D=3D chip_id) { - return chip; - } - } - return NULL; -} - static void pnv_get_num_chips(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { --=20 2.21.0