From nobody Sun Feb 8 08:43:17 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1655135615; cv=none; d=zohomail.com; s=zohoarc; b=NV45Tb4Kh59aQTLFqbmGLMoBulNmafs6aIwQohlnwPJc/DpDFTRuzgssazaw3NNJ+6GlXXGEPafo9GoupH5SX/XSb/29A+fU6vVFRE3XGrE/8VAwLJcsvLA0raoeMRXDu+QqwDJIon054ZugBt7bNNR7lOTsna3fQv3AjPxYQ8Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655135615; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Hk2cC9spW/5bg0NOvft8zwKGimRakNd5Zse7WvHonxw=; b=f3LHrVPetEIntpMUXiiZkRyuI6SgT4Z9jsav6SF/3+aqh5wbn/KheQ7Nk+g1qthNbYY19ZpSSjMgNR1AHlwnH1/6u/PIzm1S6g65aq2EX4vPU99GrIU75asDRj7gd+lAxOW8IPrbtPKzqcqorTKFzuhPn+OREicTeoemB8iPE6Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1655135615845916.5793650823555; Mon, 13 Jun 2022 08:53:35 -0700 (PDT) Received: from localhost ([::1]:52182 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o0mNi-00058Z-Dx for importer@patchew.org; Mon, 13 Jun 2022 11:53:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37180) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o0mFt-0000Rd-Qt; Mon, 13 Jun 2022 11:45:30 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:3282) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o0mFs-000261-18; Mon, 13 Jun 2022 11:45:29 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25DFecc1032320; Mon, 13 Jun 2022 15:45:17 GMT Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3gp6p0j50s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jun 2022 15:45:17 +0000 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 25DFhYqa016459; Mon, 13 Jun 2022 15:45:16 GMT Received: from b01cxnp23034.gho.pok.ibm.com (b01cxnp23034.gho.pok.ibm.com [9.57.198.29]) by ppma04dal.us.ibm.com with ESMTP id 3gmjp9t01y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jun 2022 15:45:16 +0000 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 25DFjFjx23003468 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jun 2022 15:45:15 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B4778AC05F; Mon, 13 Jun 2022 15:45:15 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E4A90AC05B; Mon, 13 Jun 2022 15:45:13 +0000 (GMT) Received: from balboa.COMFAST (unknown [9.77.153.150]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 13 Jun 2022 15:45:13 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=Hk2cC9spW/5bg0NOvft8zwKGimRakNd5Zse7WvHonxw=; b=dN7yciNeQYhTp7nGRG37yPDMf1owmHteMaeUr4+mB4+mrhLdIJe6kw3op8XjFmy6o9MG z/Pc5frausZ1b6MkbftoI5yRj2l8U5AGZNS0w6RpzdKKCoiOODBX0n2PImZQL2VzhZbE dhcRA03awc87Ig9Vkc74D1Dh9Jy1zKFZQOhGnHsoiL2CHFwnZPNRDtCCpVoQgIzaHsBZ i1gYu9m71g653ZRs5A/Pk2BJQZVMaRdxOjqomizv/rPf3zu6F3HW/kwKsUCvRXwp2GoU IoUNwrW3xAomj3T7B7qZJ4OTW9NJtDtw+2yRGhtAFiq0MFFIau/jE9+QSWStF94fsuJP Wg== From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, clg@kaod.org, fbarrat@linux.ibm.com, mark.cave-ayland@ilande.co.uk Subject: [PATCH 09/11] ppc/pnv: add PHB object/bus parenting helpers Date: Mon, 13 Jun 2022 12:44:54 -0300 Message-Id: <20220613154456.359674-10-danielhb@linux.ibm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613154456.359674-1-danielhb@linux.ibm.com> References: <20220613154456.359674-1-danielhb@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: HIIch9xzCsbtAYlJ-gF7n2x-MHJ5dS9f X-Proofpoint-ORIG-GUID: HIIch9xzCsbtAYlJ-gF7n2x-MHJ5dS9f X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.874,Hydra:6.0.517,FMLib:17.11.64.514 definitions=2022-06-13_07,2022-06-13_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 phishscore=0 clxscore=1015 mlxscore=0 lowpriorityscore=0 malwarescore=0 impostorscore=0 spamscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206130069 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; Received-SPF: pass client-ip=148.163.156.1; envelope-from=danielhb@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1655135618223100001 Content-Type: text/plain; charset="utf-8" These helpers are inspired by the changes that were reverted in commit 9c10d86fee "ppc/pnv: Remove user-created PHB{3,4,5} devices". We'll use them to handle the default case we already support. Signed-off-by: Daniel Henrique Barboza --- hw/ppc/pnv.c | 31 +++++++++++++++++++++++++++++++ include/hw/ppc/pnv.h | 2 ++ 2 files changed, 33 insertions(+) diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 6ce9e94e05..d77c90d64a 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -1983,6 +1983,37 @@ static ICSState *pnv_ics_get(XICSFabric *xi, int irq) return NULL; } =20 + +/* + * Set the QOM parent of an object child. If the device state + * associated with the child has an id, use it as QOM id. Otherwise + * use object_typename[index] as QOM id. + */ +void pnv_parent_qom_fixup(Object *parent, Object *child, int index) +{ + g_autofree char *default_id =3D + g_strdup_printf("%s[%d]", object_get_typename(child), index); + const char *dev_id =3D DEVICE(child)->id; + + if (child->parent =3D=3D parent) { + return; + } + + object_ref(child); + object_unparent(child); + object_property_add_child(parent, dev_id ? dev_id : default_id, child); + object_unref(child); +} + +void pnv_parent_bus_fixup(DeviceState *parent, DeviceState *phb_dev) +{ + BusState *s =3D qdev_get_parent_bus(parent); + + if (!qdev_set_parent_bus(phb_dev, s, &error_fatal)) { + return; + } +} + PnvChip *pnv_get_chip(PnvMachineState *pnv, uint32_t chip_id) { int i; diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h index 11f1089289..c091f23039 100644 --- a/include/hw/ppc/pnv.h +++ b/include/hw/ppc/pnv.h @@ -194,6 +194,8 @@ DECLARE_INSTANCE_CHECKER(PnvChip, PNV_CHIP_POWER10, =20 PowerPCCPU *pnv_chip_find_cpu(PnvChip *chip, uint32_t pir); void pnv_phb_attach_root_port(PCIHostState *pci, const char *name, int ind= ex); +void pnv_parent_qom_fixup(Object *parent, Object *child, int index); +void pnv_parent_bus_fixup(DeviceState *parent, DeviceState *child); =20 #define TYPE_PNV_MACHINE MACHINE_TYPE_NAME("powernv") typedef struct PnvMachineClass PnvMachineClass; --=20 2.36.1