From nobody Sun May 19 01:43:08 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1677878982; cv=none; d=zohomail.com; s=zohoarc; b=S0mQ2x1XVbU7wwDoVtxlopWhUnBjkszkRpP7QtgNPLAamqDomm74dcjGpHP0fd/O4MmUKZJY6QQQRHxDr7YBruq2sjtArHthzop1nlBEKGteL9KEwv23c0y1RpA6nFQ9rigg0+BRErm6SOBFFTUcQC/xuZWqBs/7FjsHS4qX13E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677878982; 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=8eaiwNziqNZ9tzBgMhv3+qNMBuzTH6Hd0kPNNVktQvA=; b=L38VyvLE0Ixpr7fQnQWVNGJBnjw052OwEewbnDPIZjJU9piYfCCMm0txC+hvNK1rg7KeeMv6n7JGEI26Sn8nwl59q3VRdHvmgUhHkcqmtxO0aNZUdpT86a3JQxaqeXDQtYKVFS9x5iqX9h12gGoFiBiaiJ3UWaIMLQK2olYOiW0= 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 1677878982213546.6321133597615; Fri, 3 Mar 2023 13:29:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pYCxO-0004bv-6Q; Fri, 03 Mar 2023 16:28:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pYCxK-0004bQ-DT; Fri, 03 Mar 2023 16:28:46 -0500 Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pYCxI-00028n-IZ; Fri, 03 Mar 2023 16:28:45 -0500 Received: by mail-ot1-x32b.google.com with SMTP id f19-20020a9d5f13000000b00693ce5a2f3eso2184739oti.8; Fri, 03 Mar 2023 13:28:43 -0800 (PST) Received: from grind.. ([177.189.53.31]) by smtp.gmail.com with ESMTPSA id k4-20020a0568301be400b0068d4649bedasm1473635otb.67.2023.03.03.13.28.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 13:28:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8eaiwNziqNZ9tzBgMhv3+qNMBuzTH6Hd0kPNNVktQvA=; b=M557FZ+zNUnOvHnoQJLZdp4QhUZcW8xbxL6f20/riCG3K6fKEVhE9qD4pZavm9LliN oHj06Et4bocHls7TbzGwZZAjHfxQhW+OH47wEcHGcxZuFIVbMTP2r0HxAiVnPM6Mkkp1 QV8iiSX369+58zL+bKd+/pA7J85LPFkdhKNFAGPIEbuvnukLQ9gGK64YpdF+s2PKUjNi 4XUPC9KAdFFd1XTOKYyiCLujJPrnNJZOocJP3dHu4AeuySgQLtiE9+1cwMj8Aqcx8SrD mnYp98YQ6oAWrFUKCcxT4M2fcI1S2LQbOVbRMmyXPKH4Po8hGCy+114Gfdpwnf4l6x7+ WYMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8eaiwNziqNZ9tzBgMhv3+qNMBuzTH6Hd0kPNNVktQvA=; b=3mz+MaTt5o7ooA1l2MK/RdJDPIAXoO3MA1pWSlQCrGTTCSgYdQ2DdK4M97Pyh8LEke Xl/BguqyUfipoY8o9HRE/y43sfmiTzuomxQi6Ms64g8nTH6dSeSujDMmfGCkd+42GC0n aJlvcjHdfKs86XqRgzFm3sX3QehU0D39p5dW9bRIfNyx5jfLL7cjNAEatJANov0In8S1 1VY99Go+AyWcn6/APQec/7b183LalmU4JVYIdaqUfwaT/vCHES6wfSK/r8XFM3VxK5MJ rFjDyBQVlsg5pVcfDNprge+wHb5HPAmLYdcDGQCBCdqQyeBuXrDDlTHUGtozgAS5j0lA fiOg== X-Gm-Message-State: AO0yUKXnX031mCtncJVSejIhnEEYcNazgpHQEjFXeAMXVMWSQWWBzywi vrkehXopX6G9to7ixqlD9g0LCNh0G34= X-Google-Smtp-Source: AK7set8WkDbZG7dATXcUlm4K0+/1rGBvGFnQmGhvo61KsVbWGAgTllp7yWnhLIyQ2Ku2oaUZRhvdMg== X-Received: by 2002:a9d:705c:0:b0:68b:bf5e:492c with SMTP id x28-20020a9d705c000000b0068bbf5e492cmr1380870otj.28.1677878922922; Fri, 03 Mar 2023 13:28:42 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, danielhb413@gmail.com, peter.maydell@linaro.org, Bernhard Beschow , Richard Henderson Subject: [PULL 1/5] target/ppc/translate: Add dummy implementation for dcblc instruction Date: Fri, 3 Mar 2023 18:28:27 -0300 Message-Id: <20230303212831.830278-2-danielhb413@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303212831.830278-1-danielhb413@gmail.com> References: <20230303212831.830278-1-danielhb413@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2607:f8b0:4864:20::32b; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x32b.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1677878983887100003 Content-Type: text/plain; charset="utf-8" From: Bernhard Beschow The dcblc instruction is used by u-boot in mpc85xx/start.S. Without it, an illegal istruction exception is generated very early in the boot process where the processor is not yet able to handle exceptions. See: https://github.com/u-boot/u-boot/blob/v2023.01/arch/powerpc/cpu/mpc85xx/sta= rt.S#L1840 Signed-off-by: Bernhard Beschow Message-Id: <20230130184950.5241-1-shentey@gmail.com> Acked-by: Richard Henderson Reviewed-by: Daniel Henrique Barboza Signed-off-by: Daniel Henrique Barboza --- target/ppc/translate.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index 2956021e89..37b67d5175 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -5253,6 +5253,14 @@ static void gen_dcbtls(DisasContext *ctx) tcg_temp_free(t0); } =20 +/* dcblc */ +static void gen_dcblc(DisasContext *ctx) +{ + /* + * interpreted as no-op + */ +} + /* dcbz */ static void gen_dcbz(DisasContext *ctx) { @@ -6824,6 +6832,7 @@ GEN_HANDLER_E(dcbtep, 0x1F, 0x1F, 0x09, 0x00000001, P= PC_NONE, PPC2_BOOKE206), GEN_HANDLER(dcbtst, 0x1F, 0x16, 0x07, 0x00000001, PPC_CACHE), GEN_HANDLER_E(dcbtstep, 0x1F, 0x1F, 0x07, 0x00000001, PPC_NONE, PPC2_BOOKE= 206), GEN_HANDLER_E(dcbtls, 0x1F, 0x06, 0x05, 0x02000001, PPC_BOOKE, PPC2_BOOKE2= 06), +GEN_HANDLER_E(dcblc, 0x1F, 0x06, 0x0c, 0x02000001, PPC_BOOKE, PPC2_BOOKE20= 6), GEN_HANDLER(dcbz, 0x1F, 0x16, 0x1F, 0x03C00001, PPC_CACHE_DCBZ), GEN_HANDLER_E(dcbzep, 0x1F, 0x1F, 0x1F, 0x03C00001, PPC_NONE, PPC2_BOOKE20= 6), GEN_HANDLER(dst, 0x1F, 0x16, 0x0A, 0x01800001, PPC_ALTIVEC), --=20 2.39.2 From nobody Sun May 19 01:43:08 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1677878983; cv=none; d=zohomail.com; s=zohoarc; b=TTfwEpkikRvEAj161DGEuvhpElZe7/0CX0fK3to3ObGxbDlRO/gZUA9bhmakXqetvyymS/pgo0ev08+7noQt1JPPMnyctnBcK3F6V7wb5idwfHb/pCl7SWObwcdTw9UjNpmxhbNHJohjiKy+LZVIA6+B9KAHjibJwiUS2v2GKzw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677878983; 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=lcuAXUMTUzs0tseZ/7zL5SXiIQ4vFGrA1FYrIaP1diI=; b=PkPA1xEGFEoQ43ktWvVkWepTkTd8JLkgluD+ZyZwjGbgCv5HPmnByzBL9SC9HrSljrmJWzxzsv75gSOdk7SHHUVS0pkSQzv3n/NJ/Mqje5xFCX74yzeAnXxNHKi6RPghB5Ql4tpXpxxMyf4SUtK3QKAHeB8kT2tinCmdLmFSpOI= 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 1677878983511714.3748591623869; Fri, 3 Mar 2023 13:29:43 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pYCxQ-0004cu-Pm; Fri, 03 Mar 2023 16:28:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pYCxO-0004cD-Ci; Fri, 03 Mar 2023 16:28:50 -0500 Received: from mail-ot1-x335.google.com ([2607:f8b0:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pYCxL-00029C-Ft; Fri, 03 Mar 2023 16:28:49 -0500 Received: by mail-ot1-x335.google.com with SMTP id o4-20020a9d6d04000000b00694127788f4so2189961otp.6; Fri, 03 Mar 2023 13:28:46 -0800 (PST) Received: from grind.. ([177.189.53.31]) by smtp.gmail.com with ESMTPSA id k4-20020a0568301be400b0068d4649bedasm1473635otb.67.2023.03.03.13.28.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 13:28:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lcuAXUMTUzs0tseZ/7zL5SXiIQ4vFGrA1FYrIaP1diI=; b=OeL5v/tNZp4AcrUxXL6DBDijKBmimOsfnd7ZU/yEZHwPiDaRD0sKwl0M3xg42wcxI8 2qaFwX5yq4eUUB8uyChT3LUpXIZqvX8U0JDrD5Wo5t+WsMUrMpOKT/rj76PWpzFtpjsA nxzYeoOzbW4PnaPVTk50YBodrNAhC9GN5BGrFPmJy36gOz4C00SrzI7gA4vPxKFIdTBS jYdzG2HlDtOcRYdCDy11hBGL+jjQITAaYY8gQw7D0JYsWXfCwKO2FPGBG+bKx5iOxLIL 2+NhWdj0DHQZGr89XaiFbmp3KVQy7CxqWqcQ7H77jNng3z8Jw5Kpg1bFe/aQjNdoBHUc qrCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lcuAXUMTUzs0tseZ/7zL5SXiIQ4vFGrA1FYrIaP1diI=; b=tmEO7DdSgSrFbp14SMmpMszlzUC1b8uYhzBB+/HgdWh/x9D2rx6r9Uv4hLKlozvC2z UQnZ4IhOqCJVVOL0tUsNEm6FZEO2quIaI8uZ4RI1PpuJDkZzOfBok/VJUpaI1wjPqBur kM8oL+E9lqYWxS5rZZ6Ib+KKyO9S1ftHEV2IVGdYSal+QgEHHPNroEVHov+03Isb/Ibu BjZ67JXL83HDttMA1D3aoh/RyMtxYcm/AF5CU39Rd4R8plkR0QyncpngxFGfiYYfbLOx LMF4g1hzOaDzxv1stj9vSi+1tHCw2z5Wh0A1L3bg91XR0VplC0gtPU66oY2Jtb74TA4M nTgg== X-Gm-Message-State: AO0yUKVN5TBErLS2UF6RtNX3CsuNiE4sYOrB9IN1ZEdJxrusWr/GvBzD uuDIDgebUCYaqs8jmfQeeGZWjDx9fyU= X-Google-Smtp-Source: AK7set99XiXpERN6YnaaDuIh5nMdEldCKi6HB6wI9sJ0CYhHeaCIWIuWxoSJrf6EI/cGbPz97m8KzQ== X-Received: by 2002:a05:6830:349f:b0:694:4f92:e7d9 with SMTP id c31-20020a056830349f00b006944f92e7d9mr1448037otu.28.1677878925734; Fri, 03 Mar 2023 13:28:45 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, danielhb413@gmail.com, peter.maydell@linaro.org, Frederic Barrat Subject: [PULL 2/5] pnv_phb4_pec: Keep track of instantiated PHBs Date: Fri, 3 Mar 2023 18:28:28 -0300 Message-Id: <20230303212831.830278-3-danielhb413@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303212831.830278-1-danielhb413@gmail.com> References: <20230303212831.830278-1-danielhb413@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2607:f8b0:4864:20::335; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x335.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1677878985697100007 Content-Type: text/plain; charset="utf-8" From: Frederic Barrat Add an array on the PEC object to keep track of the PHBs which are instantiated. The array can be sparsely populated when using user-created PHBs. It will be useful for the next patch to only export instantiated PHBs in the device tree. Reviewed-by: Daniel Henrique Barboza Signed-off-by: Frederic Barrat Message-Id: <20230302163715.129635-2-fbarrat@linux.ibm.com> Signed-off-by: Daniel Henrique Barboza --- hw/pci-host/pnv_phb4_pec.c | 12 +++++++----- hw/ppc/pnv.c | 1 + include/hw/pci-host/pnv_phb4.h | 2 ++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c index 43267a428f..97c06bb0a0 100644 --- a/hw/pci-host/pnv_phb4_pec.c +++ b/hw/pci-host/pnv_phb4_pec.c @@ -112,9 +112,9 @@ static const MemoryRegionOps pnv_pec_pci_xscom_ops =3D { .endianness =3D DEVICE_BIG_ENDIAN, }; =20 -static void pnv_pec_default_phb_realize(PnvPhb4PecState *pec, - int stack_no, - Error **errp) +static PnvPHB *pnv_pec_default_phb_realize(PnvPhb4PecState *pec, + int stack_no, + Error **errp) { PnvPHB *phb =3D PNV_PHB(qdev_new(TYPE_PNV_PHB)); int phb_id =3D pnv_phb4_pec_get_phb_id(pec, stack_no); @@ -128,8 +128,9 @@ static void pnv_pec_default_phb_realize(PnvPhb4PecState= *pec, &error_fatal); =20 if (!sysbus_realize(SYS_BUS_DEVICE(phb), errp)) { - return; + return NULL; } + return phb; } =20 static void pnv_pec_realize(DeviceState *dev, Error **errp) @@ -148,8 +149,9 @@ static void pnv_pec_realize(DeviceState *dev, Error **e= rrp) =20 /* Create PHBs if running with defaults */ if (defaults_enabled()) { + g_assert(pec->num_phbs <=3D MAX_PHBS_PER_PEC); for (i =3D 0; i < pec->num_phbs; i++) { - pnv_pec_default_phb_realize(pec, i, errp); + pec->phbs[i] =3D pnv_pec_default_phb_realize(pec, i, errp); } } =20 diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 44b1fbbc93..24bf8461d6 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -314,6 +314,7 @@ static PnvPhb4PecState *pnv_phb4_get_pec(PnvChip *chip,= PnvPHB4 *phb, =20 for (j =3D 0; j < pec->num_phbs; j++) { if (index =3D=3D pnv_phb4_pec_get_phb_id(pec, j)) { + pec->phbs[j] =3D phb->phb_base; return pec; } } diff --git a/include/hw/pci-host/pnv_phb4.h b/include/hw/pci-host/pnv_phb4.h index 28d61b96c7..0b72ef1471 100644 --- a/include/hw/pci-host/pnv_phb4.h +++ b/include/hw/pci-host/pnv_phb4.h @@ -185,6 +185,8 @@ struct PnvPhb4PecState { =20 /* PHBs */ uint32_t num_phbs; +#define MAX_PHBS_PER_PEC 3 + PnvPHB *phbs[MAX_PHBS_PER_PEC]; =20 PnvChip *chip; }; --=20 2.39.2 From nobody Sun May 19 01:43:08 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1677879021; cv=none; d=zohomail.com; s=zohoarc; b=CfyT5C9hn/Cn0B89GPyhbssntxrLty16xDqWEoR6EpShCWFNW8XkmSrAgKOdLEyO+CchOkxRLyDfdLLh1nydjFcqEOkJZPXys2HZBPWhokFpIoICPkWrxCZJuOz46U+S8zQrT6Wjb3r1yLmeSF1EpSIRrdyY9yGri1PwiHXYois= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677879021; 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=wfPfcqwMeqajB5OGSRPf4G6T1CszDgygMYTUOB4XWjs=; b=E3EJQVYcHNEsMvcbrAmGZMmMuJqInmdgcqCH5X9VJ/PFW317d+NBHRZVtPsH9IBWT4G+q4Daej9rgCiHN+JaPQoMafvYOzpbncvN9wMx+9Y5wNLkv2v4KsGTHC2NS5Ib1zIuzxssv7gOPAEfEk164V+jaZO986QVpBppgC9Un+E= 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 1677879021548632.873189333914; Fri, 3 Mar 2023 13:30:21 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pYCxR-0004cv-6X; Fri, 03 Mar 2023 16:28:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pYCxP-0004cb-Vy; Fri, 03 Mar 2023 16:28:52 -0500 Received: from mail-ot1-x332.google.com ([2607:f8b0:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pYCxO-00029n-Fk; Fri, 03 Mar 2023 16:28:51 -0500 Received: by mail-ot1-x332.google.com with SMTP id q11-20020a056830440b00b00693c1a62101so2227656otv.0; Fri, 03 Mar 2023 13:28:49 -0800 (PST) Received: from grind.. ([177.189.53.31]) by smtp.gmail.com with ESMTPSA id k4-20020a0568301be400b0068d4649bedasm1473635otb.67.2023.03.03.13.28.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 13:28:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wfPfcqwMeqajB5OGSRPf4G6T1CszDgygMYTUOB4XWjs=; b=Sw9zkQB2H1+foFMFG5jy7/GGj1ekIEbhz6qFDDhehIw37R7ykgT1QU6G1pBmSGM03t WRFef/rkwE1Q6lHDYv5UTUAj+0dVkQWhMHQLom9QOp+mUl/xuhNJuj79U4DdZPNsMTgw oy1W0iwWxaquJVH3DVdozFSCaliRVNka6aVYQ4EWdd53j8+GUJoljQ8ALxolyIBcjCk6 LikMMPS4pfqMP4HQ91elzehxh7rXQfOrrIi0pHneutmI5tZPhhizG2bBQoqM4DvRhLR2 W6uE9qT34hSAuZVa7qY65OQ5eAAh5gVmEVYQy6av2nYD/DC+1U2IganN0x4vNVMYOre8 5Srg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wfPfcqwMeqajB5OGSRPf4G6T1CszDgygMYTUOB4XWjs=; b=rqqvvLivznYo+7odqC30tfVFe2uipVzBPUc3Gxxr9/u7dXydHFcFhI//K0//Q3nNOu pfM5G/9Ew7D4/DISUMXDvzrY7jrnHIst7NgDEu0Cv0Le4HQoT+YC7i4e+Sfw4qLNmLta Xbt+x94Yuu6IIzMwa28Z67PzZevl1aMmdkcncPR5kyvK98Pn6SNgRk3hntYMaR4NADYB YVYiYp8bhsCWbmcK8BwzaL7CU6wvcxbGjoh4xy4CbUmE+9kWpOn6B0J078YwAcD1LonN ul9CDAv33JLba/Mv1ExwbrBGkhJoRWZ9yv9vg1DH8WG5Sp3m3GGxiaaS7UDSf/TxKKn4 uf9g== X-Gm-Message-State: AO0yUKUVhxJaUj0JE14TbvoKwd+iTDgOp5/QbYAH1NfpRuZNvRtow8Iw 3TZuO1N/mBKkyJs5Oq5vjqVsCdbKUMs= X-Google-Smtp-Source: AK7set8FGUYf3B/c4TZfQG44Ku599GeLbGOWeqaXFhgGg0kjUYG0IpeW1ZRY0G9UY0OLN0JNEIkxWA== X-Received: by 2002:a05:6830:3687:b0:66e:a9bd:712f with SMTP id bk7-20020a056830368700b0066ea9bd712fmr1484358otb.10.1677878928562; Fri, 03 Mar 2023 13:28:48 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, danielhb413@gmail.com, peter.maydell@linaro.org, Frederic Barrat Subject: [PULL 3/5] pnv_phb4_pec: Only export existing PHBs to the device tree Date: Fri, 3 Mar 2023 18:28:29 -0300 Message-Id: <20230303212831.830278-4-danielhb413@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303212831.830278-1-danielhb413@gmail.com> References: <20230303212831.830278-1-danielhb413@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2607:f8b0:4864:20::332; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x332.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1677879023884100003 Content-Type: text/plain; charset="utf-8" From: Frederic Barrat So far, we were always exporting all possible PHBs to the device tree. It works well when using the default config but it potentially adds non-existing devices when using '-nodefaults' and user-created PHBs, causing the firmware (skiboot) to report errors when probing those PHBs. This patch only exports PHBs which have been realized to the device tree. Fixes: d786be3fe746 ("ppc/pnv: enable user created pnv-phb for powernv9") Signed-off-by: Frederic Barrat Message-Id: <20230302163715.129635-3-fbarrat@linux.ibm.com> Reviewed-by: Daniel Henrique Barboza Signed-off-by: Daniel Henrique Barboza --- hw/pci-host/pnv_phb4_pec.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c index 97c06bb0a0..6c9b386069 100644 --- a/hw/pci-host/pnv_phb4_pec.c +++ b/hw/pci-host/pnv_phb4_pec.c @@ -199,9 +199,12 @@ static int pnv_pec_dt_xscom(PnvXScomInterface *dev, vo= id *fdt, pecc->compat_size))); =20 for (i =3D 0; i < pec->num_phbs; i++) { - int phb_id =3D pnv_phb4_pec_get_phb_id(pec, i); int stk_offset; =20 + if (!pec->phbs[i]) { + continue; + } + name =3D g_strdup_printf("stack@%x", i); stk_offset =3D fdt_add_subnode(fdt, offset, name); _FDT(stk_offset); @@ -209,7 +212,8 @@ static int pnv_pec_dt_xscom(PnvXScomInterface *dev, voi= d *fdt, _FDT((fdt_setprop(fdt, stk_offset, "compatible", pecc->stk_compat, pecc->stk_compat_size))); _FDT((fdt_setprop_cell(fdt, stk_offset, "reg", i))); - _FDT((fdt_setprop_cell(fdt, stk_offset, "ibm,phb-index", phb_id))); + _FDT((fdt_setprop_cell(fdt, stk_offset, "ibm,phb-index", + pec->phbs[i]->phb_id))); } =20 return 0; --=20 2.39.2 From nobody Sun May 19 01:43:08 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1677879013; cv=none; d=zohomail.com; s=zohoarc; b=k1rh7a0/czgg1AaWNVMxG0mKH0o7XKhRwRD02bJBW8zIzHWWSg1plSmhKjHqV1N+1EcWK3iXqvvjMxO6AErSBGO351QvOJrJYxV3MDXz5rviA30WlOShrheSxN494JlLQ6JX61GWrw1YMZa2UXEG7GiWqmuxGN+ZLnmQaqRUTyU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677879013; 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=KKiIMFr9+ws6YEP2gd2oIPoymNkyJlWdH9Wu6UVIdlE=; b=RChM4OJFHdO/g5VZLNZ9wNctrFgvKptwr860PUaxre4nbFqy6wYBaSg/7UnLOrdC/jqurOkA1nFxNAU63n+3A2pVnqv5AzOUxesM1wHVIrXPcWLcVUTi6csKXuf2Efm2evmX5daFPpN75irW3zR+jgp1W3bxhrnM4srld8i+N4s= 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 1677879013268368.2386028914799; Fri, 3 Mar 2023 13:30:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pYCxW-0004eV-3B; Fri, 03 Mar 2023 16:28:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pYCxT-0004dz-1t; Fri, 03 Mar 2023 16:28:55 -0500 Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pYCxQ-00028n-Bs; Fri, 03 Mar 2023 16:28:54 -0500 Received: by mail-ot1-x32b.google.com with SMTP id f19-20020a9d5f13000000b00693ce5a2f3eso2184927oti.8; Fri, 03 Mar 2023 13:28:51 -0800 (PST) Received: from grind.. ([177.189.53.31]) by smtp.gmail.com with ESMTPSA id k4-20020a0568301be400b0068d4649bedasm1473635otb.67.2023.03.03.13.28.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 13:28:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KKiIMFr9+ws6YEP2gd2oIPoymNkyJlWdH9Wu6UVIdlE=; b=BCaEfcH5LlXteKEXWvFd/UcIogrqYh2+BlaIWyuwGSxNJROANwPgMJQoOnpGHnLdla mpfshrmPicgrPc65VMgDFsZA252QMxOlVZQppi95bYi59AG2mEyVyQBWKwyBXeQbHxLV aAk+Cr87kEXcBHv7kwS4KMP1jBeKDsU793oUfwXcUdGAhIf9EzJqsOzxE+Y7xhGL00rZ 8oFwkbAzTAEJnMCTpvAMr3i7CXFQUVAdPFiZSCg9jWNBl8YF6CjKwfMyWk9uuTpWqTm1 wyoIv6YULrD8puv8Utk/Gdh49rdhkDrKzH6oNqssByXSuMtRGDLYq0EuCU0XxOZ+OilL bDcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KKiIMFr9+ws6YEP2gd2oIPoymNkyJlWdH9Wu6UVIdlE=; b=qjqwqh+TcANyRqRBYXOtpgUhKq5djS1XCPKYYCbYesIvMPNbryJbXVQYYVBWcxxJju yNLKFIzPVK1ROrpE0k/KJP6CDAPAiTNrt6ueiu/jglqAdAPru0oIwyIym0UMIbjMSfBe A8RnXIr5kXzOo4zwMGW3LFqa2vb5zQvS2zc96uaClB8rYHrQMo/gAj5UXjlbetsRbB1I AEIx65ZmwJXJb4HC1s9Io81kVcxULQJxE/FrI+rgPjreni+g9EXUu7d69tdTWJczbH1h mPxbSds6IqUgpEBCGF8+e9tifWJ8mpZifJxEQA5P7KEfAfohfG22PToID4S7eTbFpVmc CEIQ== X-Gm-Message-State: AO0yUKXfptIUaz/EVSDO1CNlLfKEG29q8olnM4SyM4IoJcEEqy7fOW09 OgH3d8WxO7Dk1loTfNKYpygthvg0fD8= X-Google-Smtp-Source: AK7set9XlR5QcLiNUZwPwq4ddPEFup1DX9pTFh+o0ZO+a8TPb3LjmdiNOttlQ8NjebUcW0s1zJak3g== X-Received: by 2002:a9d:6119:0:b0:68b:d344:97cb with SMTP id i25-20020a9d6119000000b0068bd34497cbmr1438461otj.13.1677878931207; Fri, 03 Mar 2023 13:28:51 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, danielhb413@gmail.com, peter.maydell@linaro.org, Frederic Barrat Subject: [PULL 4/5] pnv_phb4_pec: Move pnv_phb4_get_pec() to rightful file Date: Fri, 3 Mar 2023 18:28:30 -0300 Message-Id: <20230303212831.830278-5-danielhb413@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303212831.830278-1-danielhb413@gmail.com> References: <20230303212831.830278-1-danielhb413@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2607:f8b0:4864:20::32b; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x32b.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1677879013850100001 Content-Type: text/plain; charset="utf-8" From: Frederic Barrat The function pnv_phb4_get_pec() exposes some internals of the PEC and PHB logic, yet it was in the higher level hw/ppc/pnv.c file for historical reasons: P8 implements the PHBs from pnv.c directly, but on P9/P10, it's done through the CEC model, which has its own file. So move pnv_phb4_get_pec() to hw/pci-host/pnv_phb4_pec.c, where it fits naturally. While at it, replace the PnvPHB4 parameter by the PnvPHB front-end, since it has all the information needed and simplify it a bit. No functional changes. Signed-off-by: Frederic Barrat Message-Id: <20230302163715.129635-4-fbarrat@linux.ibm.com> Reviewed-by: Daniel Henrique Barboza Signed-off-by: Daniel Henrique Barboza --- hw/pci-host/pnv_phb4_pec.c | 40 +++++++++++++++++++++++++++++++ hw/ppc/pnv.c | 44 +--------------------------------- include/hw/pci-host/pnv_phb4.h | 1 + 3 files changed, 42 insertions(+), 43 deletions(-) diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c index 6c9b386069..6e2e5ae186 100644 --- a/hw/pci-host/pnv_phb4_pec.c +++ b/hw/pci-host/pnv_phb4_pec.c @@ -112,6 +112,46 @@ static const MemoryRegionOps pnv_pec_pci_xscom_ops =3D= { .endianness =3D DEVICE_BIG_ENDIAN, }; =20 +PnvPhb4PecState *pnv_phb4_get_pec(PnvChip *chip, PnvPHB *phb, Error **errp) +{ + PnvPhb4PecState *pecs =3D NULL; + int chip_id =3D phb->chip_id; + int index =3D phb->phb_id; + int i, j; + + if (phb->version =3D=3D 4) { + Pnv9Chip *chip9 =3D PNV9_CHIP(chip); + + pecs =3D chip9->pecs; + } else if (phb->version =3D=3D 5) { + Pnv10Chip *chip10 =3D PNV10_CHIP(chip); + + pecs =3D chip10->pecs; + } else { + g_assert_not_reached(); + } + + for (i =3D 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 =3D &pecs[i]; + + for (j =3D 0; j < pec->num_phbs; j++) { + if (index =3D=3D pnv_phb4_pec_get_phb_id(pec, j)) { + pec->phbs[j] =3D phb; + return pec; + } + } + } + error_setg(errp, + "pnv-phb4 chip-id %d index %d didn't match any existing PEC= ", + chip_id, index); + + return NULL; +} + static PnvPHB *pnv_pec_default_phb_realize(PnvPhb4PecState *pec, int stack_no, Error **errp) diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 24bf8461d6..46010b30ad 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -284,48 +284,6 @@ static void pnv_dt_icp(PnvChip *chip, void *fdt, uint3= 2_t pir, g_free(reg); } =20 -static PnvPhb4PecState *pnv_phb4_get_pec(PnvChip *chip, PnvPHB4 *phb, - Error **errp) -{ - PnvPHB *phb_base =3D phb->phb_base; - PnvPhb4PecState *pecs =3D NULL; - int chip_id =3D phb->chip_id; - int index =3D phb->phb_id; - int i, j; - - if (phb_base->version =3D=3D 4) { - Pnv9Chip *chip9 =3D PNV9_CHIP(chip); - - pecs =3D chip9->pecs; - } else if (phb_base->version =3D=3D 5) { - Pnv10Chip *chip10 =3D PNV10_CHIP(chip); - - pecs =3D chip10->pecs; - } else { - g_assert_not_reached(); - } - - for (i =3D 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 =3D &pecs[i]; - - for (j =3D 0; j < pec->num_phbs; j++) { - if (index =3D=3D pnv_phb4_pec_get_phb_id(pec, j)) { - pec->phbs[j] =3D phb->phb_base; - return pec; - } - } - } - error_setg(errp, - "pnv-phb4 chip-id %d index %d didn't match any existing PEC= ", - chip_id, index); - - return NULL; -} - /* * Adds a PnvPHB to the chip. Returns the parent obj of the * PHB which varies with each version (phb version 3 is parented @@ -349,7 +307,7 @@ Object *pnv_chip_add_phb(PnvChip *chip, PnvPHB *phb, Er= ror **errp) return OBJECT(chip); } =20 - phb->pec =3D pnv_phb4_get_pec(chip, PNV_PHB4(phb->backend), errp); + phb->pec =3D pnv_phb4_get_pec(chip, phb, errp); =20 return OBJECT(phb->pec); } diff --git a/include/hw/pci-host/pnv_phb4.h b/include/hw/pci-host/pnv_phb4.h index 0b72ef1471..5c5edb2941 100644 --- a/include/hw/pci-host/pnv_phb4.h +++ b/include/hw/pci-host/pnv_phb4.h @@ -157,6 +157,7 @@ struct PnvPHB4 { =20 void pnv_phb4_pic_print_info(PnvPHB4 *phb, Monitor *mon); int pnv_phb4_pec_get_phb_id(PnvPhb4PecState *pec, int stack_index); +PnvPhb4PecState *pnv_phb4_get_pec(PnvChip *chip, PnvPHB *phb, Error **errp= ); void pnv_phb4_bus_init(DeviceState *dev, PnvPHB4 *phb); extern const MemoryRegionOps pnv_phb4_xscom_ops; =20 --=20 2.39.2 From nobody Sun May 19 01:43:08 2024 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1677878962; cv=none; d=zohomail.com; s=zohoarc; b=QwT1DfH+td3WixIEiVbw+aYZ/r1BNVf+HC7tDtFoQcWS6TkiyH9exq4B/6A5szTLqmUQK8G4e7SUSxEMl3uSjRVqCMzcRbEpWugBm6Jl3rrp5JB90U/urcZR8u5Q4v5oSNOLo/INIvK4bC9Yhikd132Oy2nRKB6BVjL2AeZq+Dg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677878962; 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=e2hLuQycBG78tqQ6+RVrdZ+HQFQHpWW0i15WIct5k54=; b=kWg0BhyoJiKlUWTwPnp9E4g8myttk239Eb8y9y1tfSDwpurks9kmw0QNsJVnlAx2GWjzcxEpMXofx+jYuM7yVA5xCK6Hbcl+TYLpXNfk+g5VuWkt2zrdw1UxRl5VNz9QwZB1UwA98EWtUpmxNp1WhFRbhoxeRzEZBrCM6CVOCtU= 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 167787896266159.091102873948444; Fri, 3 Mar 2023 13:29:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pYCxc-0004fM-Jr; Fri, 03 Mar 2023 16:29:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pYCxV-0004eT-5B; Fri, 03 Mar 2023 16:28:57 -0500 Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pYCxT-0002Av-Fh; Fri, 03 Mar 2023 16:28:56 -0500 Received: by mail-ot1-x32e.google.com with SMTP id l16-20020a9d4c10000000b006944b17058cso1980282otf.2; Fri, 03 Mar 2023 13:28:54 -0800 (PST) Received: from grind.. ([177.189.53.31]) by smtp.gmail.com with ESMTPSA id k4-20020a0568301be400b0068d4649bedasm1473635otb.67.2023.03.03.13.28.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 13:28:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=e2hLuQycBG78tqQ6+RVrdZ+HQFQHpWW0i15WIct5k54=; b=CcNg5GKww3Gy6HemY08TCL9LXaldG45gZun61v87zL15S3wBKanMNsRW+KNbc5TvcG Qd42xoACYkt3ZwxiwQrB1MJR965tvV6zibGg4bKZqlWekOhJRzhxujG6n6gY2ZFjDPZY 0ICzEnOYmPuM0rItE0HG7JX29BgOfv0V6YWB6qcAzZUDW2wNK/zlk0y24eWJmRcC2cRJ ZgbA9UWRzrEk5DNVQHxazcb/qUsR2bDT6YZOeNPQ+Y7aftdo19bGifmBm3n+pjT4ay/l 1TPpsYqrDTzqD0mw19mac/MfRizqlHsljDi/QJLCAkYm3q0KlT1OPNWp2WM8/GZvOYdu u8iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e2hLuQycBG78tqQ6+RVrdZ+HQFQHpWW0i15WIct5k54=; b=xq0hW5ioTpu+1Yc7PIybWkiSLxixnoaeerrJQXlU/ADMMazrEI5tj/OGvHaWY3N2/e iCLVSSAbMQjs8Nz8mJ05TYSv2cUzL208wsLiLpVCIj8lx8XD9ohmZWQV51k7N2++6gk4 I3F42a3MzfJezgNaLmEiA7uWJCfGmykTtvKZi8Mlbc50jsOOHcfi2OZBri79xoBKdBd0 ODC0HrFd+htEGHLR6nedtgItBgzY8ucEvG2ZUKUQEWkSHfuiuA8GuryCzd/nUIpOCtV7 bk0gr59MWASW15rHlUzlblp0Ifm1ua1nZ4w4WcNGTVC0Ig14yDdQ9BCAwZSYCMTv2N/J yG0w== X-Gm-Message-State: AO0yUKXE+OHPjZcuUvAZmDDVtZyRGldY0UkKzU0IbRKV3Xg2h2KTjsZk mNmTsTb4BUuFm4C7rRAulzqxBEYJZ0U= X-Google-Smtp-Source: AK7set+fcz7kCyDBDuslRF9ZW04oLCetoYCf7RVXUlNHMDWI6YtqiGvgv005tvCEOkCgbglP4zR6cg== X-Received: by 2002:a9d:62d:0:b0:693:bfc4:3eaf with SMTP id 42-20020a9d062d000000b00693bfc43eafmr1168874otn.26.1677878933864; Fri, 03 Mar 2023 13:28:53 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, danielhb413@gmail.com, peter.maydell@linaro.org, Frederic Barrat Subject: [PULL 5/5] pnv_phb4_pec: Simplify/align code to parent user-created PHBs Date: Fri, 3 Mar 2023 18:28:31 -0300 Message-Id: <20230303212831.830278-6-danielhb413@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303212831.830278-1-danielhb413@gmail.com> References: <20230303212831.830278-1-danielhb413@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=2607:f8b0:4864:20::32e; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x32e.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1677878963739100001 Content-Type: text/plain; charset="utf-8" From: Frederic Barrat When instantiating a user-created PHB on P9/P10, we don't really have a reason any more to go through an indirection in pnv_chip_add_phb() in pnv.c, we can go straight to the right function in pnv_phb4_pec.c. That way, default PHBs and user-created PHBs are all handled in the same file. This patch also renames pnv_phb4_get_pec() to pnv_pec_add_phb() to better reflect that it "hooks" a PHB to a PEC. For P8, the PHBs are parented to the chip directly, so it makes sense to keep calling pnv_chip_add_phb() in pnv.c, to also be consistent with where default PHBs are handled. The only change here is that, since that function is now only used for P8, we can refine the return type. So overall, the PnvPHB front-end now has a pnv_phb_user_get_parent() function which handles the parenting of the user-created PHBs by calling the right function in the right file based on the processor version. It's also easily extensible if we ever need to support a different parent object. Signed-off-by: Frederic Barrat Message-Id: <20230302163715.129635-5-fbarrat@linux.ibm.com> Reviewed-by: Daniel Henrique Barboza Signed-off-by: Daniel Henrique Barboza --- hw/pci-host/pnv_phb.c | 11 ++++++++++- hw/pci-host/pnv_phb4_pec.c | 3 ++- hw/ppc/pnv.c | 29 ++++++++--------------------- include/hw/pci-host/pnv_phb4.h | 2 +- include/hw/ppc/pnv.h | 2 +- 5 files changed, 22 insertions(+), 25 deletions(-) diff --git a/hw/pci-host/pnv_phb.c b/hw/pci-host/pnv_phb.c index c62b08538a..82332d7a05 100644 --- a/hw/pci-host/pnv_phb.c +++ b/hw/pci-host/pnv_phb.c @@ -62,6 +62,15 @@ static bool pnv_parent_fixup(Object *parent, BusState *p= arent_bus, return true; } =20 +static Object *pnv_phb_user_get_parent(PnvChip *chip, PnvPHB *phb, Error *= *errp) +{ + if (phb->version =3D=3D 3) { + return OBJECT(pnv_chip_add_phb(chip, phb)); + } else { + return OBJECT(pnv_pec_add_phb(chip, phb, errp)); + } +} + /* * User created devices won't have the initial setup that default * devices have. This setup consists of assigning a parent device @@ -79,7 +88,7 @@ static bool pnv_phb_user_device_init(PnvPHB *phb, Error *= *errp) return false; } =20 - parent =3D pnv_chip_add_phb(chip, phb, errp); + parent =3D pnv_phb_user_get_parent(chip, phb, errp); if (!parent) { return false; } diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c index 6e2e5ae186..3b2850f7a3 100644 --- a/hw/pci-host/pnv_phb4_pec.c +++ b/hw/pci-host/pnv_phb4_pec.c @@ -112,7 +112,7 @@ static const MemoryRegionOps pnv_pec_pci_xscom_ops =3D { .endianness =3D DEVICE_BIG_ENDIAN, }; =20 -PnvPhb4PecState *pnv_phb4_get_pec(PnvChip *chip, PnvPHB *phb, Error **errp) +PnvPhb4PecState *pnv_pec_add_phb(PnvChip *chip, PnvPHB *phb, Error **errp) { PnvPhb4PecState *pecs =3D NULL; int chip_id =3D phb->chip_id; @@ -141,6 +141,7 @@ PnvPhb4PecState *pnv_phb4_get_pec(PnvChip *chip, PnvPHB= *phb, Error **errp) for (j =3D 0; j < pec->num_phbs; j++) { if (index =3D=3D pnv_phb4_pec_get_phb_id(pec, j)) { pec->phbs[j] =3D phb; + phb->pec =3D pec; return pec; } } diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 46010b30ad..11cb48af2f 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -285,31 +285,18 @@ static void pnv_dt_icp(PnvChip *chip, void *fdt, uint= 32_t pir, } =20 /* - * Adds a PnvPHB to the chip. Returns the parent obj of the - * PHB which varies with each version (phb version 3 is parented - * by the chip, version 4 and 5 are parented by the PEC - * device). - * - * TODO: for version 3 we're still parenting the PHB with the - * chip. We should parent with a (so far not implemented) - * PHB3 PEC device. + * Adds a PnvPHB to the chip on P8. + * Implemented here, like for defaults PHBs */ -Object *pnv_chip_add_phb(PnvChip *chip, PnvPHB *phb, Error **errp) +PnvChip *pnv_chip_add_phb(PnvChip *chip, PnvPHB *phb) { - if (phb->version =3D=3D 3) { - Pnv8Chip *chip8 =3D PNV8_CHIP(chip); - - phb->chip =3D chip; - - chip8->phbs[chip8->num_phbs] =3D phb; - chip8->num_phbs++; - - return OBJECT(chip); - } + Pnv8Chip *chip8 =3D PNV8_CHIP(chip); =20 - phb->pec =3D pnv_phb4_get_pec(chip, phb, errp); + phb->chip =3D chip; =20 - return OBJECT(phb->pec); + chip8->phbs[chip8->num_phbs] =3D phb; + chip8->num_phbs++; + return chip; } =20 static void pnv_chip_power8_dt_populate(PnvChip *chip, void *fdt) diff --git a/include/hw/pci-host/pnv_phb4.h b/include/hw/pci-host/pnv_phb4.h index 5c5edb2941..2d026db9a3 100644 --- a/include/hw/pci-host/pnv_phb4.h +++ b/include/hw/pci-host/pnv_phb4.h @@ -157,7 +157,7 @@ struct PnvPHB4 { =20 void pnv_phb4_pic_print_info(PnvPHB4 *phb, Monitor *mon); int pnv_phb4_pec_get_phb_id(PnvPhb4PecState *pec, int stack_index); -PnvPhb4PecState *pnv_phb4_get_pec(PnvChip *chip, PnvPHB *phb, Error **errp= ); +PnvPhb4PecState *pnv_pec_add_phb(PnvChip *chip, PnvPHB *phb, Error **errp); void pnv_phb4_bus_init(DeviceState *dev, PnvPHB4 *phb); extern const MemoryRegionOps pnv_phb4_xscom_ops; =20 diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h index 96fb850419..409f3bf763 100644 --- a/include/hw/ppc/pnv.h +++ b/include/hw/ppc/pnv.h @@ -100,7 +100,7 @@ struct PnvMachineState { }; =20 PnvChip *pnv_get_chip(PnvMachineState *pnv, uint32_t chip_id); -Object *pnv_chip_add_phb(PnvChip *chip, PnvPHB *phb, Error **errp); +PnvChip *pnv_chip_add_phb(PnvChip *chip, PnvPHB *phb); =20 #define PNV_FDT_ADDR 0x01000000 #define PNV_TIMEBASE_FREQ 512000000ULL --=20 2.39.2