From nobody Sun Feb 8 05:08:43 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=1655135464; cv=none; d=zohomail.com; s=zohoarc; b=DTPYtN+6jNYqOrTFwHOg96C8l7ycTsXzJAMSpWAqHaCqN07zADL9zQWr/YBSMUwDFUX9KRnPsLxyyEJ39gm/pxg8x/BnwGPf9sxp8wbyhIZPsMeUBciWKs2Rv1qEk8hhFc+W+Fh/fhp/Ky1I1AjV6N7emfpIiVgWxl6D/Yl19lI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655135464; 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=rJ1Xj+u91klfzwk81u+sl62M3REjlt32KHhnC7cYm/w=; b=LUixs3zMd5dv2EZv7FtUnT8fuXRZWemknLeoXYtvT9jdrQWvZm5IZ5kXzKz34dVlLKT/BBt//5LTYBvZoRDKMv9K4tHqoIhICZPN7Wtx9zYsKS3X4BeLt059t9xW7hDAopcdR0XkW142Xs8lNCMeyBwEcEBFNTbozbYvPJ0uhv0= 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 1655135464300733.3958129454709; Mon, 13 Jun 2022 08:51:04 -0700 (PDT) Received: from localhost ([::1]:45212 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o0mLH-0000MY-7w for importer@patchew.org; Mon, 13 Jun 2022 11:51:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37130) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o0mFr-0000Nc-VB; Mon, 13 Jun 2022 11:45:28 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:40986) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o0mFp-00025t-Uo; Mon, 13 Jun 2022 11:45:27 -0400 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25DEAU6v013537; Mon, 13 Jun 2022 15:45:19 GMT Received: from ppma01wdc.us.ibm.com (fd.55.37a9.ip4.static.sl-reverse.com [169.55.85.253]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3gn53quacq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jun 2022 15:45:18 +0000 Received: from pps.filterd (ppma01wdc.us.ibm.com [127.0.0.1]) by ppma01wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 25DFN7uV032594; Mon, 13 Jun 2022 15:45:13 GMT Received: from b01cxnp22035.gho.pok.ibm.com (b01cxnp22035.gho.pok.ibm.com [9.57.198.25]) by ppma01wdc.us.ibm.com with ESMTP id 3gmjp8pem1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jun 2022 15:45:13 +0000 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 25DFjDBu40108456 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jun 2022 15:45:13 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 68F6CAC05B; Mon, 13 Jun 2022 15:45:13 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 26041AC05F; Mon, 13 Jun 2022 15:45:12 +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:11 +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=rJ1Xj+u91klfzwk81u+sl62M3REjlt32KHhnC7cYm/w=; b=PgSQc8Ofy2Et+7WFTmA+GaY5ZOofu2bLJ0NUzZMCcCXIbfoJEGk/ff5IRc3Mcm9SktZq oKDqdsLAtnHgnjTtWkPFoSSVFKcIlAzeyEeFJozN+08MHfrbzVt22937sTsnXYN1/l68 kfS5HGPhWxfhAdj5/JzmQGeuiOEd+uwaLZZ3NYqEUNmp3fExkZHd5oBQ2rB1K3lGVxg6 kjP8gON0as9PWEGtaiesQdRv9J6Co52abkltivkTsMiQF/ooAKUHnbifmwG9RRvkdULN 2/UwNTkFNGskXmOrxW52n+waSI8y0/Y1e/nor2ob/a019dIPWmMFwA1pf4wd1ehfXIgS 4g== 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 08/11] ppc/pnv: turn chip8->phbs[] into a PnvPHB3* array Date: Mon, 13 Jun 2022 12:44:53 -0300 Message-Id: <20220613154456.359674-9-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: UiYQIxe_w9KI5XS0NpvNcqPObaIVgMi_ X-Proofpoint-ORIG-GUID: UiYQIxe_w9KI5XS0NpvNcqPObaIVgMi_ 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_06,2022-06-13_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 priorityscore=1501 phishscore=0 mlxscore=0 adultscore=0 mlxlogscore=798 lowpriorityscore=0 suspectscore=0 malwarescore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206130068 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.158.5; envelope-from=danielhb@linux.ibm.com; helo=mx0b-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: 1655135464983100001 Content-Type: text/plain; charset="utf-8" When enabling user created PHBs (a change reverted by commit 9c10d86fee) we were handling PHBs created by default versus by the user in different manners. The only difference between these PHBs is that one will have a valid phb3->chip that is assigned during pnv_chip_power8_realize(), while the user created needs to search which chip it belongs to. Aside from that there shouldn't be any difference. Making the default PHBs behave in line with the user created ones will make it easier to re-introduce them later on. It will also make the code easier to follow since we are dealing with them in equal manner. The first step is to turn chip8->phbs[] into a PnvPHB3 pointer array. This will allow us to assign user created PHBs into it later on. The way we initilize the default case is now more in line with that would happen with the user created case: the object is created, parented by the chip because pnv_xscom_dt() relies on it, and then assigned to the array. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Frederic Barrat --- hw/ppc/pnv.c | 19 ++++++++++++++----- include/hw/ppc/pnv.h | 6 +++++- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 5e3323e950..6ce9e94e05 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -660,7 +660,7 @@ static void pnv_chip_power8_pic_print_info(PnvChip *chi= p, Monitor *mon) ics_pic_print_info(&chip8->psi.ics, mon); =20 for (i =3D 0; i < chip8->num_phbs; i++) { - PnvPHB3 *phb3 =3D &chip8->phbs[i]; + PnvPHB3 *phb3 =3D chip8->phbs[i]; =20 pnv_phb3_msi_pic_print_info(&phb3->msis, mon); ics_pic_print_info(&phb3->lsis, mon); @@ -1149,7 +1149,16 @@ static void pnv_chip_power8_instance_init(Object *ob= j) chip8->num_phbs =3D pcc->num_phbs; =20 for (i =3D 0; i < chip8->num_phbs; i++) { - object_initialize_child(obj, "phb[*]", &chip8->phbs[i], TYPE_PNV_P= HB3); + PnvPHB3 *phb3 =3D PNV_PHB3(object_new(TYPE_PNV_PHB3)); + + /* + * We need the chip to parent the PHB to allow the DT + * to build correctly (via pnv_xscom_dt()). + * + * TODO: the PHB should be parented by a PEC device. + */ + object_property_add_child(obj, "phb[*]", OBJECT(phb3)); + chip8->phbs[i] =3D phb3; } =20 } @@ -1278,7 +1287,7 @@ static void pnv_chip_power8_realize(DeviceState *dev,= Error **errp) =20 /* PHB3 controllers */ for (i =3D 0; i < chip8->num_phbs; i++) { - PnvPHB3 *phb =3D &chip8->phbs[i]; + PnvPHB3 *phb =3D chip8->phbs[i]; =20 object_property_set_int(OBJECT(phb), "index", i, &error_fatal); object_property_set_int(OBJECT(phb), "chip-id", chip->chip_id, @@ -1963,7 +1972,7 @@ static ICSState *pnv_ics_get(XICSFabric *xi, int irq) } =20 for (j =3D 0; j < chip8->num_phbs; j++) { - pnv_ics_get_phb_ics(&chip8->phbs[j], &args); + pnv_ics_get_phb_ics(chip8->phbs[j], &args); =20 if (args.ics) { return args.ics; @@ -1996,7 +2005,7 @@ static void pnv_ics_resend(XICSFabric *xi) Pnv8Chip *chip8 =3D PNV8_CHIP(pnv->chips[i]); =20 for (j =3D 0; j < chip8->num_phbs; j++) { - PnvPHB3 *phb3 =3D &chip8->phbs[j]; + PnvPHB3 *phb3 =3D chip8->phbs[j]; =20 ics_resend(&phb3->lsis); ics_resend(ICS(&phb3->msis)); diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h index 033890a23f..11f1089289 100644 --- a/include/hw/ppc/pnv.h +++ b/include/hw/ppc/pnv.h @@ -80,7 +80,11 @@ struct Pnv8Chip { PnvHomer homer; =20 #define PNV8_CHIP_PHB3_MAX 4 - PnvPHB3 phbs[PNV8_CHIP_PHB3_MAX]; + /* + * The array is used to allow quick access to the phbs by + * pnv_ics_get_child() and pnv_ics_resend_child(). + */ + PnvPHB3 *phbs[PNV8_CHIP_PHB3_MAX]; uint32_t num_phbs; =20 XICSFabric *xics; --=20 2.36.1