From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B4AFDC00140 for ; Wed, 10 Aug 2022 14:25:35 +0000 (UTC) Received: from localhost ([::1]:40408 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oLmeM-0000yy-Nb for qemu-devel@archiver.kernel.org; Wed, 10 Aug 2022 10:25:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58440) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oLltm-0000AT-7E for qemu-devel@nongnu.org; Wed, 10 Aug 2022 09:37:29 -0400 Received: from 1.mo548.mail-out.ovh.net ([178.32.121.110]:49239) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oLlti-0007YN-TJ for qemu-devel@nongnu.org; Wed, 10 Aug 2022 09:37:24 -0400 Received: from mxplan5.mail.ovh.net (unknown [10.109.143.174]) by mo548.mail-out.ovh.net (Postfix) with ESMTPS id 9F04E210C4; Wed, 10 Aug 2022 13:37:18 +0000 (UTC) Received: from kaod.org (37.59.142.102) by DAG4EX2.mxp5.local (172.16.2.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.9; Wed, 10 Aug 2022 15:37:17 +0200 Authentication-Results: garm.ovh; auth=pass (GARM-102R0040fcd0ba5-318e-474b-a6ad-49cf2ccdd3b3, 043EABA4B22CD34FCE1B70F8CBB6C707CA017DB3) smtp.auth=clg@kaod.org X-OVh-ClientIp: 90.89.155.17 Message-ID: <37cd4fe3-2e10-01fc-cf85-3475cda3a93d@kaod.org> Date: Wed, 10 Aug 2022 15:37:16 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH for-7.2 v3 09/11] ppc/pnv: change pnv_phb4_get_pec() to also retrieve chip10->pecs Content-Language: en-US To: Daniel Henrique Barboza , CC: , References: <20220810100536.473859-1-danielhb413@gmail.com> <20220810100536.473859-10-danielhb413@gmail.com> From: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= In-Reply-To: <20220810100536.473859-10-danielhb413@gmail.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [37.59.142.102] X-ClientProxiedBy: DAG6EX1.mxp5.local (172.16.2.51) To DAG4EX2.mxp5.local (172.16.2.32) X-Ovh-Tracer-GUID: 5136ac9c-58b1-44af-a834-33e6eeb79484 X-Ovh-Tracer-Id: 13010336374597848032 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvfedrvdegvddgieegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepkfffgggfuffvvehfhfgjtgfgihesthejredttdefjeenucfhrhhomhepveorughrihgtpgfnvggpifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucggtffrrghtthgvrhhnpeelleeiiefgkeefiedtvdeigeetueetkeffkeelheeugfetteegvdekgfehgffgkeenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddruddtvdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhhtpdhhvghlohepmhigphhlrghnhedrmhgrihhlrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdpnhgspghrtghpthhtohepuddprhgtphhtthhopehfsggrrhhrrghtsehlihhnuhigrdhisghmrdgtohhmpdfovfetjfhoshhtpehmohehgeek Received-SPF: pass client-ip=178.32.121.110; envelope-from=clg@kaod.org; helo=1.mo548.mail-out.ovh.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 8/10/22 12:05, Daniel Henrique Barboza wrote: > The function assumes that we're always dealing with a PNV9_CHIP() > object. This is not the case when the pnv-phb device belongs to a > powernv10 machine. > > Change pnv_phb4_get_pec() to be able to work with PNV10_CHIP() if > necessary. > > Signed-off-by: Daniel Henrique Barboza > --- > hw/pci-host/pnv_phb.c | 17 +++++++++++++++-- > 1 file changed, 15 insertions(+), 2 deletions(-) > > diff --git a/hw/pci-host/pnv_phb.c b/hw/pci-host/pnv_phb.c > index a142b8ff8d..feaef8137f 100644 > --- a/hw/pci-host/pnv_phb.c > +++ b/hw/pci-host/pnv_phb.c > @@ -53,17 +53,30 @@ static void pnv_parent_bus_fixup(DeviceState *parent, DeviceState *child) > static PnvPhb4PecState *pnv_phb4_get_pec(PnvChip *chip, PnvPHB4 *phb, > Error **errp) > { > - Pnv9Chip *chip9 = PNV9_CHIP(chip); > + PnvPHB *phb_base = phb->phb_base; > + PnvPhb4PecState *pecs = NULL; > int chip_id = phb->chip_id; > int index = phb->phb_id; > int i, j; > > + if (phb_base->version == 4) { > + Pnv9Chip *chip9 = PNV9_CHIP(chip); > + > + pecs = chip9->pecs; > + } else if (phb_base->version == 5) { > + Pnv10Chip *chip10 = PNV10_CHIP(chip); > + > + pecs = chip10->pecs; > + } else { May be : g_assert_not_reached(); > + return NULL; > + } > + > for (i = 0; i < chip->num_pecs; i++) { > /* > * For each PEC, check the amount of phbs it supports > * and see if the given phb4 index matches an index. > */ > - PnvPhb4PecState *pec = &chip9->pecs[i]; > + PnvPhb4PecState *pec = &pecs[i]; > > for (j = 0; j < pec->num_phbs; j++) { > if (index == pnv_phb4_pec_get_phb_id(pec, j)) {