From nobody Sun May 19 05:00:02 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=1651950545; cv=none; d=zohomail.com; s=zohoarc; b=T52vzfbWq8657lOZr97f2SkabHIbEX7MUeIXDHFa+J/ytwPaya/NJdG/9fjk7ZQMqgNXIEn+hY0/rA1oEEI3I6wL0Jk8s1+1jgFpWGedvT7J6sNWVjMtR/5cxW1HoauXPQKnc1HtHi6i3VGC4nafQxYjpMS7+w9xP2URAemtWXA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651950545; 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=7IGWV3nomi2hRzL2w+japFtQez8lN0OWE2s3gRdwtpo=; b=Q+dqnXlovm3NVXuLja0P5fJZHVzJ32NWZF97KeHsRo8AJs4ce98DLWAr0/2mTk9BaeYf3Vz+7arndsA/VcjCTbqeNtXQSZqjKFnLikxSurB9WU5eg0agEwBjY4nA/lsNDruMA6ThX66P2txl7BpT680hi2waw3KPFDgd4rU6HZA= 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 1651950545852111.33106871156599; Sat, 7 May 2022 12:09:05 -0700 (PDT) Received: from localhost ([::1]:59456 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnPnc-0007XM-QW for importer@patchew.org; Sat, 07 May 2022 15:09:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54728) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnPlG-0004h2-53; Sat, 07 May 2022 15:06:38 -0400 Received: from mail-oa1-x29.google.com ([2001:4860:4864:20::29]:41520) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnPlE-0001XM-Gh; Sat, 07 May 2022 15:06:37 -0400 Received: by mail-oa1-x29.google.com with SMTP id 586e51a60fabf-edf9ddb312so9612740fac.8; Sat, 07 May 2022 12:06:35 -0700 (PDT) Received: from balboa.ibmmodules.com (201-1-57-208.dsl.telesp.net.br. [201.1.57.208]) by smtp.gmail.com with ESMTPSA id p1-20020a0568301d4100b0060603221270sm2907397oth.64.2022.05.07.12.06.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 May 2022 12:06:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7IGWV3nomi2hRzL2w+japFtQez8lN0OWE2s3gRdwtpo=; b=VanFztx6S/5XXK5SX6vDwCI0EnH6nYRBB4qv9mJtWAW5lM2K1LLNP4ch7fHkeeB7wV 085ulbHuFUB3VAF0bUyR1DiuuEQnrhsxkymazk8Gugo32tRebd9FaOMf88gWsJ4KhzvB azZWYP8YQOf6J916I8dO3i18W9a1fqQybrTtPZtUGEauNT33nNvMbIOEpLT+fjLXs7vc Ye1c+JsM6qN8i0lMS8vpQRcEh5G5NrqDJGbELsEU9E+dBcJ4fcVotVyOccaEfMxXKIC6 Fi8Nh5gt1zRz2mdW00wZxlI7Mk68QUy3YWDDaIZm/WrX8hX1eSRrK5eNvzJQJTfr5/UL +I5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7IGWV3nomi2hRzL2w+japFtQez8lN0OWE2s3gRdwtpo=; b=CNSQlFiTRdxoL3LF9hrcb+Ct4qIGPOrMkSe+j0KNJTyNSqU3jjXrL0oclQwmZ6zK4j MqrnK1sL2Y2mo+G4BjQSGAmGny5gzbci7SnTc9s1gB2BX+0l8ixEsq95fAhsML3InUSo 0e7t3Nq+7oQl0ZUm+rRQHR75AYOApCb82RODyBuRir5z+awBTb3qdZENI2d4Qp0MRuNK 226vgUlwLMsQ4hL4Nw+U3jrSyK/pt2PKzUBj4kDBqdEEIjBB4LURYByFO/4aMSV7tL1l qDST0klQXaxRVi6eAHptUBfyYKxsvKLQ/E+XKpvAZt2RaDAdhVQoMcCrs1P1AAnT1Eyz +O5Q== X-Gm-Message-State: AOAM532uyG09EHlCG3W6CgQGwvq+FntaCcHqw/BwGewPDBY91JwOViwy IFnIRfhXAgmlNy5NOjTq57EIXlUppGU= X-Google-Smtp-Source: ABdhPJwE3h2VYRoje/uIquzctSjzZEYCA5nr5N3QFceZKpSU0cFsP+vfRJu3zK+Z95Z3wj7Kd7iv1Q== X-Received: by 2002:a05:6870:3b85:b0:ee:4232:a0c3 with SMTP id gi5-20020a0568703b8500b000ee4232a0c3mr2654719oab.29.1651950394775; Sat, 07 May 2022 12:06:34 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, clg@kaod.org, fbarrat@linux.ibm.com, Daniel Henrique Barboza Subject: [PATCH 01/17] ppc/pnv: rename PnvPHB3.ioda* to PnvPHB3.ioda2* Date: Sat, 7 May 2022 16:06:08 -0300 Message-Id: <20220507190624.507419-2-danielhb413@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220507190624.507419-1-danielhb413@gmail.com> References: <20220507190624.507419-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=2001:4860:4864:20::29; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x29.google.com 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, 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, 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 @gmail.com) X-ZM-MESSAGEID: 1651950547905100001 Content-Type: text/plain; charset="utf-8" We're going to merge all the existing pnv-phb models into a single pnv-phb model. Users will be able to add phbs by using the same pnv-phb device, regardless of which powernv machine is being used, and internally we'll handle which PHB version the device needs to have. The unified pnv-phb model needs to be usable by the existing pnv_phb3 and pnv_phb4 code base. One way of accomplishing that is to merge PnvPHB3 and PnvPHB4 into a single PnvPHB struct. To do that we need to handle the cases where the same attribute might have different meaning/semantics depending on the version. One of these attributes is the 'ioda' arrays. This patch renames PnvPHB3.ioda* arrays to PnvPHB3.ioda2*. The reason why we're calling 'ioda2' is because PnvPHB3 uses IODA version 2. Signed-off-by: Daniel Henrique Barboza --- hw/pci-host/pnv_phb3.c | 18 +++++++++--------- include/hw/pci-host/pnv_phb3.h | 12 ++++++------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c index 3f03467dde..860f8846df 100644 --- a/hw/pci-host/pnv_phb3.c +++ b/hw/pci-host/pnv_phb3.c @@ -165,7 +165,7 @@ static void pnv_phb3_check_m64(PnvPHB3 *phb, uint32_t i= ndex) } =20 /* Get table entry */ - m64 =3D phb->ioda_M64BT[index]; + m64 =3D phb->ioda2_M64BT[index]; =20 if (!(m64 & IODA2_M64BT_ENABLE)) { return; @@ -215,7 +215,7 @@ static void pnv_phb3_lxivt_write(PnvPHB3 *phb, unsigned= idx, uint64_t val) { uint8_t server, prio; =20 - phb->ioda_LXIVT[idx] =3D val & (IODA2_LXIVT_SERVER | + phb->ioda2_LXIVT[idx] =3D val & (IODA2_LXIVT_SERVER | IODA2_LXIVT_PRIORITY | IODA2_LXIVT_NODE_ID); server =3D GETFIELD(IODA2_LXIVT_SERVER, val); @@ -241,11 +241,11 @@ static uint64_t *pnv_phb3_ioda_access(PnvPHB3 *phb, =20 switch (table) { case IODA2_TBL_LIST: - tptr =3D phb->ioda_LIST; + tptr =3D phb->ioda2_LIST; mask =3D 7; break; case IODA2_TBL_LXIVT: - tptr =3D phb->ioda_LXIVT; + tptr =3D phb->ioda2_LXIVT; mask =3D 7; break; case IODA2_TBL_IVC_CAM: @@ -263,7 +263,7 @@ static uint64_t *pnv_phb3_ioda_access(PnvPHB3 *phb, mask =3D 255; break; case IODA2_TBL_TVT: - tptr =3D phb->ioda_TVT; + tptr =3D phb->ioda2_TVT; mask =3D 511; break; case IODA2_TBL_TCAM: @@ -271,15 +271,15 @@ static uint64_t *pnv_phb3_ioda_access(PnvPHB3 *phb, mask =3D 63; break; case IODA2_TBL_M64BT: - tptr =3D phb->ioda_M64BT; + tptr =3D phb->ioda2_M64BT; mask =3D 15; break; case IODA2_TBL_M32DT: - tptr =3D phb->ioda_MDT; + tptr =3D phb->ioda2_MDT; mask =3D 255; break; case IODA2_TBL_PEEV: - tptr =3D phb->ioda_PEEV; + tptr =3D phb->ioda2_PEEV; mask =3D 3; break; default: @@ -869,7 +869,7 @@ static IOMMUTLBEntry pnv_phb3_translate_iommu(IOMMUMemo= ryRegion *iommu, } /* Choose TVE XXX Use PHB3 Control Register */ tve_sel =3D (addr >> 59) & 1; - tve =3D ds->phb->ioda_TVT[ds->pe_num * 2 + tve_sel]; + tve =3D ds->phb->ioda2_TVT[ds->pe_num * 2 + tve_sel]; pnv_phb3_translate_tve(ds, addr, flag & IOMMU_WO, tve, &ret); break; case 01: diff --git a/include/hw/pci-host/pnv_phb3.h b/include/hw/pci-host/pnv_phb3.h index af6ec83cf6..73da31fbd2 100644 --- a/include/hw/pci-host/pnv_phb3.h +++ b/include/hw/pci-host/pnv_phb3.h @@ -141,12 +141,12 @@ struct PnvPHB3 { MemoryRegion pci_mmio; MemoryRegion pci_io; =20 - uint64_t ioda_LIST[8]; - uint64_t ioda_LXIVT[8]; - uint64_t ioda_TVT[512]; - uint64_t ioda_M64BT[16]; - uint64_t ioda_MDT[256]; - uint64_t ioda_PEEV[4]; + uint64_t ioda2_LIST[8]; + uint64_t ioda2_LXIVT[8]; + uint64_t ioda2_TVT[512]; + uint64_t ioda2_M64BT[16]; + uint64_t ioda2_MDT[256]; + uint64_t ioda2_PEEV[4]; =20 uint32_t total_irq; ICSState lsis; --=20 2.32.0 From nobody Sun May 19 05:00:02 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=1651950741; cv=none; d=zohomail.com; s=zohoarc; b=McwTJ1E8g+fk/3Y91u9PAFAbnjUIMXWGhVJVGmcHpJXIbtP28QyH/ludJEnEJNqeHeenKd1gqUftzcw7QgWhtJ5gs7x1dwpFZ9YT+LCa/XxAIiL9RvAzbw2d2Cqv2KT4mexRCKwAWVSt6/bbM19f3lKUa9tw2fuIQGIuQM5A05M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651950741; 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=6P23p6FAimkXNsBW+WQzIt8dc/hF9eVgZPNlKok1Qsg=; b=jlve1XZAXRIMEOMLhaSnDD1n+pG2m0rAeRNriq8Bpt8tDCjIxomMt0ueH68h2ojJMzqTOX9tOGiPByOi3E1T+yG1jq64KTO1qR6k07TttcVxI+JyAhEZEPmAf55URYgol8jq/qkjYw4U1CY1INeuyqzFc4GIetT5hNd1YyN2wgU= 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 1651950741934892.1324369005005; Sat, 7 May 2022 12:12:21 -0700 (PDT) Received: from localhost ([::1]:39594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnPqm-0004oC-MV for importer@patchew.org; Sat, 07 May 2022 15:12:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54742) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnPlI-0004nI-TY; Sat, 07 May 2022 15:06:41 -0400 Received: from mail-oi1-x22c.google.com ([2607:f8b0:4864:20::22c]:41934) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnPlG-0001Xa-Tt; Sat, 07 May 2022 15:06:40 -0400 Received: by mail-oi1-x22c.google.com with SMTP id e189so11090614oia.8; Sat, 07 May 2022 12:06:38 -0700 (PDT) Received: from balboa.ibmmodules.com (201-1-57-208.dsl.telesp.net.br. [201.1.57.208]) by smtp.gmail.com with ESMTPSA id p1-20020a0568301d4100b0060603221270sm2907397oth.64.2022.05.07.12.06.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 May 2022 12:06:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6P23p6FAimkXNsBW+WQzIt8dc/hF9eVgZPNlKok1Qsg=; b=GLjq98jJKySDfsT+I4DEejnJp483/r3QUPzIcHv4SvVt3jJKIhf3Dc32r/z1S7PfUk bDMNNJL35eh5STR0qGL2oa8NrkTzMRcT9eLnz7C4YQfMyqOqwN7YaDVQaZmR4bFHIPTM tHUqVsda1lnSCLo1FrBNdePHG+m+WlDG03HBFMZeyPHp7vj0bfFNNrg5yL4aWknV3Wvh 7Youa1u3YMd20kMwKhyD6P98S3ncQjmZnmpYwp1QG3cQ19RlP6A2WKELjibaPXBEfF/0 JOeePo61j0IP1m5ZkkN7BcTMeeImuzI7Rn2igi/2SDr8khw+kgvEn+DjNlBQLIRD7uOe feTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6P23p6FAimkXNsBW+WQzIt8dc/hF9eVgZPNlKok1Qsg=; b=ErGsHPY/iU0uuQBKG2/jwdmzoy7OxCVcVlwT7yDjtkodQpH3EqQBn4EGmQUOxyMQxY MvfGl8KJ29fPwcMIimBlVdmuGRAvXAq/PYqi7kZPFkmHxpfoEf7UsepJMBl3W8yxGEgH 8UkL6HYwNHFL63dks48KHs2sKQge7yJ/7V5ael3BRS3f1751QNe4Q8vkX+ZT+W9qbF5B T4SH2aZ8WZct3MzVecQmlZ340KQQ3Dbpu44NhRgAWr8pI1lzbZOuFI/vvtF1SNNjBDrN c0h+bl4B4ozvu1AoMcV395teFjUSKIDrWwyNv8D9MKNUUNhLThpgH1t0Tcn8S+po8iqZ 2lzg== X-Gm-Message-State: AOAM530DI1Qz/ABwK5ErIYO8zbcZlJaQzNPOFsYfUQDGlBa8nwEP9l85 nwxcXlRLbhCXy2o3MICj9nDM53YOpg0= X-Google-Smtp-Source: ABdhPJw9e+a0aKCk/DJDeZMr9nf/aMGErgj/tdZ+gMG8JNrzOxngyS1v3XtunMxSlj1El5f4pm62NA== X-Received: by 2002:a05:6808:1aac:b0:325:aa52:5d58 with SMTP id bm44-20020a0568081aac00b00325aa525d58mr7559714oib.279.1651950397044; Sat, 07 May 2022 12:06:37 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, clg@kaod.org, fbarrat@linux.ibm.com, Daniel Henrique Barboza Subject: [PATCH 02/17] ppc/pnv: rename PnvPHB3.regs[] to PnvPHB3.regs3[] Date: Sat, 7 May 2022 16:06:09 -0300 Message-Id: <20220507190624.507419-3-danielhb413@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220507190624.507419-1-danielhb413@gmail.com> References: <20220507190624.507419-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::22c; envelope-from=danielhb413@gmail.com; helo=mail-oi1-x22c.google.com 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, 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, 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 @gmail.com) X-ZM-MESSAGEID: 1651950744069100001 Content-Type: text/plain; charset="utf-8" Another redundancy between PnvPHB3 and PnvPHB4 that we should take care before merging all together in an unified model is the regs[] array. Rename the regs[] array used by the PHB3 code to 'regs3'. Signed-off-by: Daniel Henrique Barboza --- hw/pci-host/pnv_phb3.c | 54 +++++++++++++++++----------------- hw/pci-host/pnv_phb3_msi.c | 6 ++-- include/hw/pci-host/pnv_phb3.h | 4 +-- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c index 860f8846df..77ee2325be 100644 --- a/hw/pci-host/pnv_phb3.c +++ b/hw/pci-host/pnv_phb3.c @@ -27,7 +27,7 @@ static PCIDevice *pnv_phb3_find_cfg_dev(PnvPHB3 *phb) { PCIHostState *pci =3D PCI_HOST_BRIDGE(phb); - uint64_t addr =3D phb->regs[PHB_CONFIG_ADDRESS >> 3]; + uint64_t addr =3D phb->regs3[PHB_CONFIG_ADDRESS >> 3]; uint8_t bus, devfn; =20 if (!(addr >> 63)) { @@ -53,7 +53,7 @@ static void pnv_phb3_config_write(PnvPHB3 *phb, unsigned = off, if (!pdev) { return; } - cfg_addr =3D (phb->regs[PHB_CONFIG_ADDRESS >> 3] >> 32) & 0xffc; + cfg_addr =3D (phb->regs3[PHB_CONFIG_ADDRESS >> 3] >> 32) & 0xffc; cfg_addr |=3D off; limit =3D pci_config_size(pdev); if (limit <=3D cfg_addr) { @@ -89,7 +89,7 @@ static uint64_t pnv_phb3_config_read(PnvPHB3 *phb, unsign= ed off, if (!pdev) { return ~0ull; } - cfg_addr =3D (phb->regs[PHB_CONFIG_ADDRESS >> 3] >> 32) & 0xffc; + cfg_addr =3D (phb->regs3[PHB_CONFIG_ADDRESS >> 3] >> 32) & 0xffc; cfg_addr |=3D off; limit =3D pci_config_size(pdev); if (limit <=3D cfg_addr) { @@ -122,14 +122,14 @@ static void pnv_phb3_check_m32(PnvPHB3 *phb) memory_region_del_subregion(phb->mr_m32.container, &phb->mr_m32); } =20 - if (!(phb->regs[PHB_PHB3_CONFIG >> 3] & PHB_PHB3C_M32_EN)) { + if (!(phb->regs3[PHB_PHB3_CONFIG >> 3] & PHB_PHB3C_M32_EN)) { return; } =20 /* Grab geometry from registers */ - base =3D phb->regs[PHB_M32_BASE_ADDR >> 3]; - start =3D phb->regs[PHB_M32_START_ADDR >> 3]; - size =3D ~(phb->regs[PHB_M32_BASE_MASK >> 3] | 0xfffc000000000000ull) = + 1; + base =3D phb->regs3[PHB_M32_BASE_ADDR >> 3]; + start =3D phb->regs3[PHB_M32_START_ADDR >> 3]; + size =3D ~(phb->regs3[PHB_M32_BASE_MASK >> 3] | 0xfffc000000000000ull)= + 1; =20 /* Check if it matches an enabled MMIO region in the PBCQ */ if (memory_region_is_mapped(&pbcq->mmbar0) && @@ -179,7 +179,7 @@ static void pnv_phb3_check_m64(PnvPHB3 *phb, uint32_t i= ndex) size =3D GETFIELD(IODA2_M64BT_MASK, m64) << 20; size |=3D 0xfffc000000000000ull; size =3D ~size + 1; - start =3D base | (phb->regs[PHB_M64_UPPER_BITS >> 3]); + start =3D base | (phb->regs3[PHB_M64_UPPER_BITS >> 3]); =20 /* Check if it matches an enabled MMIO region in the PBCQ */ if (memory_region_is_mapped(&pbcq->mmbar0) && @@ -233,7 +233,7 @@ static void pnv_phb3_lxivt_write(PnvPHB3 *phb, unsigned= idx, uint64_t val) static uint64_t *pnv_phb3_ioda_access(PnvPHB3 *phb, unsigned *out_table, unsigned *out_i= dx) { - uint64_t adreg =3D phb->regs[PHB_IODA_ADDR >> 3]; + uint64_t adreg =3D phb->regs3[PHB_IODA_ADDR >> 3]; unsigned int index =3D GETFIELD(PHB_IODA_AD_TADR, adreg); unsigned int table =3D GETFIELD(PHB_IODA_AD_TSEL, adreg); unsigned int mask; @@ -300,7 +300,7 @@ static uint64_t *pnv_phb3_ioda_access(PnvPHB3 *phb, index =3D (index + 1) & mask; adreg =3D SETFIELD(PHB_IODA_AD_TADR, adreg, index); } - phb->regs[PHB_IODA_ADDR >> 3] =3D adreg; + phb->regs3[PHB_IODA_ADDR >> 3] =3D adreg; return tptr; } =20 @@ -364,7 +364,7 @@ void pnv_phb3_remap_irqs(PnvPHB3 *phb) } =20 /* Grab local LSI source ID */ - local =3D GETFIELD(PHB_LSI_SRC_ID, phb->regs[PHB_LSI_SOURCE_ID >> 3]) = << 3; + local =3D GETFIELD(PHB_LSI_SRC_ID, phb->regs3[PHB_LSI_SOURCE_ID >> 3])= << 3; =20 /* Grab global one and compare */ global =3D GETFIELD(PBCQ_NEST_LSI_SRC, @@ -412,7 +412,7 @@ static void pnv_phb3_lsi_src_id_write(PnvPHB3 *phb, uin= t64_t val) { /* Sanitize content */ val &=3D PHB_LSI_SRC_ID; - phb->regs[PHB_LSI_SOURCE_ID >> 3] =3D val; + phb->regs3[PHB_LSI_SOURCE_ID >> 3] =3D val; pnv_phb3_remap_irqs(phb); } =20 @@ -429,7 +429,7 @@ static void pnv_phb3_rtc_invalidate(PnvPHB3 *phb, uint6= 4_t val) =20 static void pnv_phb3_update_msi_regions(PnvPhb3DMASpace *ds) { - uint64_t cfg =3D ds->phb->regs[PHB_PHB3_CONFIG >> 3]; + uint64_t cfg =3D ds->phb->regs3[PHB_PHB3_CONFIG >> 3]; =20 if (cfg & PHB_PHB3C_32BIT_MSI_EN) { if (!memory_region_is_mapped(&ds->msi32_mr)) { @@ -501,16 +501,16 @@ void pnv_phb3_reg_write(void *opaque, hwaddr off, uin= t64_t val, unsigned size) break; /* LEM stuff */ case PHB_LEM_FIR_AND_MASK: - phb->regs[PHB_LEM_FIR_ACCUM >> 3] &=3D val; + phb->regs3[PHB_LEM_FIR_ACCUM >> 3] &=3D val; return; case PHB_LEM_FIR_OR_MASK: - phb->regs[PHB_LEM_FIR_ACCUM >> 3] |=3D val; + phb->regs3[PHB_LEM_FIR_ACCUM >> 3] |=3D val; return; case PHB_LEM_ERROR_AND_MASK: - phb->regs[PHB_LEM_ERROR_MASK >> 3] &=3D val; + phb->regs3[PHB_LEM_ERROR_MASK >> 3] &=3D val; return; case PHB_LEM_ERROR_OR_MASK: - phb->regs[PHB_LEM_ERROR_MASK >> 3] |=3D val; + phb->regs3[PHB_LEM_ERROR_MASK >> 3] |=3D val; return; case PHB_LEM_WOF: val =3D 0; @@ -518,10 +518,10 @@ void pnv_phb3_reg_write(void *opaque, hwaddr off, uin= t64_t val, unsigned size) } =20 /* Record whether it changed */ - changed =3D phb->regs[off >> 3] !=3D val; + changed =3D phb->regs3[off >> 3] !=3D val; =20 /* Store in register cache first */ - phb->regs[off >> 3] =3D val; + phb->regs3[off >> 3] =3D val; =20 /* Handle side effects */ switch (off) { @@ -605,7 +605,7 @@ uint64_t pnv_phb3_reg_read(void *opaque, hwaddr off, un= signed size) } =20 /* Default read from cache */ - val =3D phb->regs[off >> 3]; + val =3D phb->regs3[off >> 3]; =20 switch (off) { /* Simulate venice DD2.0 */ @@ -628,7 +628,7 @@ uint64_t pnv_phb3_reg_read(void *opaque, hwaddr off, un= signed size) /* FFI Lock */ case PHB_FFI_LOCK: /* Set lock and return previous value */ - phb->regs[off >> 3] |=3D PHB_FFI_LOCK_STATE; + phb->regs3[off >> 3] |=3D PHB_FFI_LOCK_STATE; return val; =20 /* DMA read sync: make it look like it's complete */ @@ -704,7 +704,7 @@ static bool pnv_phb3_resolve_pe(PnvPhb3DMASpace *ds) } =20 /* We need to lookup the RTT */ - rtt =3D ds->phb->regs[PHB_RTT_BAR >> 3]; + rtt =3D ds->phb->regs3[PHB_RTT_BAR >> 3]; if (!(rtt & PHB_RTT_BAR_ENABLE)) { phb3_error(ds->phb, "DMA with RTT BAR disabled !"); /* Set error bits ? fence ? ... */ @@ -861,7 +861,7 @@ static IOMMUTLBEntry pnv_phb3_translate_iommu(IOMMUMemo= ryRegion *iommu, switch (addr >> 60) { case 00: /* DMA or 32-bit MSI ? */ - cfg =3D ds->phb->regs[PHB_PHB3_CONFIG >> 3]; + cfg =3D ds->phb->regs3[PHB_PHB3_CONFIG >> 3]; if ((cfg & PHB_PHB3C_32BIT_MSI_EN) && ((addr & 0xffffffffffff0000ull) =3D=3D 0xffff0000ull)) { phb3_error(phb, "xlate on 32-bit MSI region"); @@ -1032,7 +1032,7 @@ static void pnv_phb3_realize(DeviceState *dev, Error = **errp) } =20 /* Controller Registers */ - memory_region_init_io(&phb->mr_regs, OBJECT(phb), &pnv_phb3_reg_ops, p= hb, + memory_region_init_io(&phb->mr_regs3, OBJECT(phb), &pnv_phb3_reg_ops, = phb, "phb3-regs", 0x1000); =20 /* @@ -1060,14 +1060,14 @@ void pnv_phb3_update_regions(PnvPHB3 *phb) PnvPBCQState *pbcq =3D &phb->pbcq; =20 /* Unmap first always */ - if (memory_region_is_mapped(&phb->mr_regs)) { - memory_region_del_subregion(&pbcq->phbbar, &phb->mr_regs); + if (memory_region_is_mapped(&phb->mr_regs3)) { + memory_region_del_subregion(&pbcq->phbbar, &phb->mr_regs3); } =20 /* Map registers if enabled */ if (memory_region_is_mapped(&pbcq->phbbar)) { /* TODO: We should use the PHB BAR 2 register but we don't ... */ - memory_region_add_subregion(&pbcq->phbbar, 0, &phb->mr_regs); + memory_region_add_subregion(&pbcq->phbbar, 0, &phb->mr_regs3); } =20 /* Check/update m32 */ diff --git a/hw/pci-host/pnv_phb3_msi.c b/hw/pci-host/pnv_phb3_msi.c index 2f4112907b..d8534376f8 100644 --- a/hw/pci-host/pnv_phb3_msi.c +++ b/hw/pci-host/pnv_phb3_msi.c @@ -20,8 +20,8 @@ =20 static uint64_t phb3_msi_ive_addr(PnvPHB3 *phb, int srcno) { - uint64_t ivtbar =3D phb->regs[PHB_IVT_BAR >> 3]; - uint64_t phbctl =3D phb->regs[PHB_CONTROL >> 3]; + uint64_t ivtbar =3D phb->regs3[PHB_IVT_BAR >> 3]; + uint64_t phbctl =3D phb->regs3[PHB_CONTROL >> 3]; =20 if (!(ivtbar & PHB_IVT_BAR_ENABLE)) { qemu_log_mask(LOG_GUEST_ERROR, "Failed access to disable IVT BAR != "); @@ -188,7 +188,7 @@ void pnv_phb3_msi_ffi(Phb3MsiState *msi, uint64_t val) pnv_phb3_msi_send(msi, val, 0, -1); =20 /* Clear FFI lock */ - msi->phb->regs[PHB_FFI_LOCK >> 3] =3D 0; + msi->phb->regs3[PHB_FFI_LOCK >> 3] =3D 0; } =20 static void phb3_msi_reject(ICSState *ics, uint32_t nr) diff --git a/include/hw/pci-host/pnv_phb3.h b/include/hw/pci-host/pnv_phb3.h index 73da31fbd2..486dbbefee 100644 --- a/include/hw/pci-host/pnv_phb3.h +++ b/include/hw/pci-host/pnv_phb3.h @@ -133,8 +133,8 @@ struct PnvPHB3 { uint32_t phb_id; char bus_path[8]; =20 - uint64_t regs[PNV_PHB3_NUM_REGS]; - MemoryRegion mr_regs; + uint64_t regs3[PNV_PHB3_NUM_REGS]; + MemoryRegion mr_regs3; =20 MemoryRegion mr_m32; MemoryRegion mr_m64[PNV_PHB3_NUM_M64]; --=20 2.32.0 From nobody Sun May 19 05:00:02 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=1651950556; cv=none; d=zohomail.com; s=zohoarc; b=lPMbQTZ/NuQPoUs9R1vszixAF5Tp8PmnMwORob6fVgpwbbCdLudDTBMyF/oukXNW1rQagIcpr0jC6U9lS5Z+JW4Dk291V968DwoyTNYZniC9+o0ich2usI7dHq/h5LGe5t2EALV6gWaQtC6BK0O7cc4lI7I9vd8hs/soJ9RyTz8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651950556; 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=2fsBpqRRPOl8gqifPS+3uTgHpV11smNfVhP3WnzCOwA=; b=lkifKRqpCJ1X0oBWbqJxwX4Pzv6q/5I6aeKZHGYtopA42YIg6J3BdXkjAXJEj4tKhOtqilEishG4Bamn7eXStxgnfjVwke4rj9Rz8zu6UGF1ZskiIGLWXDxyupFxscQtCDfZbwCG7aU3VyZPuKKFhLDNZrDsgbCcLXqF218nomQ= 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 1651950556133554.5986495519303; Sat, 7 May 2022 12:09:16 -0700 (PDT) Received: from localhost ([::1]:60018 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnPnm-0007vW-SM for importer@patchew.org; Sat, 07 May 2022 15:09:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54756) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnPlK-0004rk-Hy; Sat, 07 May 2022 15:06:42 -0400 Received: from mail-oa1-x35.google.com ([2001:4860:4864:20::35]:46992) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnPlJ-0001Xm-02; Sat, 07 May 2022 15:06:42 -0400 Received: by mail-oa1-x35.google.com with SMTP id 586e51a60fabf-d39f741ba0so10527827fac.13; Sat, 07 May 2022 12:06:40 -0700 (PDT) Received: from balboa.ibmmodules.com (201-1-57-208.dsl.telesp.net.br. [201.1.57.208]) by smtp.gmail.com with ESMTPSA id p1-20020a0568301d4100b0060603221270sm2907397oth.64.2022.05.07.12.06.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 May 2022 12:06:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2fsBpqRRPOl8gqifPS+3uTgHpV11smNfVhP3WnzCOwA=; b=gjR5Qy6QBo+ACTk3sznyDvUrrGkOIk9n9JxwbdMJZdl8UmSfgfLd62qgbmkKlioE2a l0sSX7VLrH+/cxsS+6PZZtzcacFgiWTOp6crSRLP2Q8AODZgyQ+Z0RebVhc+SHPc1rSO rYjDYBqDO/hOzyNVpVrg2vMA8bnswyHpHg6eqnu9IR3xK0WHe29ZUSuLmKHjdZ80Dhiz aRZfRBp8LS4Ql+JtEUChnW19Aho7+52876ge3SWGdtpk0wrHa8uqo557hXNgWXF/krbL 0R0t0EJWutc4cf6FSFHeAGg4txx+QYoVpbBpiPs7l1HDiwEo/xY4lGe82XEoEqiFD88W PLvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2fsBpqRRPOl8gqifPS+3uTgHpV11smNfVhP3WnzCOwA=; b=1Me4O6GJ74wSNDmtYKCdSj7Rkiv4vwkhQ8L3+8kfPEfCkPDut667GJ38wThK3MHw7g 31iiKAivlbLmJizD88nMW0AiAwF6cAA/LctcMBfj1egicsSMIr5dxknPAHcbkvgXzajJ vIiEgAgqHq6lWpD1gVwxyV/suHLht/kuoombs58ZE06/iQ95Uw8gdOOvdvOkg3AIX8Tn fv5nloiMDVji4acQ9ZWdCOLV/aipVOlcHa7fEsFjga8g1wxs8CFBEro/GBSmDv9k2IrP ahgAzDv6u2msC6Lerj73LPAm+pwk8YydEMnOHHB6XiDqHfdbnHHpd5FLARph6P2Xm5MK 41pw== X-Gm-Message-State: AOAM531K+tP/b38aaxGHK7SDt2dLJBjrLeeTN5kM+TOXT0Hkl7Cm6INT qARS3QgzHqv4khZyCuMs2WKqBclkcxU= X-Google-Smtp-Source: ABdhPJx2M5lG3LkUjb3sBu9mmVyqazbWnhPL4QtEtl1qtfPh7veVyIl3V6W8ejAeOJL1jJRroWU9Qw== X-Received: by 2002:a05:6870:b490:b0:ed:9a21:3983 with SMTP id y16-20020a056870b49000b000ed9a213983mr7065233oap.116.1651950399393; Sat, 07 May 2022 12:06:39 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, clg@kaod.org, fbarrat@linux.ibm.com, Daniel Henrique Barboza Subject: [PATCH 03/17] ppc/pnv: rename PnvPHB3.dma_spaces to PnvPHB3.v3_dma_spaces Date: Sat, 7 May 2022 16:06:10 -0300 Message-Id: <20220507190624.507419-4-danielhb413@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220507190624.507419-1-danielhb413@gmail.com> References: <20220507190624.507419-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=2001:4860:4864:20::35; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x35.google.com 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, 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, 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 @gmail.com) X-ZM-MESSAGEID: 1651950557629100001 Content-Type: text/plain; charset="utf-8" The last common attribute that has a different meaning/semantic between PnvPHB3 and PnvPHB4 devices is the 'dma_spaces' QLIST. Rename the PHB3 version to 'v3_dma_spaces'. The reason why we chose that instead of 'dma3_spaces' or similar is to avoid any misunderstanding about this being related to DMA version 3. Signed-off-by: Daniel Henrique Barboza --- hw/pci-host/pnv_phb3.c | 10 +++++----- include/hw/pci-host/pnv_phb3.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c index 77ee2325be..70d92edd94 100644 --- a/hw/pci-host/pnv_phb3.c +++ b/hw/pci-host/pnv_phb3.c @@ -421,7 +421,7 @@ static void pnv_phb3_rtc_invalidate(PnvPHB3 *phb, uint6= 4_t val) PnvPhb3DMASpace *ds; =20 /* Always invalidate all for now ... */ - QLIST_FOREACH(ds, &phb->dma_spaces, list) { + QLIST_FOREACH(ds, &phb->v3_dma_spaces, list) { ds->pe_num =3D PHB_INVALID_PE; } } @@ -460,7 +460,7 @@ static void pnv_phb3_update_all_msi_regions(PnvPHB3 *ph= b) { PnvPhb3DMASpace *ds; =20 - QLIST_FOREACH(ds, &phb->dma_spaces, list) { + QLIST_FOREACH(ds, &phb->v3_dma_spaces, list) { pnv_phb3_update_msi_regions(ds); } } @@ -938,7 +938,7 @@ static AddressSpace *pnv_phb3_dma_iommu(PCIBus *bus, vo= id *opaque, int devfn) PnvPHB3 *phb =3D opaque; PnvPhb3DMASpace *ds; =20 - QLIST_FOREACH(ds, &phb->dma_spaces, list) { + QLIST_FOREACH(ds, &phb->v3_dma_spaces, list) { if (ds->bus =3D=3D bus && ds->devfn =3D=3D devfn) { break; } @@ -961,7 +961,7 @@ static AddressSpace *pnv_phb3_dma_iommu(PCIBus *bus, vo= id *opaque, int devfn) ds, "msi64", 0x100000); pnv_phb3_update_msi_regions(ds); =20 - QLIST_INSERT_HEAD(&phb->dma_spaces, ds, list); + QLIST_INSERT_HEAD(&phb->v3_dma_spaces, ds, list); } return &ds->dma_as; } @@ -970,7 +970,7 @@ static void pnv_phb3_instance_init(Object *obj) { PnvPHB3 *phb =3D PNV_PHB3(obj); =20 - QLIST_INIT(&phb->dma_spaces); + QLIST_INIT(&phb->v3_dma_spaces); =20 /* LSI sources */ object_initialize_child(obj, "lsi", &phb->lsis, TYPE_ICS); diff --git a/include/hw/pci-host/pnv_phb3.h b/include/hw/pci-host/pnv_phb3.h index 486dbbefee..35483e59c3 100644 --- a/include/hw/pci-host/pnv_phb3.h +++ b/include/hw/pci-host/pnv_phb3.h @@ -155,7 +155,7 @@ struct PnvPHB3 { =20 PnvPBCQState pbcq; =20 - QLIST_HEAD(, PnvPhb3DMASpace) dma_spaces; + QLIST_HEAD(, PnvPhb3DMASpace) v3_dma_spaces; =20 PnvChip *chip; }; --=20 2.32.0 From nobody Sun May 19 05:00:02 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=1651950573; cv=none; d=zohomail.com; s=zohoarc; b=cLcOvJ/h8iz4BUWQBBC7SNXx//8qpLjW4TPGllrhP1E4Bd2QLZEb3o/I7P+UHQQ90stzJEtPdNL6pM1mbsS1LYtecPrrO1BL48aBtRznmNF8CYyOHC1rtwY1zutKoQ0jIKJnQwZoRqcvYu3BihVwCzL8G3dSEyZtPVwVg0Gwcbo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651950573; 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=WNdXdxrL+6oruFfs4RMH79bNef2ZwDlHNs1lrvwqaXg=; b=G2trxwgkiJb5WSEHfYY/FtV6c59BhmyI6yYGiMl3VwkAnHffw/Jr4v2mwvWy9XqKTedaHMTqjcpDxVx/TcZkXeACj3aZ0nsbuczzenMvNPvdJIXx3Ec5a40lVz2YZOW3xHgFHPGd0bwHf5FkEC6f0xpVLMtPZnVhtbSaUbdwwBI= 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 1651950573395818.0402550297356; Sat, 7 May 2022 12:09:33 -0700 (PDT) Received: from localhost ([::1]:60814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnPo4-0008SF-A3 for importer@patchew.org; Sat, 07 May 2022 15:09:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54772) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnPlN-000507-6f; Sat, 07 May 2022 15:06:45 -0400 Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]:35617) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnPlL-0001Y0-7k; Sat, 07 May 2022 15:06:44 -0400 Received: by mail-ot1-x32b.google.com with SMTP id z5-20020a9d62c5000000b00606041d11f1so7238323otk.2; Sat, 07 May 2022 12:06:42 -0700 (PDT) Received: from balboa.ibmmodules.com (201-1-57-208.dsl.telesp.net.br. [201.1.57.208]) by smtp.gmail.com with ESMTPSA id p1-20020a0568301d4100b0060603221270sm2907397oth.64.2022.05.07.12.06.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 May 2022 12:06:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WNdXdxrL+6oruFfs4RMH79bNef2ZwDlHNs1lrvwqaXg=; b=LZjkVS0/Dzgy7awoWMYRRcPneiaaWb1wo1PHm257/lKOe5BzG4ZHCVmoXF6RCdhpQV q4WVuLDLV7r49rncaG53SkXD3aV6d/qkEBrbTjTQ9bc4o0amzTwixDY3pLWjh15YRAaC 3dTiwUtbiovyQ/9A4VQxdfXSbhxfzQUr+d0FkHTLGJ3uISNnQB2Tvrn9TcEYXykPc8J5 I/J+UfO+w0k78UK/LnMSbTgeAEDQ2EpAuhJJq3kbdbkt33Pbi6sIRzPjnx2qZA10DWGx qv6YbI5iuMfL0VP9Ifc2cMQF+kwOgoIvl4+Fckk1LPSuIZLr5y/Llo9PqxsCIticbpkZ JHgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WNdXdxrL+6oruFfs4RMH79bNef2ZwDlHNs1lrvwqaXg=; b=KOGKH5TVsRLGCQtGPrMGVzqRmXRwDj4rL76szzpluijBn/fUy6PUJWuwYqXybRu3TA lc9TIgLsN7iO4I7SS4s/eStPu8g5Y31I7PnHRPU20bN7/WRmHBbDpkpHgjVoI1kQaVa7 HY44+ZOIBUQMmsO8ZWgeMlclUexPrAwr+2MPm0Y3lnHEqNUWDxXtrwQgVxfdQPjdxrzR XZQpgLfzYqtG/4W2GB7XaTxjVnHzq2I5BOVjTl5YwX+jR8+BlGy507Fm+psO8JxDlCJX iyt+vf8sow6Vg/Ap4KM3FeO5GjXUUK81CsdKJSOKYX5gLkNLNkIaAmVv38IPlruPCuUp R6gA== X-Gm-Message-State: AOAM533sgZjTci0/iCeQ3ojcI76hY0Gz9EhFgh8cniPfM1tBYNK5QYtR f1U1l5yDyGSvYC11Wm5FMI1ft2vXTAg= X-Google-Smtp-Source: ABdhPJy7ZGGgkwYCobeq73Ygx2YrKgnSdJu49MJXYrotvLstCUm6N85eQztrJbz8zSefP9cWzbNlYA== X-Received: by 2002:a9d:58c3:0:b0:605:9fa7:f5b6 with SMTP id s3-20020a9d58c3000000b006059fa7f5b6mr3167019oth.230.1651950401678; Sat, 07 May 2022 12:06:41 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, clg@kaod.org, fbarrat@linux.ibm.com, Daniel Henrique Barboza Subject: [PATCH 04/17] ppc/pnv: add unified pnv-phb header Date: Sat, 7 May 2022 16:06:11 -0300 Message-Id: <20220507190624.507419-5-danielhb413@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220507190624.507419-1-danielhb413@gmail.com> References: <20220507190624.507419-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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, 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 @gmail.com) X-ZM-MESSAGEID: 1651950575456100001 Content-Type: text/plain; charset="utf-8" This patch adds the pnv_phb.h header with the declarations we're going to use in this soon to be added device. It consists of an union between all attributes of PnvPHB3 and PnvPHB4 devices. This will allow for the same PnvPHB device to be used for PHB3 and PHB4 code. Some struct definitions from PnvPHB3 had to be moved to the new header due to scope constraints. Signed-off-by: Daniel Henrique Barboza --- include/hw/pci-host/pnv_phb.h | 211 +++++++++++++++++++++++++++++++++ include/hw/pci-host/pnv_phb3.h | 65 +--------- 2 files changed, 212 insertions(+), 64 deletions(-) create mode 100644 include/hw/pci-host/pnv_phb.h diff --git a/include/hw/pci-host/pnv_phb.h b/include/hw/pci-host/pnv_phb.h new file mode 100644 index 0000000000..2a8bf9a66d --- /dev/null +++ b/include/hw/pci-host/pnv_phb.h @@ -0,0 +1,211 @@ +/* + * QEMU PowerPC PowerNV Unified PHB model + * + * Copyright (c) 2022, IBM Corporation. + * + * This code is licensed under the GPL version 2 or later. See the + * COPYING file in the top-level directory. + */ + +#ifndef PCI_HOST_PNV_PHB_H +#define PCI_HOST_PNV_PHB_H + +#include "hw/pci/pcie_host.h" +#include "hw/pci/pcie_port.h" +#include "hw/ppc/xics.h" +#include "hw/ppc/xive.h" +#include "qom/object.h" + +/* pnv_phb3.h types */ +#define PNV_PHB3_NUM_M64 16 +#define PNV_PHB3_NUM_REGS (0x1000 >> 3) +#define PHB3_MAX_MSI 2048 + +typedef struct PnvPHB3 PnvPHB3; +typedef struct PnvChip PnvChip; + +typedef struct Phb3MsiState { + ICSState ics; + qemu_irq *qirqs; + + PnvPHB3 *phb; + uint64_t rba[PHB3_MAX_MSI / 64]; + uint32_t rba_sum; +} Phb3MsiState; + +typedef struct PnvPBCQState { + DeviceState parent; + + uint32_t nest_xbase; + uint32_t spci_xbase; + uint32_t pci_xbase; +#define PBCQ_NEST_REGS_COUNT 0x46 +#define PBCQ_PCI_REGS_COUNT 0x15 +#define PBCQ_SPCI_REGS_COUNT 0x5 + + uint64_t nest_regs[PBCQ_NEST_REGS_COUNT]; + uint64_t spci_regs[PBCQ_SPCI_REGS_COUNT]; + uint64_t pci_regs[PBCQ_PCI_REGS_COUNT]; + MemoryRegion mmbar0; + MemoryRegion mmbar1; + MemoryRegion phbbar; + uint64_t mmio0_base; + uint64_t mmio0_size; + uint64_t mmio1_base; + uint64_t mmio1_size; + PnvPHB3 *phb; + + MemoryRegion xscom_nest_regs; + MemoryRegion xscom_pci_regs; + MemoryRegion xscom_spci_regs; +} PnvPBCQState; + +/* + * We have one such address space wrapper per possible device under + * the PHB since they need to be assigned statically at qemu device + * creation time. The relationship to a PE is done later dynamically. + * This means we can potentially create a lot of these guys. Q35 + * stores them as some kind of radix tree but we never really need to + * do fast lookups so instead we simply keep a QLIST of them for now, + * we can add the radix if needed later on. + * + * We do cache the PE number to speed things up a bit though. + */ +typedef struct PnvPhb3DMASpace { + PCIBus *bus; + uint8_t devfn; + int pe_num; /* Cached PE number */ +#define PHB_INVALID_PE (-1) + PnvPHB3 *phb; + AddressSpace dma_as; + IOMMUMemoryRegion dma_mr; + MemoryRegion msi32_mr; + MemoryRegion msi64_mr; + QLIST_ENTRY(PnvPhb3DMASpace) list; +} PnvPhb3DMASpace; + +/* pnv_phb4.h types */ +#define PNV_PHB4_MAX_LSIs 8 +#define PNV_PHB4_MAX_INTs 4096 +#define PNV_PHB4_MAX_MIST (PNV_PHB4_MAX_INTs >> 2) +#define PNV_PHB4_MAX_MMIO_WINDOWS 32 +#define PNV_PHB4_MIN_MMIO_WINDOWS 16 +#define PNV_PHB4_NUM_REGS (0x3000 >> 3) +#define PNV_PHB4_MAX_PEs 512 +#define PNV_PHB4_MAX_TVEs (PNV_PHB4_MAX_PEs * 2) +#define PNV_PHB4_MAX_PEEVs (PNV_PHB4_MAX_PEs / 64) +#define PNV_PHB4_MAX_MBEs (PNV_PHB4_MAX_MMIO_WINDOWS * 2) +typedef struct PnvPhb4PecState PnvPhb4PecState; + +/* + * Unified PHB PCIe Host Bridge for PowerNV machines + */ +typedef struct PnvPHB PnvPHB; +#define TYPE_PNV_PHB "pnv-phb" +OBJECT_DECLARE_SIMPLE_TYPE(PnvPHB, PNV_PHB) + +struct PnvPHB { + PCIExpressHost parent_obj; + + uint32_t chip_id; + uint32_t phb_id; + char bus_path[8]; + MemoryRegion pci_mmio; + MemoryRegion pci_io; + qemu_irq *qirqs; + + /* + * PnvPHB3 attributes + */ + uint64_t regs3[PNV_PHB3_NUM_REGS]; + MemoryRegion mr_regs3; + + MemoryRegion mr_m32; + MemoryRegion mr_m64[PNV_PHB3_NUM_M64]; + + uint64_t ioda2_LIST[8]; + uint64_t ioda2_LXIVT[8]; + uint64_t ioda2_TVT[512]; + uint64_t ioda2_M64BT[16]; + uint64_t ioda2_MDT[256]; + uint64_t ioda2_PEEV[4]; + + uint32_t total_irq; + ICSState lsis; + Phb3MsiState msis; + + PnvPBCQState pbcq; + + QLIST_HEAD(, PnvPhb3DMASpace) v3_dma_spaces; + + PnvChip *chip; + + /* + * PnvPHB4 attributes + */ + uint64_t version; + + /* The owner PEC */ + PnvPhb4PecState *pec; + + /* Main register images */ + uint64_t regs[PNV_PHB4_NUM_REGS]; + MemoryRegion mr_regs; + + /* Extra SCOM-only register */ + uint64_t scom_hv_ind_addr_reg; + + /* + * Geometry of the PHB. There are two types, small and big PHBs, a + * number of resources (number of PEs, windows etc...) are doubled + * for a big PHB + */ + bool big_phb; + + /* Memory regions for MMIO space */ + MemoryRegion mr_mmio[PNV_PHB4_MAX_MMIO_WINDOWS]; + + /* PCI registers (excluding pass-through) */ +#define PHB4_PEC_PCI_STK_REGS_COUNT 0xf + uint64_t pci_regs[PHB4_PEC_PCI_STK_REGS_COUNT]; + MemoryRegion pci_regs_mr; + + /* Nest registers */ +#define PHB4_PEC_NEST_STK_REGS_COUNT 0x17 + uint64_t nest_regs[PHB4_PEC_NEST_STK_REGS_COUNT]; + MemoryRegion nest_regs_mr; + + /* PHB pass-through XSCOM */ + MemoryRegion phb_regs_mr; + + /* Memory windows from PowerBus to PHB */ + MemoryRegion phbbar; + MemoryRegion intbar; + MemoryRegion mmbar0; + MemoryRegion mmbar1; + uint64_t mmio0_base; + uint64_t mmio0_size; + uint64_t mmio1_base; + uint64_t mmio1_size; + + /* On-chip IODA tables */ + uint64_t ioda_LIST[PNV_PHB4_MAX_LSIs]; + uint64_t ioda_MIST[PNV_PHB4_MAX_MIST]; + uint64_t ioda_TVT[PNV_PHB4_MAX_TVEs]; + uint64_t ioda_MBT[PNV_PHB4_MAX_MBEs]; + uint64_t ioda_MDT[PNV_PHB4_MAX_PEs]; + uint64_t ioda_PEEV[PNV_PHB4_MAX_PEEVs]; + + /* + * The internal PESTA/B is 2 bits per PE split into two tables, we + * store them in a single array here to avoid wasting space. + */ + uint8_t ioda_PEST_AB[PNV_PHB4_MAX_PEs]; + + /* P9 Interrupt generation */ + XiveSource xsrc; + + QLIST_HEAD(, PnvPhb4DMASpace) dma_spaces; +}; + +#endif /* PCI_HOST_PNV_PHB_H */ diff --git a/include/hw/pci-host/pnv_phb3.h b/include/hw/pci-host/pnv_phb3.h index 35483e59c3..b6b5f91684 100644 --- a/include/hw/pci-host/pnv_phb3.h +++ b/include/hw/pci-host/pnv_phb3.h @@ -12,6 +12,7 @@ =20 #include "hw/pci/pcie_host.h" #include "hw/pci/pcie_port.h" +#include "hw/pci-host/pnv_phb.h" #include "hw/ppc/xics.h" #include "qom/object.h" =20 @@ -22,21 +23,9 @@ typedef struct PnvChip PnvChip; * PHB3 XICS Source for MSIs */ #define TYPE_PHB3_MSI "phb3-msi" -typedef struct Phb3MsiState Phb3MsiState; DECLARE_INSTANCE_CHECKER(Phb3MsiState, PHB3_MSI, TYPE_PHB3_MSI) =20 -#define PHB3_MAX_MSI 2048 - -struct Phb3MsiState { - ICSState ics; - qemu_irq *qirqs; - - PnvPHB3 *phb; - uint64_t rba[PHB3_MAX_MSI / 64]; - uint32_t rba_sum; -}; - void pnv_phb3_msi_update_config(Phb3MsiState *msis, uint32_t base, uint32_t count); void pnv_phb3_msi_send(Phb3MsiState *msis, uint64_t addr, uint16_t data, @@ -44,64 +33,12 @@ void pnv_phb3_msi_send(Phb3MsiState *msis, uint64_t add= r, uint16_t data, void pnv_phb3_msi_ffi(Phb3MsiState *msis, uint64_t val); void pnv_phb3_msi_pic_print_info(Phb3MsiState *msis, Monitor *mon); =20 - -/* - * We have one such address space wrapper per possible device under - * the PHB since they need to be assigned statically at qemu device - * creation time. The relationship to a PE is done later dynamically. - * This means we can potentially create a lot of these guys. Q35 - * stores them as some kind of radix tree but we never really need to - * do fast lookups so instead we simply keep a QLIST of them for now, - * we can add the radix if needed later on. - * - * We do cache the PE number to speed things up a bit though. - */ -typedef struct PnvPhb3DMASpace { - PCIBus *bus; - uint8_t devfn; - int pe_num; /* Cached PE number */ -#define PHB_INVALID_PE (-1) - PnvPHB3 *phb; - AddressSpace dma_as; - IOMMUMemoryRegion dma_mr; - MemoryRegion msi32_mr; - MemoryRegion msi64_mr; - QLIST_ENTRY(PnvPhb3DMASpace) list; -} PnvPhb3DMASpace; - /* * PHB3 Power Bus Common Queue */ #define TYPE_PNV_PBCQ "pnv-pbcq" OBJECT_DECLARE_SIMPLE_TYPE(PnvPBCQState, PNV_PBCQ) =20 -struct PnvPBCQState { - DeviceState parent; - - uint32_t nest_xbase; - uint32_t spci_xbase; - uint32_t pci_xbase; -#define PBCQ_NEST_REGS_COUNT 0x46 -#define PBCQ_PCI_REGS_COUNT 0x15 -#define PBCQ_SPCI_REGS_COUNT 0x5 - - uint64_t nest_regs[PBCQ_NEST_REGS_COUNT]; - uint64_t spci_regs[PBCQ_SPCI_REGS_COUNT]; - uint64_t pci_regs[PBCQ_PCI_REGS_COUNT]; - MemoryRegion mmbar0; - MemoryRegion mmbar1; - MemoryRegion phbbar; - uint64_t mmio0_base; - uint64_t mmio0_size; - uint64_t mmio1_base; - uint64_t mmio1_size; - PnvPHB3 *phb; - - MemoryRegion xscom_nest_regs; - MemoryRegion xscom_pci_regs; - MemoryRegion xscom_spci_regs; -}; - /* * PHB3 PCIe Root port */ --=20 2.32.0 From nobody Sun May 19 05:00:02 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=1651950749; cv=none; d=zohomail.com; s=zohoarc; b=TJkt5sMg+RwTVFXbKcZCy9mAEQ+5Wu5shRAV2F+8PwO9OqDbI2fclkxfepoqVV0BIxIYOjObXnIUYwNxGQAOCxhLU+lNdxnR2VOd8MWP/0m982s1yvCwrw7TXFZtU3DHxiMD3KYQKlIsaDXt5vK5Sqcnj1CdjWN41TJTEsR58Nk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651950749; 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=dpaTjFiYrghI3JitsDctayMbtGiCYEaddztQT51dquM=; b=HCQfUIlkPkF9tpLHrt+oWRoeGhZazcBZCm2MTUeuwa138PPG4W+bk1/BxNeaBD29x0bECQzrGfJpKSs58H96LUUKnZ3RZ7LCVXv82jkB4K2Rk3pqU5EERGavmU+/wIVWzWxLOdQWGsbB2KAqGXc12KCQo+G9MfPxjchrsB6kioM= 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 165195074964438.443719345257364; Sat, 7 May 2022 12:12:29 -0700 (PDT) Received: from localhost ([::1]:40408 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnPqu-0005LP-KY for importer@patchew.org; Sat, 07 May 2022 15:12:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54786) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnPlP-00059O-EL; Sat, 07 May 2022 15:06:47 -0400 Received: from mail-oo1-xc31.google.com ([2607:f8b0:4864:20::c31]:44598) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnPlN-0001YN-LO; Sat, 07 May 2022 15:06:47 -0400 Received: by mail-oo1-xc31.google.com with SMTP id o10-20020a4abe8a000000b0035eac0a004aso1831427oop.11; Sat, 07 May 2022 12:06:45 -0700 (PDT) Received: from balboa.ibmmodules.com (201-1-57-208.dsl.telesp.net.br. [201.1.57.208]) by smtp.gmail.com with ESMTPSA id p1-20020a0568301d4100b0060603221270sm2907397oth.64.2022.05.07.12.06.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 May 2022 12:06:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dpaTjFiYrghI3JitsDctayMbtGiCYEaddztQT51dquM=; b=fNVECFjzwy50cehAI/MVQ0ERPNUt5DVwEWOtTWevHGEYQJWZfEupf6rpJGVuULOu9t 4wlcVyEToTlrNFu25nXLXMMxIFPUkuAs37DSSicusLKD8kiWMWzbAdFV+Fu6eScOUnaR brN6FuXgJEUwlBkAycHsjjj8rFKKxASzvuyGF60OTWWvUVW056bQkrBqpOvrhkJgHN0o 2aINRcLpgAOarPXnDYZFbViLPjuxGV2G1InKXOz3PlzDczjiDCFqcOU8lkv8Whci78NR 1M8tFox/cNcPmH+sXxC0lBi1Hk/xlrn4bQCv128AWuZi02b77mt6mYthOOpfeWlbaWIQ f9tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dpaTjFiYrghI3JitsDctayMbtGiCYEaddztQT51dquM=; b=WQyvLxMLxN2o1H3QHe3l1ID4t3K+WNei0krAFdwaSWqa3bfDqdgdCCj5YrHc7hT4yU Jq0QKMYWF8Mjgrtw+EdlNmGwYPNyOAWmzqogck3rp3z2LDKJg5/Y3xHYEySjX6vn9TKp n8DPWp6oXYUjfswp/pgfdsFIXMSotcZTYxRvHmi4Wr9jfh6HxszgNLZYe2RHI5Dtvx/o +b19z+dwsfR7K0OitOQTXEILVL+ORuDTqcvJiNydg9OpaMRuR+ibLTnbEKU9yxzBhY8I Q2Badpi0N8yxxjGO0YKp7IdtNqiiW5pdCtdEczkXgLP9fqXBMpDrYdK2j21J9WBebQsi 6FWQ== X-Gm-Message-State: AOAM530CWnBFbh8dWjcclKj6NqlHBQjM4l0gKChQp0h30n+QZhH7ARdv 8l8y5s3YOsk5CFksrLnuMi3QQrC/CwQ= X-Google-Smtp-Source: ABdhPJyJnH5XfOyx8DUxXZE3Ndr/TFL8+u33MxQA6A4d0t/Q9CG7aLoSwmUxrNLrL4MaxjKHT+ZFzA== X-Received: by 2002:a05:6820:1517:b0:35f:5a69:8cc0 with SMTP id ay23-20020a056820151700b0035f5a698cc0mr2498903oob.72.1651950404196; Sat, 07 May 2022 12:06:44 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, clg@kaod.org, fbarrat@linux.ibm.com, Daniel Henrique Barboza Subject: [PATCH 05/17] ppc/pnv: add pnv-phb device Date: Sat, 7 May 2022 16:06:12 -0300 Message-Id: <20220507190624.507419-6-danielhb413@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220507190624.507419-1-danielhb413@gmail.com> References: <20220507190624.507419-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::c31; envelope-from=danielhb413@gmail.com; helo=mail-oo1-xc31.google.com 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, 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, 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 @gmail.com) X-ZM-MESSAGEID: 1651950750072100001 Content-Type: text/plain; charset="utf-8" This device works as a generic pnv-phb that redirects the control flow to one of the implemented PHB versions (PHB3 and PHB4 at this moment). The control redirection happens in the instance_init() and realize() callbacks, where we check which powernv machine we're running and execute the PnvPHB3 callbacks if running powernv8 or PnvPHB4 if running powernv9/10. This will allow us to keep the existing PHB3 and PHB4 code as is, just changing their device type to PnvPHB3/PnvPHB4 to PnvPHB when we're ready. For now we're putting logic to handle the PHB3 version. We'll add PHB4 later on. Signed-off-by: Daniel Henrique Barboza --- hw/pci-host/meson.build | 3 +- hw/pci-host/pnv_phb.c | 116 +++++++++++++++++++++++++++++++++ hw/pci-host/pnv_phb3.c | 4 +- include/hw/pci-host/pnv_phb3.h | 3 + 4 files changed, 123 insertions(+), 3 deletions(-) create mode 100644 hw/pci-host/pnv_phb.c diff --git a/hw/pci-host/meson.build b/hw/pci-host/meson.build index 4c4f39c15c..b4107b7a2a 100644 --- a/hw/pci-host/meson.build +++ b/hw/pci-host/meson.build @@ -32,5 +32,6 @@ specific_ss.add(when: 'CONFIG_PCI_POWERNV', if_true: file= s( 'pnv_phb3_msi.c', 'pnv_phb3_pbcq.c', 'pnv_phb4.c', - 'pnv_phb4_pec.c' + 'pnv_phb4_pec.c', + 'pnv_phb.c', )) diff --git a/hw/pci-host/pnv_phb.c b/hw/pci-host/pnv_phb.c new file mode 100644 index 0000000000..3dd08f768f --- /dev/null +++ b/hw/pci-host/pnv_phb.c @@ -0,0 +1,116 @@ +/* + * QEMU PowerPC PowerNV Unified PHB model + * + * Copyright (c) 2022, IBM Corporation. + * + * This code is licensed under the GPL version 2 or later. See the + * COPYING file in the top-level directory. + */ +#include "qemu/osdep.h" +#include "qemu/log.h" +#include "qapi/visitor.h" +#include "qapi/error.h" +#include "hw/pci-host/pnv_phb.h" +#include "hw/pci/pcie_host.h" +#include "hw/pci/pcie_port.h" +#include "hw/ppc/pnv.h" +#include "hw/irq.h" +#include "hw/qdev-properties.h" +#include "qom/object.h" +#include "sysemu/sysemu.h" + + +static char *pnv_phb_get_chip_typename(void) +{ + Object *qdev_machine =3D qdev_get_machine(); + PnvMachineState *pnv =3D PNV_MACHINE(qdev_machine); + MachineState *machine =3D MACHINE(pnv); + g_autofree char *chip_typename =3D NULL; + int i; + + if (!machine->cpu_type) { + return NULL; + } + + i =3D strlen(machine->cpu_type) - strlen(POWERPC_CPU_TYPE_SUFFIX); + chip_typename =3D g_strdup_printf(PNV_CHIP_TYPE_NAME("%.*s"), + i, machine->cpu_type); + + return g_steal_pointer(&chip_typename); +} + +static void pnv_phb_instance_init(Object *obj) +{ + g_autofree char *chip_typename =3D pnv_phb_get_chip_typename(); + + /* + * When doing command line instrospection we won't have + * a valid machine->cpu_type value. + */ + if (!chip_typename) { + return; + } + + if (!strcmp(chip_typename, TYPE_PNV_CHIP_POWER8) || + !strcmp(chip_typename, TYPE_PNV_CHIP_POWER8E) || + !strcmp(chip_typename, TYPE_PNV_CHIP_POWER8NVL)) { + pnv_phb3_instance_init(obj); + } +} + +static void pnv_phb_realize(DeviceState *dev, Error **errp) +{ + g_autofree char *chip_typename =3D pnv_phb_get_chip_typename(); + + g_assert(chip_typename !=3D NULL); + + if (!strcmp(chip_typename, TYPE_PNV_CHIP_POWER8) || + !strcmp(chip_typename, TYPE_PNV_CHIP_POWER8E) || + !strcmp(chip_typename, TYPE_PNV_CHIP_POWER8NVL)) { + /* PnvPHB3 */ + pnv_phb3_realize(dev, errp); + } +} + +static const char *pnv_phb_root_bus_path(PCIHostState *host_bridge, + PCIBus *rootbus) +{ + PnvPHB *phb =3D PNV_PHB(host_bridge); + + snprintf(phb->bus_path, sizeof(phb->bus_path), "00%02x:%02x", + phb->chip_id, phb->phb_id); + return phb->bus_path; +} + +static Property pnv_phb_properties[] =3D { + DEFINE_PROP_UINT32("index", PnvPHB, phb_id, 0), + DEFINE_PROP_UINT32("chip-id", PnvPHB, chip_id, 0), + DEFINE_PROP_END_OF_LIST(), +}; + +static void pnv_phb_class_init(ObjectClass *klass, void *data) +{ + PCIHostBridgeClass *hc =3D PCI_HOST_BRIDGE_CLASS(klass); + DeviceClass *dc =3D DEVICE_CLASS(klass); + + hc->root_bus_path =3D pnv_phb_root_bus_path; + dc->realize =3D pnv_phb_realize; + device_class_set_props(dc, pnv_phb_properties); + set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); + dc->user_creatable =3D true; +} + +static const TypeInfo pnv_phb_type_info =3D { + .name =3D TYPE_PNV_PHB, + .parent =3D TYPE_PCIE_HOST_BRIDGE, + .instance_size =3D sizeof(PnvPHB), + .class_init =3D pnv_phb_class_init, + .instance_init =3D pnv_phb_instance_init, +}; + +static void pnv_phb_register_types(void) +{ + type_register_static(&pnv_phb_type_info); +} + +type_init(pnv_phb_register_types) diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c index 70d92edd94..8e31a69083 100644 --- a/hw/pci-host/pnv_phb3.c +++ b/hw/pci-host/pnv_phb3.c @@ -966,7 +966,7 @@ static AddressSpace *pnv_phb3_dma_iommu(PCIBus *bus, vo= id *opaque, int devfn) return &ds->dma_as; } =20 -static void pnv_phb3_instance_init(Object *obj) +void pnv_phb3_instance_init(Object *obj) { PnvPHB3 *phb =3D PNV_PHB3(obj); =20 @@ -986,7 +986,7 @@ static void pnv_phb3_instance_init(Object *obj) =20 } =20 -static void pnv_phb3_realize(DeviceState *dev, Error **errp) +void pnv_phb3_realize(DeviceState *dev, Error **errp) { PnvPHB3 *phb =3D PNV_PHB3(dev); PCIHostState *pci =3D PCI_HOST_BRIDGE(dev); diff --git a/include/hw/pci-host/pnv_phb3.h b/include/hw/pci-host/pnv_phb3.h index b6b5f91684..aba26f4f7c 100644 --- a/include/hw/pci-host/pnv_phb3.h +++ b/include/hw/pci-host/pnv_phb3.h @@ -102,4 +102,7 @@ void pnv_phb3_reg_write(void *opaque, hwaddr off, uint6= 4_t val, unsigned size); void pnv_phb3_update_regions(PnvPHB3 *phb); void pnv_phb3_remap_irqs(PnvPHB3 *phb); =20 +void pnv_phb3_instance_init(Object *obj); +void pnv_phb3_realize(DeviceState *dev, Error **errp); + #endif /* PCI_HOST_PNV_PHB3_H */ --=20 2.32.0 From nobody Sun May 19 05:00:02 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=1651950881; cv=none; d=zohomail.com; s=zohoarc; b=fgeDvc2jjFyyP3Ns3pjgCkDiPAzXCOrWU45XZ7Lh2XZygjYYVmEDXtReQ71ZNSTk0fjicPialFxE0hrn5pLkmHuY4WZb7SZ2KThDkXuCUXpiJRII2sHehtRy0+9UxqCdTB2eHcBP3gMW6GYinNQNg+TbuIelEu1HanRAWNK95qw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651950881; 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=BMxmlRSpWApzoOGJfheDKJR1ipl94PWBoN9qT7EWdW8=; b=F/0Jx0yQ2TC9reey1WAS5m/BpZWFlCk6MG0H7YP314ugL/1WzHYhnTJiaHdd0HCJ8R+TwDeuvvZzV4jzONQUuPYr/SS8JlWsMnAHy465E0A8szcuoZM504e7iKpfpbAfX7vYZKs26Pk7HFp2Cjdg6tbroljjYgISKC7TVesG83s= 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 165195088179034.538961400328844; Sat, 7 May 2022 12:14:41 -0700 (PDT) Received: from localhost ([::1]:49118 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnPt2-0002eK-5E for importer@patchew.org; Sat, 07 May 2022 15:14:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54800) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnPlS-0005LG-Hm; Sat, 07 May 2022 15:06:50 -0400 Received: from mail-oa1-x29.google.com ([2001:4860:4864:20::29]:41520) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnPlQ-0001XM-1h; Sat, 07 May 2022 15:06:50 -0400 Received: by mail-oa1-x29.google.com with SMTP id 586e51a60fabf-edf9ddb312so9612740fac.8; Sat, 07 May 2022 12:06:47 -0700 (PDT) Received: from balboa.ibmmodules.com (201-1-57-208.dsl.telesp.net.br. [201.1.57.208]) by smtp.gmail.com with ESMTPSA id p1-20020a0568301d4100b0060603221270sm2907397oth.64.2022.05.07.12.06.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 May 2022 12:06:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BMxmlRSpWApzoOGJfheDKJR1ipl94PWBoN9qT7EWdW8=; b=f81fDAvx8HEU05ElFal6DGOUSq24kGtPEe8bpIvmT7onVAMcpGSER1Mys9K6qmhj7o FvcJxmupN7FtJVMnUnbFPVErP5tT5L8Z5l6Z0IDBUJQnjZDlNiS68HZ5QvgPXXBStx72 LUFIaalQQVmRQWYygAPOlQHwpestKPERj4puGZUDWJdIb1yhkbu3hxeTAIRRGIaNOpfR ykAkvQ/c2iw3pX1by1fVzkBK2rjR+9Jh7l+E156C6zmLZukiPfiynYcy8zMYIjYOvLFZ IoNexWnAxR1pUjxWYfniqSq6V1C/kFWbp9vkAkyoBtpMspnUsl35V2HbJEaSHRLLlN91 ixvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BMxmlRSpWApzoOGJfheDKJR1ipl94PWBoN9qT7EWdW8=; b=SadEtJUZK+PYlJM/QpX8GyupnAChYOJi/mt4SpwCsn4xJB6iHLw1gRbJHOBef63yex jLW+3y9yPhcft2qto73iASJY8WwyGvsnkyD0WkEUYgFXjx9ZYKFb44NfTJ/rjaZ4J7qh OoG2MrqUH7TFHp8555XVaZ6NBmkrMnVxHcSfgTiOHY0rDeX7IsWtfTywt8Tt/S0a9xQd yxtq09fDDMfq2asB/uKtwQs4q8D2vGDFYr4ijBto3+sYLraGJCTDge4E0v7hF3p0u32Z ZsOn59n8L3UHsa/m1UbM2V597keRcS9nuuExNH0X8cNNZjPDVtcOuW2ClrR27D3p6v42 Ch8g== X-Gm-Message-State: AOAM531L82GFS1EOZxn95Swn4jBJjTN0QpR4cPO9d3jVAuRgHqJhLEeC MvEymFUWW92mp0wsym5Hq0xeFsu0H6w= X-Google-Smtp-Source: ABdhPJwvbrzpnBc4bkO0UI09bKeaj+1dwQEcVJ9aPtsMLWW96+uFTK8Os7/WBelke4SHpq356Mg8Jw== X-Received: by 2002:a05:6870:8907:b0:e2:a4fd:7539 with SMTP id i7-20020a056870890700b000e2a4fd7539mr6968801oao.56.1651950406814; Sat, 07 May 2022 12:06:46 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, clg@kaod.org, fbarrat@linux.ibm.com, Daniel Henrique Barboza Subject: [PATCH 06/17] ppc/pnv: remove PnvPHB3 Date: Sat, 7 May 2022 16:06:13 -0300 Message-Id: <20220507190624.507419-7-danielhb413@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220507190624.507419-1-danielhb413@gmail.com> References: <20220507190624.507419-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=2001:4860:4864:20::29; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x29.google.com 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, 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, 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 @gmail.com) X-ZM-MESSAGEID: 1651950882604100003 Content-Type: text/plain; charset="utf-8" The unified PnvPHB model is able to replace PnvPHB3 in all PHB3 related code. Let's do that while also removing the PnvPHB3 device entirely. The device wasn't user creatable in any QEMU release so there's no ABI concerns in doing so. Signed-off-by: Daniel Henrique Barboza --- hw/pci-host/pnv_phb.c | 1 + hw/pci-host/pnv_phb3.c | 92 ++++++++++------------------------ hw/pci-host/pnv_phb3_msi.c | 6 +-- hw/pci-host/pnv_phb3_pbcq.c | 8 +-- hw/ppc/pnv.c | 12 ++--- include/hw/pci-host/pnv_phb.h | 9 ++-- include/hw/pci-host/pnv_phb3.h | 43 +--------------- include/hw/ppc/pnv.h | 2 +- 8 files changed, 48 insertions(+), 125 deletions(-) diff --git a/hw/pci-host/pnv_phb.c b/hw/pci-host/pnv_phb.c index 3dd08f768f..e4c4cca311 100644 --- a/hw/pci-host/pnv_phb.c +++ b/hw/pci-host/pnv_phb.c @@ -85,6 +85,7 @@ static const char *pnv_phb_root_bus_path(PCIHostState *ho= st_bridge, static Property pnv_phb_properties[] =3D { DEFINE_PROP_UINT32("index", PnvPHB, phb_id, 0), DEFINE_PROP_UINT32("chip-id", PnvPHB, chip_id, 0), + DEFINE_PROP_LINK("chip", PnvPHB, chip, TYPE_PNV_CHIP, PnvChip *), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c index 8e31a69083..d2405d4f5a 100644 --- a/hw/pci-host/pnv_phb3.c +++ b/hw/pci-host/pnv_phb3.c @@ -24,7 +24,7 @@ qemu_log_mask(LOG_GUEST_ERROR, "phb3[%d:%d]: " fmt "\n", \ (phb)->chip_id, (phb)->phb_id, ## __VA_ARGS__) =20 -static PCIDevice *pnv_phb3_find_cfg_dev(PnvPHB3 *phb) +static PCIDevice *pnv_phb3_find_cfg_dev(PnvPHB *phb) { PCIHostState *pci =3D PCI_HOST_BRIDGE(phb); uint64_t addr =3D phb->regs3[PHB_CONFIG_ADDRESS >> 3]; @@ -43,7 +43,7 @@ static PCIDevice *pnv_phb3_find_cfg_dev(PnvPHB3 *phb) * The CONFIG_DATA register expects little endian accesses, but as the * region is big endian, we have to swap the value. */ -static void pnv_phb3_config_write(PnvPHB3 *phb, unsigned off, +static void pnv_phb3_config_write(PnvPHB *phb, unsigned off, unsigned size, uint64_t val) { uint32_t cfg_addr, limit; @@ -78,7 +78,7 @@ static void pnv_phb3_config_write(PnvPHB3 *phb, unsigned = off, pci_host_config_write_common(pdev, cfg_addr, limit, val, size); } =20 -static uint64_t pnv_phb3_config_read(PnvPHB3 *phb, unsigned off, +static uint64_t pnv_phb3_config_read(PnvPHB *phb, unsigned off, unsigned size) { uint32_t cfg_addr, limit; @@ -112,7 +112,7 @@ static uint64_t pnv_phb3_config_read(PnvPHB3 *phb, unsi= gned off, } } =20 -static void pnv_phb3_check_m32(PnvPHB3 *phb) +static void pnv_phb3_check_m32(PnvPHB *phb) { uint64_t base, start, size; MemoryRegion *parent; @@ -152,7 +152,7 @@ static void pnv_phb3_check_m32(PnvPHB3 *phb) memory_region_add_subregion(parent, base, &phb->mr_m32); } =20 -static void pnv_phb3_check_m64(PnvPHB3 *phb, uint32_t index) +static void pnv_phb3_check_m64(PnvPHB *phb, uint32_t index) { uint64_t base, start, size, m64; MemoryRegion *parent; @@ -202,7 +202,7 @@ static void pnv_phb3_check_m64(PnvPHB3 *phb, uint32_t i= ndex) memory_region_add_subregion(parent, base, &phb->mr_m64[index]); } =20 -static void pnv_phb3_check_all_m64s(PnvPHB3 *phb) +static void pnv_phb3_check_all_m64s(PnvPHB *phb) { uint64_t i; =20 @@ -211,7 +211,7 @@ static void pnv_phb3_check_all_m64s(PnvPHB3 *phb) } } =20 -static void pnv_phb3_lxivt_write(PnvPHB3 *phb, unsigned idx, uint64_t val) +static void pnv_phb3_lxivt_write(PnvPHB *phb, unsigned idx, uint64_t val) { uint8_t server, prio; =20 @@ -230,7 +230,7 @@ static void pnv_phb3_lxivt_write(PnvPHB3 *phb, unsigned= idx, uint64_t val) ics_write_xive(&phb->lsis, idx, server, prio, prio); } =20 -static uint64_t *pnv_phb3_ioda_access(PnvPHB3 *phb, +static uint64_t *pnv_phb3_ioda_access(PnvPHB *phb, unsigned *out_table, unsigned *out_i= dx) { uint64_t adreg =3D phb->regs3[PHB_IODA_ADDR >> 3]; @@ -304,7 +304,7 @@ static uint64_t *pnv_phb3_ioda_access(PnvPHB3 *phb, return tptr; } =20 -static uint64_t pnv_phb3_ioda_read(PnvPHB3 *phb) +static uint64_t pnv_phb3_ioda_read(PnvPHB *phb) { unsigned table; uint64_t *tptr; @@ -317,7 +317,7 @@ static uint64_t pnv_phb3_ioda_read(PnvPHB3 *phb) return *tptr; } =20 -static void pnv_phb3_ioda_write(PnvPHB3 *phb, uint64_t val) +static void pnv_phb3_ioda_write(PnvPHB *phb, uint64_t val) { unsigned table, idx; uint64_t *tptr; @@ -345,7 +345,7 @@ static void pnv_phb3_ioda_write(PnvPHB3 *phb, uint64_t = val) * This is called whenever the PHB LSI, MSI source ID register or * the PBCQ irq filters are written. */ -void pnv_phb3_remap_irqs(PnvPHB3 *phb) +void pnv_phb3_remap_irqs(PnvPHB *phb) { ICSState *ics =3D &phb->lsis; uint32_t local, global, count, mask, comp; @@ -408,7 +408,7 @@ void pnv_phb3_remap_irqs(PnvPHB3 *phb) pnv_phb3_msi_update_config(&phb->msis, comp, count - PNV_PHB3_NUM_LSI); } =20 -static void pnv_phb3_lsi_src_id_write(PnvPHB3 *phb, uint64_t val) +static void pnv_phb3_lsi_src_id_write(PnvPHB *phb, uint64_t val) { /* Sanitize content */ val &=3D PHB_LSI_SRC_ID; @@ -416,7 +416,7 @@ static void pnv_phb3_lsi_src_id_write(PnvPHB3 *phb, uin= t64_t val) pnv_phb3_remap_irqs(phb); } =20 -static void pnv_phb3_rtc_invalidate(PnvPHB3 *phb, uint64_t val) +static void pnv_phb3_rtc_invalidate(PnvPHB *phb, uint64_t val) { PnvPhb3DMASpace *ds; =20 @@ -456,7 +456,7 @@ static void pnv_phb3_update_msi_regions(PnvPhb3DMASpace= *ds) } } =20 -static void pnv_phb3_update_all_msi_regions(PnvPHB3 *phb) +static void pnv_phb3_update_all_msi_regions(PnvPHB *phb) { PnvPhb3DMASpace *ds; =20 @@ -467,7 +467,7 @@ static void pnv_phb3_update_all_msi_regions(PnvPHB3 *ph= b) =20 void pnv_phb3_reg_write(void *opaque, hwaddr off, uint64_t val, unsigned s= ize) { - PnvPHB3 *phb =3D opaque; + PnvPHB *phb =3D opaque; bool changed; =20 /* Special case configuration data */ @@ -589,7 +589,7 @@ void pnv_phb3_reg_write(void *opaque, hwaddr off, uint6= 4_t val, unsigned size) =20 uint64_t pnv_phb3_reg_read(void *opaque, hwaddr off, unsigned size) { - PnvPHB3 *phb =3D opaque; + PnvPHB *phb =3D opaque; PCIHostState *pci =3D PCI_HOST_BRIDGE(phb); uint64_t val; =20 @@ -683,7 +683,7 @@ static int pnv_phb3_map_irq(PCIDevice *pci_dev, int irq= _num) =20 static void pnv_phb3_set_irq(void *opaque, int irq_num, int level) { - PnvPHB3 *phb =3D opaque; + PnvPHB *phb =3D opaque; =20 /* LSI only ... */ if (irq_num > 3) { @@ -741,7 +741,7 @@ static void pnv_phb3_translate_tve(PnvPhb3DMASpace *ds,= hwaddr addr, int32_t lev =3D GETFIELD(IODA2_TVT_NUM_LEVELS, tve); uint32_t tts =3D GETFIELD(IODA2_TVT_TCE_TABLE_SIZE, tve); uint32_t tps =3D GETFIELD(IODA2_TVT_IO_PSIZE, tve); - PnvPHB3 *phb =3D ds->phb; + PnvPHB *phb =3D ds->phb; =20 /* Invalid levels */ if (lev > 4) { @@ -848,7 +848,7 @@ static IOMMUTLBEntry pnv_phb3_translate_iommu(IOMMUMemo= ryRegion *iommu, .addr_mask =3D ~(hwaddr)0, .perm =3D IOMMU_NONE, }; - PnvPHB3 *phb =3D ds->phb; + PnvPHB *phb =3D ds->phb; =20 /* Resolve PE# */ if (!pnv_phb3_resolve_pe(ds)) { @@ -935,7 +935,7 @@ static const MemoryRegionOps pnv_phb3_msi_ops =3D { =20 static AddressSpace *pnv_phb3_dma_iommu(PCIBus *bus, void *opaque, int dev= fn) { - PnvPHB3 *phb =3D opaque; + PnvPHB *phb =3D opaque; PnvPhb3DMASpace *ds; =20 QLIST_FOREACH(ds, &phb->v3_dma_spaces, list) { @@ -968,7 +968,7 @@ static AddressSpace *pnv_phb3_dma_iommu(PCIBus *bus, vo= id *opaque, int devfn) =20 void pnv_phb3_instance_init(Object *obj) { - PnvPHB3 *phb =3D PNV_PHB3(obj); + PnvPHB *phb =3D PNV_PHB(obj); =20 QLIST_INIT(&phb->v3_dma_spaces); =20 @@ -988,7 +988,7 @@ void pnv_phb3_instance_init(Object *obj) =20 void pnv_phb3_realize(DeviceState *dev, Error **errp) { - PnvPHB3 *phb =3D PNV_PHB3(dev); + PnvPHB *phb =3D PNV_PHB(dev); PCIHostState *pci =3D PCI_HOST_BRIDGE(dev); PnvMachineState *pnv =3D PNV_MACHINE(qdev_get_machine()); int i; @@ -1055,7 +1055,7 @@ void pnv_phb3_realize(DeviceState *dev, Error **errp) pnv_phb_attach_root_port(PCI_HOST_BRIDGE(phb), TYPE_PNV_PHB3_ROOT_PORT= ); } =20 -void pnv_phb3_update_regions(PnvPHB3 *phb) +void pnv_phb3_update_regions(PnvPHB *phb) { PnvPBCQState *pbcq =3D &phb->pbcq; =20 @@ -1077,43 +1077,6 @@ void pnv_phb3_update_regions(PnvPHB3 *phb) pnv_phb3_check_all_m64s(phb); } =20 -static const char *pnv_phb3_root_bus_path(PCIHostState *host_bridge, - PCIBus *rootbus) -{ - PnvPHB3 *phb =3D PNV_PHB3(host_bridge); - - snprintf(phb->bus_path, sizeof(phb->bus_path), "00%02x:%02x", - phb->chip_id, phb->phb_id); - return phb->bus_path; -} - -static Property pnv_phb3_properties[] =3D { - DEFINE_PROP_UINT32("index", PnvPHB3, phb_id, 0), - DEFINE_PROP_UINT32("chip-id", PnvPHB3, chip_id, 0), - DEFINE_PROP_LINK("chip", PnvPHB3, chip, TYPE_PNV_CHIP, PnvChip *), - DEFINE_PROP_END_OF_LIST(), -}; - -static void pnv_phb3_class_init(ObjectClass *klass, void *data) -{ - PCIHostBridgeClass *hc =3D PCI_HOST_BRIDGE_CLASS(klass); - DeviceClass *dc =3D DEVICE_CLASS(klass); - - hc->root_bus_path =3D pnv_phb3_root_bus_path; - dc->realize =3D pnv_phb3_realize; - device_class_set_props(dc, pnv_phb3_properties); - set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); - dc->user_creatable =3D false; -} - -static const TypeInfo pnv_phb3_type_info =3D { - .name =3D TYPE_PNV_PHB3, - .parent =3D TYPE_PCIE_HOST_BRIDGE, - .instance_size =3D sizeof(PnvPHB3), - .class_init =3D pnv_phb3_class_init, - .instance_init =3D pnv_phb3_instance_init, -}; - static void pnv_phb3_root_bus_class_init(ObjectClass *klass, void *data) { BusClass *k =3D BUS_CLASS(klass); @@ -1140,15 +1103,15 @@ static void pnv_phb3_root_port_realize(DeviceState = *dev, Error **errp) PCIERootPortClass *rpc =3D PCIE_ROOT_PORT_GET_CLASS(dev); PCIDevice *pci =3D PCI_DEVICE(dev); PCIBus *bus =3D pci_get_bus(pci); - PnvPHB3 *phb =3D NULL; + PnvPHB *phb =3D NULL; Error *local_err =3D NULL; =20 - phb =3D (PnvPHB3 *) object_dynamic_cast(OBJECT(bus->qbus.parent), - TYPE_PNV_PHB3); + phb =3D (PnvPHB *) object_dynamic_cast(OBJECT(bus->qbus.parent), + TYPE_PNV_PHB); =20 if (!phb) { error_setg(errp, -"pnv_phb3_root_port devices must be connected to pnv-phb3 buses"); +"pnv_phb3_root_port devices must be connected to pnv-phb buses"); return; } =20 @@ -1195,7 +1158,6 @@ static void pnv_phb3_register_types(void) { type_register_static(&pnv_phb3_root_bus_info); type_register_static(&pnv_phb3_root_port_info); - type_register_static(&pnv_phb3_type_info); type_register_static(&pnv_phb3_iommu_memory_region_info); } =20 diff --git a/hw/pci-host/pnv_phb3_msi.c b/hw/pci-host/pnv_phb3_msi.c index d8534376f8..84475f8dc1 100644 --- a/hw/pci-host/pnv_phb3_msi.c +++ b/hw/pci-host/pnv_phb3_msi.c @@ -18,7 +18,7 @@ #include "hw/qdev-properties.h" #include "sysemu/reset.h" =20 -static uint64_t phb3_msi_ive_addr(PnvPHB3 *phb, int srcno) +static uint64_t phb3_msi_ive_addr(PnvPHB *phb, int srcno) { uint64_t ivtbar =3D phb->regs3[PHB_IVT_BAR >> 3]; uint64_t phbctl =3D phb->regs3[PHB_CONTROL >> 3]; @@ -43,7 +43,7 @@ static uint64_t phb3_msi_ive_addr(PnvPHB3 *phb, int srcno) } } =20 -static bool phb3_msi_read_ive(PnvPHB3 *phb, int srcno, uint64_t *out_ive) +static bool phb3_msi_read_ive(PnvPHB *phb, int srcno, uint64_t *out_ive) { uint64_t ive_addr, ive; =20 @@ -281,7 +281,7 @@ static void phb3_msi_instance_init(Object *obj) Phb3MsiState *msi =3D PHB3_MSI(obj); ICSState *ics =3D ICS(obj); =20 - object_property_add_link(obj, "phb", TYPE_PNV_PHB3, + object_property_add_link(obj, "phb", TYPE_PNV_PHB, (Object **)&msi->phb, object_property_allow_set_link, OBJ_PROP_LINK_STRONG); diff --git a/hw/pci-host/pnv_phb3_pbcq.c b/hw/pci-host/pnv_phb3_pbcq.c index 82f70efa43..39f02c158f 100644 --- a/hw/pci-host/pnv_phb3_pbcq.c +++ b/hw/pci-host/pnv_phb3_pbcq.c @@ -238,7 +238,7 @@ static const MemoryRegionOps pnv_pbcq_spci_xscom_ops = =3D { static void pnv_pbcq_default_bars(PnvPBCQState *pbcq) { uint64_t mm0, mm1, reg; - PnvPHB3 *phb =3D pbcq->phb; + PnvPHB *phb =3D pbcq->phb; =20 mm0 =3D 0x3d00000000000ull + 0x4000000000ull * phb->chip_id + 0x1000000000ull * phb->phb_id; @@ -258,7 +258,7 @@ static void pnv_pbcq_default_bars(PnvPBCQState *pbcq) static void pnv_pbcq_realize(DeviceState *dev, Error **errp) { PnvPBCQState *pbcq =3D PNV_PBCQ(dev); - PnvPHB3 *phb; + PnvPHB *phb; char name[32]; =20 assert(pbcq->phb); @@ -300,7 +300,7 @@ static int pnv_pbcq_dt_xscom(PnvXScomInterface *dev, vo= id *fdt, int xscom_offset) { const char compat[] =3D "ibm,power8-pbcq"; - PnvPHB3 *phb =3D PNV_PBCQ(dev)->phb; + PnvPHB *phb =3D PNV_PBCQ(dev)->phb; char *name; int offset; uint32_t lpc_pcba =3D PNV_XSCOM_PBCQ_NEST_BASE + 0x400 * phb->phb_id; @@ -331,7 +331,7 @@ static void phb3_pbcq_instance_init(Object *obj) { PnvPBCQState *pbcq =3D PNV_PBCQ(obj); =20 - object_property_add_link(obj, "phb", TYPE_PNV_PHB3, + object_property_add_link(obj, "phb", TYPE_PNV_PHB, (Object **)&pbcq->phb, object_property_allow_set_link, OBJ_PROP_LINK_STRONG); diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 7c08a78d6c..12a3fe4920 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -655,7 +655,7 @@ static ISABus *pnv_isa_create(PnvChip *chip, Error **er= rp) static int pnv_chip_power8_pic_print_info_child(Object *child, void *opaqu= e) { Monitor *mon =3D opaque; - PnvPHB3 *phb3 =3D (PnvPHB3 *) object_dynamic_cast(child, TYPE_PNV_PHB3= ); + PnvPHB *phb3 =3D (PnvPHB *) object_dynamic_cast(child, TYPE_PNV_PHB); =20 if (phb3) { pnv_phb3_msi_pic_print_info(&phb3->msis, mon); @@ -1155,7 +1155,7 @@ static void pnv_chip_power8_instance_init(Object *obj) 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); + object_initialize_child(obj, "phb[*]", &chip8->phbs[i], TYPE_PNV_P= HB); } =20 } @@ -1277,9 +1277,9 @@ static void pnv_chip_power8_realize(DeviceState *dev,= Error **errp) memory_region_add_subregion(get_system_memory(), PNV_HOMER_BASE(chip), &chip8->homer.regs); =20 - /* PHB3 controllers */ + /* PHB version 3 controllers */ for (i =3D 0; i < chip8->num_phbs; i++) { - PnvPHB3 *phb =3D &chip8->phbs[i]; + PnvPHB *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, @@ -1942,7 +1942,7 @@ typedef struct ForeachPhb3Args { static int pnv_ics_get_child(Object *child, void *opaque) { ForeachPhb3Args *args =3D opaque; - PnvPHB3 *phb3 =3D (PnvPHB3 *) object_dynamic_cast(child, TYPE_PNV_PHB3= ); + PnvPHB *phb3 =3D (PnvPHB *) object_dynamic_cast(child, TYPE_PNV_PHB); =20 if (phb3) { if (ics_valid_irq(&phb3->lsis, args->irq)) { @@ -1992,7 +1992,7 @@ PnvChip *pnv_get_chip(PnvMachineState *pnv, uint32_t = chip_id) =20 static int pnv_ics_resend_child(Object *child, void *opaque) { - PnvPHB3 *phb3 =3D (PnvPHB3 *) object_dynamic_cast(child, TYPE_PNV_PHB3= ); + PnvPHB *phb3 =3D (PnvPHB *) object_dynamic_cast(child, TYPE_PNV_PHB); =20 if (phb3) { ics_resend(&phb3->lsis); diff --git a/include/hw/pci-host/pnv_phb.h b/include/hw/pci-host/pnv_phb.h index 2a8bf9a66d..46158e124f 100644 --- a/include/hw/pci-host/pnv_phb.h +++ b/include/hw/pci-host/pnv_phb.h @@ -21,14 +21,14 @@ #define PNV_PHB3_NUM_REGS (0x1000 >> 3) #define PHB3_MAX_MSI 2048 =20 -typedef struct PnvPHB3 PnvPHB3; typedef struct PnvChip PnvChip; +typedef struct PnvPHB PnvPHB; =20 typedef struct Phb3MsiState { ICSState ics; qemu_irq *qirqs; =20 - PnvPHB3 *phb; + PnvPHB *phb; uint64_t rba[PHB3_MAX_MSI / 64]; uint32_t rba_sum; } Phb3MsiState; @@ -53,7 +53,7 @@ typedef struct PnvPBCQState { uint64_t mmio0_size; uint64_t mmio1_base; uint64_t mmio1_size; - PnvPHB3 *phb; + PnvPHB *phb; =20 MemoryRegion xscom_nest_regs; MemoryRegion xscom_pci_regs; @@ -76,7 +76,7 @@ typedef struct PnvPhb3DMASpace { uint8_t devfn; int pe_num; /* Cached PE number */ #define PHB_INVALID_PE (-1) - PnvPHB3 *phb; + PnvPHB *phb; AddressSpace dma_as; IOMMUMemoryRegion dma_mr; MemoryRegion msi32_mr; @@ -100,7 +100,6 @@ typedef struct PnvPhb4PecState PnvPhb4PecState; /* * Unified PHB PCIe Host Bridge for PowerNV machines */ -typedef struct PnvPHB PnvPHB; #define TYPE_PNV_PHB "pnv-phb" OBJECT_DECLARE_SIMPLE_TYPE(PnvPHB, PNV_PHB) =20 diff --git a/include/hw/pci-host/pnv_phb3.h b/include/hw/pci-host/pnv_phb3.h index aba26f4f7c..1c4af98fee 100644 --- a/include/hw/pci-host/pnv_phb3.h +++ b/include/hw/pci-host/pnv_phb3.h @@ -16,7 +16,6 @@ #include "hw/ppc/xics.h" #include "qom/object.h" =20 -typedef struct PnvPHB3 PnvPHB3; typedef struct PnvChip PnvChip; =20 /* @@ -50,11 +49,6 @@ typedef struct PnvPHB3RootPort { PCIESlot parent_obj; } PnvPHB3RootPort; =20 -/* - * PHB3 PCIe Host Bridge for PowerNV machines (POWER8) - */ -#define TYPE_PNV_PHB3 "pnv-phb3" -OBJECT_DECLARE_SIMPLE_TYPE(PnvPHB3, PNV_PHB3) =20 #define PNV_PHB3_NUM_M64 16 #define PNV_PHB3_NUM_REGS (0x1000 >> 3) @@ -63,44 +57,11 @@ OBJECT_DECLARE_SIMPLE_TYPE(PnvPHB3, PNV_PHB3) =20 #define PCI_MMIO_TOTAL_SIZE (0x1ull << 60) =20 -struct PnvPHB3 { - PCIExpressHost parent_obj; - - uint32_t chip_id; - uint32_t phb_id; - char bus_path[8]; - - uint64_t regs3[PNV_PHB3_NUM_REGS]; - MemoryRegion mr_regs3; - - MemoryRegion mr_m32; - MemoryRegion mr_m64[PNV_PHB3_NUM_M64]; - MemoryRegion pci_mmio; - MemoryRegion pci_io; - - uint64_t ioda2_LIST[8]; - uint64_t ioda2_LXIVT[8]; - uint64_t ioda2_TVT[512]; - uint64_t ioda2_M64BT[16]; - uint64_t ioda2_MDT[256]; - uint64_t ioda2_PEEV[4]; - - uint32_t total_irq; - ICSState lsis; - qemu_irq *qirqs; - Phb3MsiState msis; - - PnvPBCQState pbcq; - - QLIST_HEAD(, PnvPhb3DMASpace) v3_dma_spaces; - - PnvChip *chip; -}; =20 uint64_t pnv_phb3_reg_read(void *opaque, hwaddr off, unsigned size); void pnv_phb3_reg_write(void *opaque, hwaddr off, uint64_t val, unsigned s= ize); -void pnv_phb3_update_regions(PnvPHB3 *phb); -void pnv_phb3_remap_irqs(PnvPHB3 *phb); +void pnv_phb3_update_regions(PnvPHB *phb); +void pnv_phb3_remap_irqs(PnvPHB *phb); =20 void pnv_phb3_instance_init(Object *obj); void pnv_phb3_realize(DeviceState *dev, Error **errp); diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h index 86cb7d7f97..539454fe9d 100644 --- a/include/hw/ppc/pnv.h +++ b/include/hw/ppc/pnv.h @@ -80,7 +80,7 @@ struct Pnv8Chip { PnvHomer homer; =20 #define PNV8_CHIP_PHB3_MAX 4 - PnvPHB3 phbs[PNV8_CHIP_PHB3_MAX]; + PnvPHB phbs[PNV8_CHIP_PHB3_MAX]; uint32_t num_phbs; =20 XICSFabric *xics; --=20 2.32.0 From nobody Sun May 19 05:00:02 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=1651950758; cv=none; d=zohomail.com; s=zohoarc; b=ezdm29qkUXjUualm/NVY+Yhko+zkanjEzMGY3dUTtAyvVzZG0Kmn2X6JhaeEvxASle/9aeWdefVMEx4OzeBzf+39pId8yENtXLHDs+yZwXrqbUbDLernnYgKPawt6vDqbKJHe4bTYi9oRUWHC4hdWC0qdO0t8u2EsxvHzfMURDg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651950758; 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=kdfZZSzTmKxAd6dgoaU2jVyv+EX2hmhj5o193ySsyIc=; b=OTLiOe82DAk+uVC7EtJRp3kdmLPYGJyK0AcOQorT/2HwUUu13UwgA9dv5l83Ff29ThT9QFWtYFTGLIUab8pNo/dERkcPPi5TmQN/Bpo0rB7rV+2bvhDQQAhoE+PD4Yzb8yPW/jO1MuZY1kw0qA65X8RehbzghB5gRYXkrf5epSw= 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 16519507586251001.293706079723; Sat, 7 May 2022 12:12:38 -0700 (PDT) Received: from localhost ([::1]:41168 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnPr3-0005qM-4D for importer@patchew.org; Sat, 07 May 2022 15:12:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54818) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnPlU-0005S6-Bh; Sat, 07 May 2022 15:06:52 -0400 Received: from mail-oi1-x229.google.com ([2607:f8b0:4864:20::229]:42642) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnPlS-0001Ym-Ng; Sat, 07 May 2022 15:06:52 -0400 Received: by mail-oi1-x229.google.com with SMTP id w194so9889713oie.9; Sat, 07 May 2022 12:06:50 -0700 (PDT) Received: from balboa.ibmmodules.com (201-1-57-208.dsl.telesp.net.br. [201.1.57.208]) by smtp.gmail.com with ESMTPSA id p1-20020a0568301d4100b0060603221270sm2907397oth.64.2022.05.07.12.06.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 May 2022 12:06:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kdfZZSzTmKxAd6dgoaU2jVyv+EX2hmhj5o193ySsyIc=; b=byN14cfXQiCp28RE9GgMm8n4J3mYiuhPNswayAZ5B/4fK/Pzn3F3Vol20Ahxb9Xf2H Q1dhTMVIXxUajJVGS1cuYtbfymouXangdctnBYhWBpCzAyPcvmXMNtm22/Q1ZSY5fK7h +P/YdxSnRWKiPto7C2OGmTVS4/5dErcveJhGPgpZIQQr7dmqSyLxI5xtCuptnxq9vWLW qAthmSq9QH/0D5/oyqZdLBDlDnNmCEHbk00GqSSVtPqAWH/9CPA/ktSu2SumbeaA0VHI ucwHj0G9xVbNhjtn84dIdE0n+FhbTLKcgUDfDHeRo+wd2z7IU+rOcSzB/Ge4Te35YxfT Jf1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kdfZZSzTmKxAd6dgoaU2jVyv+EX2hmhj5o193ySsyIc=; b=vg4JEX15oek0WzzcsnaPlKDP2EWl3nVxnl7f/rVHQOL7u9cmVFql4yNuUCGiZiw3dZ hMGbkFHXifklrwqX3TfgYB+P8fAPvUKCKXip2wEgUPrYlb39NR+70QWj9+eYOzmH2TOi XM2up0aaYhfG0IakTmT3EA3mqiVucoW1rMktO8FSGylZxxBaYroBjSqQfp6YjJO2hsTb 9OPIkbynXeKS3nrkM5fUU4Igjih8WLZniQtJHarrBqMcalElx7iYMFTicJgoOYq94lBy nWNkni1ZVMkKYE/2RxrZFmgROwZ0r4Wx0jVRtnOaqobQbufVF61Xu5b5cuF6DL7XatvX 9g5g== X-Gm-Message-State: AOAM53238zxSq7piienMQ5/29FwEccAnht/uS/8GWOwzBdE4+tU5o9ES vTsQVvyycOAeXnxchQ2O3ocRR5Q9JmY= X-Google-Smtp-Source: ABdhPJxSkTMf6H5fJxzNvV+h2EFF2R3KWauXtovUMMPZ48fXoefrPEdOpjsT0BDzOnLGN6T3vXYPTQ== X-Received: by 2002:a05:6808:1a05:b0:325:a083:3d8d with SMTP id bk5-20020a0568081a0500b00325a0833d8dmr7561959oib.231.1651950409263; Sat, 07 May 2022 12:06:49 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, clg@kaod.org, fbarrat@linux.ibm.com, Daniel Henrique Barboza Subject: [PATCH 07/17] ppc/pnv: user created pnv-phb for powernv8 Date: Sat, 7 May 2022 16:06:14 -0300 Message-Id: <20220507190624.507419-8-danielhb413@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220507190624.507419-1-danielhb413@gmail.com> References: <20220507190624.507419-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::229; envelope-from=danielhb413@gmail.com; helo=mail-oi1-x229.google.com 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, 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, 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 @gmail.com) X-ZM-MESSAGEID: 1651950760103100001 Content-Type: text/plain; charset="utf-8" This patch reintroduces the powernv8 bits of the code what was removed in commit 9c10d86fee "ppc/pnv: Remove user-created PHB{3,4,5} devices", using the pnv-phb device instead of the now late pnv-phb3 device, allowing us to enable user creatable pnv-phb devices for the powernv8 machine. Signed-off-by: Daniel Henrique Barboza --- hw/pci-host/pnv_phb3.c | 31 +++++++++++++++++++++++++++++-- hw/ppc/pnv.c | 23 ++++++++++++++++++++++- include/hw/ppc/pnv.h | 1 + 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c index d2405d4f5a..a6d6a10c52 100644 --- a/hw/pci-host/pnv_phb3.c +++ b/hw/pci-host/pnv_phb3.c @@ -993,6 +993,30 @@ void pnv_phb3_realize(DeviceState *dev, Error **errp) PnvMachineState *pnv =3D PNV_MACHINE(qdev_get_machine()); int i; =20 + /* User created devices */ + if (!phb->chip) { + Error *local_err =3D NULL; + BusState *s; + + phb->chip =3D pnv_get_chip(pnv, phb->chip_id); + if (!phb->chip) { + error_setg(errp, "invalid chip id: %d", phb->chip_id); + return; + } + + /* + * Reparent user created devices to the chip to build + * correctly the device tree. + */ + pnv_chip_parent_fixup(phb->chip, OBJECT(phb), phb->phb_id); + + s =3D qdev_get_parent_bus(DEVICE(phb->chip)); + if (!qdev_set_parent_bus(DEVICE(phb), s, &local_err)) { + error_propagate(errp, local_err); + return; + } + } + if (phb->phb_id >=3D PNV_CHIP_GET_CLASS(phb->chip)->num_phbs) { error_setg(errp, "invalid PHB index: %d", phb->phb_id); return; @@ -1052,7 +1076,10 @@ void pnv_phb3_realize(DeviceState *dev, Error **errp) =20 pci_setup_iommu(pci->bus, pnv_phb3_dma_iommu, phb); =20 - pnv_phb_attach_root_port(PCI_HOST_BRIDGE(phb), TYPE_PNV_PHB3_ROOT_PORT= ); + if (defaults_enabled()) { + pnv_phb_attach_root_port(PCI_HOST_BRIDGE(phb), + TYPE_PNV_PHB3_ROOT_PORT); + } } =20 void pnv_phb3_update_regions(PnvPHB *phb) @@ -1137,7 +1164,7 @@ static void pnv_phb3_root_port_class_init(ObjectClass= *klass, void *data) =20 device_class_set_parent_realize(dc, pnv_phb3_root_port_realize, &rpc->parent_realize); - dc->user_creatable =3D false; + dc->user_creatable =3D true; =20 k->vendor_id =3D PCI_VENDOR_ID_IBM; k->device_id =3D 0x03dc; diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 12a3fe4920..d9e7530cd3 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -1152,7 +1152,9 @@ static void pnv_chip_power8_instance_init(Object *obj) =20 object_initialize_child(obj, "homer", &chip8->homer, TYPE_PNV8_HOMER); =20 - chip8->num_phbs =3D pcc->num_phbs; + if (defaults_enabled()) { + 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= HB); @@ -1977,6 +1979,23 @@ static ICSState *pnv_ics_get(XICSFabric *xi, int irq) return NULL; } =20 +void pnv_chip_parent_fixup(PnvChip *chip, Object *obj, int index) +{ + Object *parent =3D OBJECT(chip); + g_autofree char *default_id =3D + g_strdup_printf("%s[%d]", object_get_typename(obj), index); + + if (obj->parent =3D=3D parent) { + return; + } + + object_ref(obj); + object_unparent(obj); + object_property_add_child( + parent, DEVICE(obj)->id ? DEVICE(obj)->id : default_id, obj); + object_unref(obj); +} + PnvChip *pnv_get_chip(PnvMachineState *pnv, uint32_t chip_id) { int i; @@ -2116,6 +2135,8 @@ static void pnv_machine_power8_class_init(ObjectClass= *oc, void *data) =20 pmc->compat =3D compat; pmc->compat_size =3D sizeof(compat); + + machine_class_allow_dynamic_sysbus_dev(mc, TYPE_PNV_PHB); } =20 static void pnv_machine_power9_class_init(ObjectClass *oc, void *data) diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h index 539454fe9d..e489bec019 100644 --- a/include/hw/ppc/pnv.h +++ b/include/hw/ppc/pnv.h @@ -190,6 +190,7 @@ 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); +void pnv_chip_parent_fixup(PnvChip *chip, Object *obj, int index); =20 #define TYPE_PNV_MACHINE MACHINE_TYPE_NAME("powernv") typedef struct PnvMachineClass PnvMachineClass; --=20 2.32.0 From nobody Sun May 19 05:00:02 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=1651950955; cv=none; d=zohomail.com; s=zohoarc; b=WnwdC4A3WVoPXdaigOH/PPBIusvPBDZd96aCCG0NJe6YiXAbtoHjf1piCyLA3raiTEWOJx+S4jabe684bFqchl2Xz8Es+fpt0S/irb/HBPE5IR8ejNJAa10KS/X8tpC2bzmY4kVusNhphPUD8Flg03YpqOiIlA4yY4v2Hl273fo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651950955; 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=bYqOp8k1rU+dDA9esCZEbvwm9fn+nB2WYshFxo7Yl0U=; b=FmKw9zupsf+lDVbbiXFUqiTdbmi4jM3XcbXZ8J0gcNs1XDxWcILbxw83PTsI8BtvLL16NIOkpajm4j+aETuKHcYCCFt5QGZQYUC+H3WH4rHt1brTt8Vp90MqvnP27IEdaC+lSHbzsep4WL2rQ1HsSdnM06qx5fBpHjT2xAkOJGE= 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 1651950955851667.0185991509356; Sat, 7 May 2022 12:15:55 -0700 (PDT) Received: from localhost ([::1]:51886 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnPuE-0004VL-Pq for importer@patchew.org; Sat, 07 May 2022 15:15:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54850) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnPlY-0005fo-DG; Sat, 07 May 2022 15:06:56 -0400 Received: from mail-oi1-x233.google.com ([2607:f8b0:4864:20::233]:34657) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnPlV-0001ZF-LL; Sat, 07 May 2022 15:06:56 -0400 Received: by mail-oi1-x233.google.com with SMTP id j12so6181859oie.1; Sat, 07 May 2022 12:06:52 -0700 (PDT) Received: from balboa.ibmmodules.com (201-1-57-208.dsl.telesp.net.br. [201.1.57.208]) by smtp.gmail.com with ESMTPSA id p1-20020a0568301d4100b0060603221270sm2907397oth.64.2022.05.07.12.06.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 May 2022 12:06:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bYqOp8k1rU+dDA9esCZEbvwm9fn+nB2WYshFxo7Yl0U=; b=KZsf0dCARPjwqew2Vh9TSW0A9E9qAhe2SF+QXg8QTMSjsmcryGrMh+2mec5tSKfogl 3tqqcax9RgXvWhmRx0M9q/QC+WgHElVEvDqcwR4/MGyafbtJCw7xfVz4keEQYQuXCu5L G8Lz6w4fVnMQz2Hfzmi60QNEai1WLwug4fYoL2pQGo0em+FT2vRBWtYUF6+Sd6NhlPGM xIWtS1vsf/B1JF5F4hRr2NAPgRF7zwqasNgNLTrLRgyP7ue/sBGJg45rsC712FASFhuX DJdEra0QPl2dfkzuQJmwQSuvKoDfmqHrA6611rkvcnntIaXCudJK6okavxkGbwwyw35G 0hCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bYqOp8k1rU+dDA9esCZEbvwm9fn+nB2WYshFxo7Yl0U=; b=m3atUxTnhErIpAGD/VewBa761ZS1H63wY77o/PvY3MwzNapHo5DMmjHG4n3MHt5etr 4Lu+WK5WciVZOk9962DeVN4hewUF9dxrZ1jFODZnBY3y5pBWTVBAdk83knucl/hXxDBE O+J/XcBOy3djF8kiyiUDSxBe2rY1raxHC4UxNZOxDFp9Ze5R8xJrx+a8Uhebc7zngY4E 1aw75BwBmmDL8agceEEz1ZL1NJ/iQ4FxHvmAN8Z9qpc4sksGCiXD4RvvxxTX7BN1OS6y kIJ2qlvXYeIUUj9XG0aQS4VXGGVVgOkeqrIKjZ0LaL0fVkh9An5/IeKy48vpX3M6ZyU2 xR9w== X-Gm-Message-State: AOAM531VdiSkUueNFOy97gVgh/5ortWO3Tgjv5fgcj1W+F3ZfnZJlizU fLVO+OMfscRfixYavpk0tmHzt+VHeHI= X-Google-Smtp-Source: ABdhPJxd1LODqxYyZj43Y2NlPEgkNaDzrpucubExJmeHr27FaOXA7rHXZQjaJqBbF934w4toyXujUg== X-Received: by 2002:aca:ead4:0:b0:2ec:ba66:12df with SMTP id i203-20020acaead4000000b002ecba6612dfmr8054176oih.194.1651950411765; Sat, 07 May 2022 12:06:51 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, clg@kaod.org, fbarrat@linux.ibm.com, Daniel Henrique Barboza Subject: [PATCH 08/17] ppc/pnv: remove PnvPHB4 Date: Sat, 7 May 2022 16:06:15 -0300 Message-Id: <20220507190624.507419-9-danielhb413@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220507190624.507419-1-danielhb413@gmail.com> References: <20220507190624.507419-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::233; envelope-from=danielhb413@gmail.com; helo=mail-oi1-x233.google.com 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, 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, 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 @gmail.com) X-ZM-MESSAGEID: 1651950956826100001 Content-Type: text/plain; charset="utf-8" The PnvPHB device is able to replace the PnvPHB4 device in all instances, while also being usable by the PHB3 logic. The PnvPHB4 device wasn't user creatable in any official QEMU release, so we can remove it without breaking ABI. Signed-off-by: Daniel Henrique Barboza --- hw/pci-host/pnv_phb.c | 15 ++++ hw/pci-host/pnv_phb4.c | 138 +++++++++++---------------------- hw/pci-host/pnv_phb4_pec.c | 4 +- hw/ppc/pnv.c | 2 +- include/hw/pci-host/pnv_phb4.h | 98 +++-------------------- 5 files changed, 75 insertions(+), 182 deletions(-) diff --git a/hw/pci-host/pnv_phb.c b/hw/pci-host/pnv_phb.c index e4c4cca311..9583c703d4 100644 --- a/hw/pci-host/pnv_phb.c +++ b/hw/pci-host/pnv_phb.c @@ -55,7 +55,10 @@ static void pnv_phb_instance_init(Object *obj) !strcmp(chip_typename, TYPE_PNV_CHIP_POWER8E) || !strcmp(chip_typename, TYPE_PNV_CHIP_POWER8NVL)) { pnv_phb3_instance_init(obj); + return; } + + pnv_phb4_instance_init(obj); } =20 static void pnv_phb_realize(DeviceState *dev, Error **errp) @@ -69,7 +72,10 @@ static void pnv_phb_realize(DeviceState *dev, Error **er= rp) !strcmp(chip_typename, TYPE_PNV_CHIP_POWER8NVL)) { /* PnvPHB3 */ pnv_phb3_realize(dev, errp); + return; } + + pnv_phb4_realize(dev, errp); } =20 static const char *pnv_phb_root_bus_path(PCIHostState *host_bridge, @@ -86,6 +92,8 @@ static Property pnv_phb_properties[] =3D { DEFINE_PROP_UINT32("index", PnvPHB, phb_id, 0), DEFINE_PROP_UINT32("chip-id", PnvPHB, chip_id, 0), DEFINE_PROP_LINK("chip", PnvPHB, chip, TYPE_PNV_CHIP, PnvChip *), + DEFINE_PROP_LINK("pec", PnvPHB, pec, TYPE_PNV_PHB4_PEC, + PnvPhb4PecState *), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -93,12 +101,15 @@ static void pnv_phb_class_init(ObjectClass *klass, voi= d *data) { PCIHostBridgeClass *hc =3D PCI_HOST_BRIDGE_CLASS(klass); DeviceClass *dc =3D DEVICE_CLASS(klass); + XiveNotifierClass *xfc =3D XIVE_NOTIFIER_CLASS(klass); =20 hc->root_bus_path =3D pnv_phb_root_bus_path; dc->realize =3D pnv_phb_realize; device_class_set_props(dc, pnv_phb_properties); set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); dc->user_creatable =3D true; + + xfc->notify =3D pnv_phb4_xive_notify; } =20 static const TypeInfo pnv_phb_type_info =3D { @@ -107,6 +118,10 @@ static const TypeInfo pnv_phb_type_info =3D { .instance_size =3D sizeof(PnvPHB), .class_init =3D pnv_phb_class_init, .instance_init =3D pnv_phb_instance_init, + .interfaces =3D (InterfaceInfo[]) { + { TYPE_XIVE_NOTIFIER }, + { }, + }, }; =20 static void pnv_phb_register_types(void) diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c index 13ba9e45d8..becfd366f1 100644 --- a/hw/pci-host/pnv_phb4.c +++ b/hw/pci-host/pnv_phb4.c @@ -47,7 +47,7 @@ static inline uint64_t SETFIELD(uint64_t mask, uint64_t w= ord, return (word & ~mask) | ((value << ctz64(mask)) & mask); } =20 -static PCIDevice *pnv_phb4_find_cfg_dev(PnvPHB4 *phb) +static PCIDevice *pnv_phb4_find_cfg_dev(PnvPHB *phb) { PCIHostState *pci =3D PCI_HOST_BRIDGE(phb); uint64_t addr =3D phb->regs[PHB_CONFIG_ADDRESS >> 3]; @@ -70,7 +70,7 @@ static PCIDevice *pnv_phb4_find_cfg_dev(PnvPHB4 *phb) * The CONFIG_DATA register expects little endian accesses, but as the * region is big endian, we have to swap the value. */ -static void pnv_phb4_config_write(PnvPHB4 *phb, unsigned off, +static void pnv_phb4_config_write(PnvPHB *phb, unsigned off, unsigned size, uint64_t val) { uint32_t cfg_addr, limit; @@ -105,7 +105,7 @@ static void pnv_phb4_config_write(PnvPHB4 *phb, unsigne= d off, pci_host_config_write_common(pdev, cfg_addr, limit, val, size); } =20 -static uint64_t pnv_phb4_config_read(PnvPHB4 *phb, unsigned off, +static uint64_t pnv_phb4_config_read(PnvPHB *phb, unsigned off, unsigned size) { uint32_t cfg_addr, limit; @@ -142,7 +142,7 @@ static uint64_t pnv_phb4_config_read(PnvPHB4 *phb, unsi= gned off, /* * Root complex register accesses are memory mapped. */ -static void pnv_phb4_rc_config_write(PnvPHB4 *phb, unsigned off, +static void pnv_phb4_rc_config_write(PnvPHB *phb, unsigned off, unsigned size, uint64_t val) { PCIHostState *pci =3D PCI_HOST_BRIDGE(phb); @@ -163,7 +163,7 @@ static void pnv_phb4_rc_config_write(PnvPHB4 *phb, unsi= gned off, bswap32(val), 4); } =20 -static uint64_t pnv_phb4_rc_config_read(PnvPHB4 *phb, unsigned off, +static uint64_t pnv_phb4_rc_config_read(PnvPHB *phb, unsigned off, unsigned size) { PCIHostState *pci =3D PCI_HOST_BRIDGE(phb); @@ -185,7 +185,7 @@ static uint64_t pnv_phb4_rc_config_read(PnvPHB4 *phb, u= nsigned off, return bswap32(val); } =20 -static void pnv_phb4_check_mbt(PnvPHB4 *phb, uint32_t index) +static void pnv_phb4_check_mbt(PnvPHB *phb, uint32_t index) { uint64_t base, start, size, mbe0, mbe1; MemoryRegion *parent; @@ -248,7 +248,7 @@ static void pnv_phb4_check_mbt(PnvPHB4 *phb, uint32_t i= ndex) memory_region_add_subregion(parent, base, &phb->mr_mmio[index]); } =20 -static void pnv_phb4_check_all_mbt(PnvPHB4 *phb) +static void pnv_phb4_check_all_mbt(PnvPHB *phb) { uint64_t i; uint32_t num_windows =3D phb->big_phb ? PNV_PHB4_MAX_MMIO_WINDOWS : @@ -259,7 +259,7 @@ static void pnv_phb4_check_all_mbt(PnvPHB4 *phb) } } =20 -static uint64_t *pnv_phb4_ioda_access(PnvPHB4 *phb, +static uint64_t *pnv_phb4_ioda_access(PnvPHB *phb, unsigned *out_table, unsigned *out_i= dx) { uint64_t adreg =3D phb->regs[PHB_IODA_ADDR >> 3]; @@ -336,7 +336,7 @@ static uint64_t *pnv_phb4_ioda_access(PnvPHB4 *phb, return tptr; } =20 -static uint64_t pnv_phb4_ioda_read(PnvPHB4 *phb) +static uint64_t pnv_phb4_ioda_read(PnvPHB *phb) { unsigned table, idx; uint64_t *tptr; @@ -355,7 +355,7 @@ static uint64_t pnv_phb4_ioda_read(PnvPHB4 *phb) return *tptr; } =20 -static void pnv_phb4_ioda_write(PnvPHB4 *phb, uint64_t val) +static void pnv_phb4_ioda_write(PnvPHB *phb, uint64_t val) { unsigned table, idx; uint64_t *tptr; @@ -419,7 +419,7 @@ static void pnv_phb4_ioda_write(PnvPHB4 *phb, uint64_t = val) } } =20 -static void pnv_phb4_rtc_invalidate(PnvPHB4 *phb, uint64_t val) +static void pnv_phb4_rtc_invalidate(PnvPHB *phb, uint64_t val) { PnvPhb4DMASpace *ds; =20 @@ -458,7 +458,7 @@ static void pnv_phb4_update_msi_regions(PnvPhb4DMASpace= *ds) } } =20 -static void pnv_phb4_update_all_msi_regions(PnvPHB4 *phb) +static void pnv_phb4_update_all_msi_regions(PnvPHB *phb) { PnvPhb4DMASpace *ds; =20 @@ -467,7 +467,7 @@ static void pnv_phb4_update_all_msi_regions(PnvPHB4 *ph= b) } } =20 -static void pnv_phb4_update_xsrc(PnvPHB4 *phb) +static void pnv_phb4_update_xsrc(PnvPHB *phb) { int shift, flags, i, lsi_base; XiveSource *xsrc =3D &phb->xsrc; @@ -518,7 +518,7 @@ static void pnv_phb4_update_xsrc(PnvPHB4 *phb) static void pnv_phb4_reg_write(void *opaque, hwaddr off, uint64_t val, unsigned size) { - PnvPHB4 *phb =3D PNV_PHB4(opaque); + PnvPHB *phb =3D PNV_PHB(opaque); bool changed; =20 /* Special case outbound configuration data */ @@ -656,7 +656,7 @@ static void pnv_phb4_reg_write(void *opaque, hwaddr off= , uint64_t val, =20 static uint64_t pnv_phb4_reg_read(void *opaque, hwaddr off, unsigned size) { - PnvPHB4 *phb =3D PNV_PHB4(opaque); + PnvPHB *phb =3D PNV_PHB(opaque); uint64_t val; =20 if ((off & 0xfffc) =3D=3D PHB_CONFIG_DATA) { @@ -752,7 +752,7 @@ static const MemoryRegionOps pnv_phb4_reg_ops =3D { =20 static uint64_t pnv_phb4_xscom_read(void *opaque, hwaddr addr, unsigned si= ze) { - PnvPHB4 *phb =3D PNV_PHB4(opaque); + PnvPHB *phb =3D PNV_PHB(opaque); uint32_t reg =3D addr >> 3; uint64_t val; hwaddr offset; @@ -805,7 +805,7 @@ static uint64_t pnv_phb4_xscom_read(void *opaque, hwadd= r addr, unsigned size) static void pnv_phb4_xscom_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { - PnvPHB4 *phb =3D PNV_PHB4(opaque); + PnvPHB *phb =3D PNV_PHB(opaque); uint32_t reg =3D addr >> 3; hwaddr offset; =20 @@ -868,7 +868,7 @@ const MemoryRegionOps pnv_phb4_xscom_ops =3D { static uint64_t pnv_pec_stk_nest_xscom_read(void *opaque, hwaddr addr, unsigned size) { - PnvPHB4 *phb =3D PNV_PHB4(opaque); + PnvPHB *phb =3D PNV_PHB(opaque); uint32_t reg =3D addr >> 3; =20 /* TODO: add list of allowed registers and error out if not */ @@ -876,14 +876,14 @@ static uint64_t pnv_pec_stk_nest_xscom_read(void *opa= que, hwaddr addr, } =20 /* - * Return the 'stack_no' of a PHB4. 'stack_no' is the order + * Return the 'stack_no' of a PHB. 'stack_no' is the order * the PHB4 occupies in the PEC. This is the reverse of what * pnv_phb4_pec_get_phb_id() does. * * E.g. a phb with phb_id =3D 4 and pec->index =3D 1 (PEC1) will * be the second phb (stack_no =3D 1) of the PEC. */ -static int pnv_phb4_get_phb_stack_no(PnvPHB4 *phb) +static int pnv_phb4_get_phb_stack_no(PnvPHB *phb) { PnvPhb4PecState *pec =3D phb->pec; PnvPhb4PecClass *pecc =3D PNV_PHB4_PEC_GET_CLASS(pec); @@ -897,7 +897,7 @@ static int pnv_phb4_get_phb_stack_no(PnvPHB4 *phb) return stack_no; } =20 -static void pnv_phb4_update_regions(PnvPHB4 *phb) +static void pnv_phb4_update_regions(PnvPHB *phb) { /* Unmap first always */ if (memory_region_is_mapped(&phb->mr_regs)) { @@ -921,7 +921,7 @@ static void pnv_phb4_update_regions(PnvPHB4 *phb) pnv_phb4_check_all_mbt(phb); } =20 -static void pnv_pec_phb_update_map(PnvPHB4 *phb) +static void pnv_pec_phb_update_map(PnvPHB *phb) { PnvPhb4PecState *pec =3D phb->pec; MemoryRegion *sysmem =3D get_system_memory(); @@ -1010,7 +1010,7 @@ static void pnv_pec_phb_update_map(PnvPHB4 *phb) static void pnv_pec_stk_nest_xscom_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { - PnvPHB4 *phb =3D PNV_PHB4(opaque); + PnvPHB *phb =3D PNV_PHB(opaque); PnvPhb4PecState *pec =3D phb->pec; uint32_t reg =3D addr >> 3; =20 @@ -1099,7 +1099,7 @@ static const MemoryRegionOps pnv_pec_stk_nest_xscom_o= ps =3D { static uint64_t pnv_pec_stk_pci_xscom_read(void *opaque, hwaddr addr, unsigned size) { - PnvPHB4 *phb =3D PNV_PHB4(opaque); + PnvPHB *phb =3D PNV_PHB(opaque); uint32_t reg =3D addr >> 3; =20 /* TODO: add list of allowed registers and error out if not */ @@ -1109,7 +1109,7 @@ static uint64_t pnv_pec_stk_pci_xscom_read(void *opaq= ue, hwaddr addr, static void pnv_pec_stk_pci_xscom_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { - PnvPHB4 *phb =3D PNV_PHB4(opaque); + PnvPHB *phb =3D PNV_PHB(opaque); uint32_t reg =3D addr >> 3; =20 switch (reg) { @@ -1172,7 +1172,7 @@ static int pnv_phb4_map_irq(PCIDevice *pci_dev, int i= rq_num) =20 static void pnv_phb4_set_irq(void *opaque, int irq_num, int level) { - PnvPHB4 *phb =3D PNV_PHB4(opaque); + PnvPHB *phb =3D PNV_PHB(opaque); uint32_t lsi_base; =20 /* LSI only ... */ @@ -1407,7 +1407,7 @@ static void pnv_phb4_msi_write(void *opaque, hwaddr a= ddr, uint64_t data, unsigned size) { PnvPhb4DMASpace *ds =3D opaque; - PnvPHB4 *phb =3D ds->phb; + PnvPHB *phb =3D ds->phb; =20 uint32_t src =3D ((addr >> 4) & 0xffff) | (data & 0x1f); =20 @@ -1444,7 +1444,7 @@ static const MemoryRegionOps pnv_phb4_msi_ops =3D { .endianness =3D DEVICE_LITTLE_ENDIAN }; =20 -static PnvPhb4DMASpace *pnv_phb4_dma_find(PnvPHB4 *phb, PCIBus *bus, int d= evfn) +static PnvPhb4DMASpace *pnv_phb4_dma_find(PnvPHB *phb, PCIBus *bus, int de= vfn) { PnvPhb4DMASpace *ds; =20 @@ -1458,7 +1458,7 @@ static PnvPhb4DMASpace *pnv_phb4_dma_find(PnvPHB4 *ph= b, PCIBus *bus, int devfn) =20 static AddressSpace *pnv_phb4_dma_iommu(PCIBus *bus, void *opaque, int dev= fn) { - PnvPHB4 *phb =3D opaque; + PnvPHB *phb =3D opaque; PnvPhb4DMASpace *ds; char name[32]; =20 @@ -1488,7 +1488,7 @@ static AddressSpace *pnv_phb4_dma_iommu(PCIBus *bus, = void *opaque, int devfn) return &ds->dma_as; } =20 -static void pnv_phb4_xscom_realize(PnvPHB4 *phb) +static void pnv_phb4_xscom_realize(PnvPHB *phb) { PnvPhb4PecState *pec =3D phb->pec; PnvPhb4PecClass *pecc =3D PNV_PHB4_PEC_GET_CLASS(pec); @@ -1534,9 +1534,9 @@ static void pnv_phb4_xscom_realize(PnvPHB4 *phb) &phb->phb_regs_mr); } =20 -static void pnv_phb4_instance_init(Object *obj) +void pnv_phb4_instance_init(Object *obj) { - PnvPHB4 *phb =3D PNV_PHB4(obj); + PnvPHB *phb =3D PNV_PHB(obj); =20 QLIST_INIT(&phb->dma_spaces); =20 @@ -1544,9 +1544,9 @@ static void pnv_phb4_instance_init(Object *obj) object_initialize_child(obj, "source", &phb->xsrc, TYPE_XIVE_SOURCE); } =20 -static void pnv_phb4_realize(DeviceState *dev, Error **errp) +void pnv_phb4_realize(DeviceState *dev, Error **errp) { - PnvPHB4 *phb =3D PNV_PHB4(dev); + PnvPHB *phb =3D PNV_PHB(dev); PCIHostState *pci =3D PCI_HOST_BRIDGE(dev); XiveSource *xsrc =3D &phb->xsrc; int nr_irqs; @@ -1602,22 +1602,12 @@ static void pnv_phb4_realize(DeviceState *dev, Erro= r **errp) pnv_phb4_xscom_realize(phb); } =20 -static const char *pnv_phb4_root_bus_path(PCIHostState *host_bridge, - PCIBus *rootbus) -{ - PnvPHB4 *phb =3D PNV_PHB4(host_bridge); - - snprintf(phb->bus_path, sizeof(phb->bus_path), "00%02x:%02x", - phb->chip_id, phb->phb_id); - return phb->bus_path; -} - /* * Address base trigger mode (POWER10) * * Trigger directly the IC ESB page */ -static void pnv_phb4_xive_notify_abt(PnvPHB4 *phb, uint32_t srcno, +static void pnv_phb4_xive_notify_abt(PnvPHB *phb, uint32_t srcno, bool pq_checked) { uint64_t notif_port =3D phb->regs[PHB_INT_NOTIFY_ADDR >> 3]; @@ -1657,7 +1647,7 @@ static void pnv_phb4_xive_notify_abt(PnvPHB4 *phb, ui= nt32_t srcno, } } =20 -static void pnv_phb4_xive_notify_ic(PnvPHB4 *phb, uint32_t srcno, +static void pnv_phb4_xive_notify_ic(PnvPHB *phb, uint32_t srcno, bool pq_checked) { uint64_t notif_port =3D phb->regs[PHB_INT_NOTIFY_ADDR >> 3]; @@ -1679,10 +1669,10 @@ static void pnv_phb4_xive_notify_ic(PnvPHB4 *phb, u= int32_t srcno, } } =20 -static void pnv_phb4_xive_notify(XiveNotifier *xf, uint32_t srcno, - bool pq_checked) +void pnv_phb4_xive_notify(XiveNotifier *xf, uint32_t srcno, + bool pq_checked) { - PnvPHB4 *phb =3D PNV_PHB4(xf); + PnvPHB *phb =3D PNV_PHB(xf); =20 if (phb->regs[PHB_CTRLR >> 3] & PHB_CTRLR_IRQ_ABT_MODE) { pnv_phb4_xive_notify_abt(phb, srcno, pq_checked); @@ -1691,45 +1681,10 @@ static void pnv_phb4_xive_notify(XiveNotifier *xf, = uint32_t srcno, } } =20 -static Property pnv_phb4_properties[] =3D { - DEFINE_PROP_UINT32("index", PnvPHB4, phb_id, 0), - DEFINE_PROP_UINT32("chip-id", PnvPHB4, chip_id, 0), - DEFINE_PROP_LINK("pec", PnvPHB4, pec, TYPE_PNV_PHB4_PEC, - PnvPhb4PecState *), - DEFINE_PROP_END_OF_LIST(), -}; - -static void pnv_phb4_class_init(ObjectClass *klass, void *data) -{ - PCIHostBridgeClass *hc =3D PCI_HOST_BRIDGE_CLASS(klass); - DeviceClass *dc =3D DEVICE_CLASS(klass); - XiveNotifierClass *xfc =3D XIVE_NOTIFIER_CLASS(klass); - - hc->root_bus_path =3D pnv_phb4_root_bus_path; - dc->realize =3D pnv_phb4_realize; - device_class_set_props(dc, pnv_phb4_properties); - set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); - dc->user_creatable =3D false; - - xfc->notify =3D pnv_phb4_xive_notify; -} - -static const TypeInfo pnv_phb4_type_info =3D { - .name =3D TYPE_PNV_PHB4, - .parent =3D TYPE_PCIE_HOST_BRIDGE, - .instance_init =3D pnv_phb4_instance_init, - .instance_size =3D sizeof(PnvPHB4), - .class_init =3D pnv_phb4_class_init, - .interfaces =3D (InterfaceInfo[]) { - { TYPE_XIVE_NOTIFIER }, - { }, - } -}; - static const TypeInfo pnv_phb5_type_info =3D { .name =3D TYPE_PNV_PHB5, - .parent =3D TYPE_PNV_PHB4, - .instance_size =3D sizeof(PnvPHB4), + .parent =3D TYPE_PNV_PHB, + .instance_size =3D sizeof(PnvPHB), }; =20 static void pnv_phb4_root_bus_class_init(ObjectClass *klass, void *data) @@ -1779,14 +1734,14 @@ static void pnv_phb4_root_port_realize(DeviceState = *dev, Error **errp) PCIERootPortClass *rpc =3D PCIE_ROOT_PORT_GET_CLASS(dev); PCIDevice *pci =3D PCI_DEVICE(dev); PCIBus *bus =3D pci_get_bus(pci); - PnvPHB4 *phb =3D NULL; + PnvPHB *phb =3D NULL; Error *local_err =3D NULL; =20 - phb =3D (PnvPHB4 *) object_dynamic_cast(OBJECT(bus->qbus.parent), - TYPE_PNV_PHB4); + phb =3D (PnvPHB *) object_dynamic_cast(OBJECT(bus->qbus.parent), + TYPE_PNV_PHB); =20 if (!phb) { - error_setg(errp, "%s must be connected to pnv-phb4 buses", dev->id= ); + error_setg(errp, "%s must be connected to pnv-phb buses", dev->id); return; } =20 @@ -1856,14 +1811,13 @@ static void pnv_phb4_register_types(void) type_register_static(&pnv_phb4_root_bus_info); type_register_static(&pnv_phb5_root_port_info); type_register_static(&pnv_phb4_root_port_info); - type_register_static(&pnv_phb4_type_info); type_register_static(&pnv_phb5_type_info); type_register_static(&pnv_phb4_iommu_memory_region_info); } =20 type_init(pnv_phb4_register_types); =20 -void pnv_phb4_pic_print_info(PnvPHB4 *phb, Monitor *mon) +void pnv_phb4_pic_print_info(PnvPHB *phb, Monitor *mon) { uint64_t notif_port =3D phb->regs[PHB_INT_NOTIFY_ADDR >> 3] & ~PHB_INT_NOTIFY_ADDR_64K; diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c index 61bc0b503e..3eed560e44 100644 --- a/hw/pci-host/pnv_phb4_pec.c +++ b/hw/pci-host/pnv_phb4_pec.c @@ -116,7 +116,7 @@ static void pnv_pec_default_phb_realize(PnvPhb4PecState= *pec, Error **errp) { PnvPhb4PecClass *pecc =3D PNV_PHB4_PEC_GET_CLASS(pec); - PnvPHB4 *phb =3D PNV_PHB4(qdev_new(pecc->phb_type)); + PnvPHB *phb =3D PNV_PHB(qdev_new(pecc->phb_type)); int phb_id =3D pnv_phb4_pec_get_phb_id(pec, stack_no); =20 object_property_add_child(OBJECT(pec), "phb[*]", OBJECT(phb)); @@ -262,7 +262,7 @@ static void pnv_pec_class_init(ObjectClass *klass, void= *data) pecc->stk_compat =3D stk_compat; pecc->stk_compat_size =3D sizeof(stk_compat); pecc->version =3D PNV_PHB4_VERSION; - pecc->phb_type =3D TYPE_PNV_PHB4; + pecc->phb_type =3D TYPE_PNV_PHB; pecc->num_phbs =3D pnv_pec_num_phbs; pecc->rp_model =3D TYPE_PNV_PHB4_ROOT_PORT; } diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index d9e7530cd3..34a200a29c 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -676,7 +676,7 @@ static void pnv_chip_power8_pic_print_info(PnvChip *chi= p, Monitor *mon) static int pnv_chip_power9_pic_print_info_child(Object *child, void *opaqu= e) { Monitor *mon =3D opaque; - PnvPHB4 *phb4 =3D (PnvPHB4 *) object_dynamic_cast(child, TYPE_PNV_PHB4= ); + PnvPHB *phb4 =3D (PnvPHB *) object_dynamic_cast(child, TYPE_PNV_PHB); =20 if (phb4) { pnv_phb4_pic_print_info(phb4, mon); diff --git a/include/hw/pci-host/pnv_phb4.h b/include/hw/pci-host/pnv_phb4.h index 19dcbd6f87..65a16f2067 100644 --- a/include/hw/pci-host/pnv_phb4.h +++ b/include/hw/pci-host/pnv_phb4.h @@ -12,12 +12,12 @@ =20 #include "hw/pci/pcie_host.h" #include "hw/pci/pcie_port.h" +#include "hw/pci-host/pnv_phb.h" #include "hw/ppc/xive.h" #include "qom/object.h" =20 typedef struct PnvPhb4PecState PnvPhb4PecState; typedef struct PnvPhb4PecStack PnvPhb4PecStack; -typedef struct PnvPHB4 PnvPHB4; typedef struct PnvChip PnvChip; =20 /* @@ -36,7 +36,7 @@ typedef struct PnvPhb4DMASpace { uint8_t devfn; int pe_num; /* Cached PE number */ #define PHB_INVALID_PE (-1) - PnvPHB4 *phb; + PnvPHB *phb; AddressSpace dma_as; IOMMUMemoryRegion dma_mr; MemoryRegion msi32_mr; @@ -55,11 +55,9 @@ typedef struct PnvPHB4RootPort { PCIESlot parent_obj; } PnvPHB4RootPort; =20 -/* - * PHB4 PCIe Host Bridge for PowerNV machines (POWER9) - */ -#define TYPE_PNV_PHB4 "pnv-phb4" -OBJECT_DECLARE_SIMPLE_TYPE(PnvPHB4, PNV_PHB4) +struct PnvPHB4DeviceClass { + DeviceClass parent_class; +}; =20 #define PNV_PHB4_MAX_LSIs 8 #define PNV_PHB4_MAX_INTs 4096 @@ -77,85 +75,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(PnvPHB4, PNV_PHB4) =20 #define PCI_MMIO_TOTAL_SIZE (0x1ull << 60) =20 -struct PnvPHB4 { - PCIExpressHost parent_obj; - - uint32_t chip_id; - uint32_t phb_id; - - uint64_t version; - - /* The owner PEC */ - PnvPhb4PecState *pec; - - char bus_path[8]; - - /* Main register images */ - uint64_t regs[PNV_PHB4_NUM_REGS]; - MemoryRegion mr_regs; - - /* Extra SCOM-only register */ - uint64_t scom_hv_ind_addr_reg; - - /* - * Geometry of the PHB. There are two types, small and big PHBs, a - * number of resources (number of PEs, windows etc...) are doubled - * for a big PHB - */ - bool big_phb; - - /* Memory regions for MMIO space */ - MemoryRegion mr_mmio[PNV_PHB4_MAX_MMIO_WINDOWS]; - - /* PCI side space */ - MemoryRegion pci_mmio; - MemoryRegion pci_io; - - /* PCI registers (excluding pass-through) */ -#define PHB4_PEC_PCI_STK_REGS_COUNT 0xf - uint64_t pci_regs[PHB4_PEC_PCI_STK_REGS_COUNT]; - MemoryRegion pci_regs_mr; - - /* Nest registers */ -#define PHB4_PEC_NEST_STK_REGS_COUNT 0x17 - uint64_t nest_regs[PHB4_PEC_NEST_STK_REGS_COUNT]; - MemoryRegion nest_regs_mr; - - /* PHB pass-through XSCOM */ - MemoryRegion phb_regs_mr; - - /* Memory windows from PowerBus to PHB */ - MemoryRegion phbbar; - MemoryRegion intbar; - MemoryRegion mmbar0; - MemoryRegion mmbar1; - uint64_t mmio0_base; - uint64_t mmio0_size; - uint64_t mmio1_base; - uint64_t mmio1_size; - - /* On-chip IODA tables */ - uint64_t ioda_LIST[PNV_PHB4_MAX_LSIs]; - uint64_t ioda_MIST[PNV_PHB4_MAX_MIST]; - uint64_t ioda_TVT[PNV_PHB4_MAX_TVEs]; - uint64_t ioda_MBT[PNV_PHB4_MAX_MBEs]; - uint64_t ioda_MDT[PNV_PHB4_MAX_PEs]; - uint64_t ioda_PEEV[PNV_PHB4_MAX_PEEVs]; - - /* - * The internal PESTA/B is 2 bits per PE split into two tables, we - * store them in a single array here to avoid wasting space. - */ - uint8_t ioda_PEST_AB[PNV_PHB4_MAX_PEs]; - - /* P9 Interrupt generation */ - XiveSource xsrc; - qemu_irq *qirqs; - - QLIST_HEAD(, PnvPhb4DMASpace) dma_spaces; -}; - -void pnv_phb4_pic_print_info(PnvPHB4 *phb, Monitor *mon); +void pnv_phb4_pic_print_info(PnvPHB *phb, Monitor *mon); int pnv_phb4_pec_get_phb_id(PnvPhb4PecState *pec, int stack_index); extern const MemoryRegionOps pnv_phb4_xscom_ops; =20 @@ -214,7 +134,7 @@ struct PnvPhb4PecClass { =20 #define TYPE_PNV_PHB5 "pnv-phb5" #define PNV_PHB5(obj) \ - OBJECT_CHECK(PnvPhb4, (obj), TYPE_PNV_PHB5) + OBJECT_CHECK(PnvPhb, (obj), TYPE_PNV_PHB5) =20 #define PNV_PHB5_VERSION 0x000000a500000001ull #define PNV_PHB5_DEVICE_ID 0x0652 @@ -223,4 +143,8 @@ struct PnvPhb4PecClass { #define PNV_PHB5_PEC(obj) \ OBJECT_CHECK(PnvPhb4PecState, (obj), TYPE_PNV_PHB5_PEC) =20 +void pnv_phb4_instance_init(Object *obj); +void pnv_phb4_realize(DeviceState *dev, Error **errp); +void pnv_phb4_xive_notify(XiveNotifier *xf, uint32_t srcno, bool pq_checke= d); + #endif /* PCI_HOST_PNV_PHB4_H */ --=20 2.32.0 From nobody Sun May 19 05:00:02 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=1651951092; cv=none; d=zohomail.com; s=zohoarc; b=L/kbo53rtTvcA2LeOa6iV11F33WWh+DQmEjEGNydVmsqTS9fSQc2G5VE5++e+NSGYR5G7vMib+Lc31G88yLLRGOc+OXoRgyB/bnwKBxuIAbnls46ZZl85MH0IShbLF+xki7R29DUSR2uR7ZoY9SSYviUvr5CsZJdN5ooHMj1CrQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651951092; 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=z4dt0AaEFVwxa/sPSU7oQcvtGknrn6YWOKku0j9if14=; b=H9ytWOC9VMm2WA19Qp2Gqu7xM4CZK+549X1uJxywQvzPVzV66V2ARH2z203USrE32zrtu+vmNSuf/ogEXCXO6e4z3oEmW6BaZq1LR6qyLI2bhH1ltqO0uZ2d9BJOPsGfW6ubbVqa49cejxZzh0XRafAXUrVOGyNaA7tP7Yt0/gg= 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 1651951092312506.25410132109835; Sat, 7 May 2022 12:18:12 -0700 (PDT) Received: from localhost ([::1]:59490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnPwR-0001EB-9m for importer@patchew.org; Sat, 07 May 2022 15:18:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54860) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnPlZ-0005kE-E7; Sat, 07 May 2022 15:06:57 -0400 Received: from mail-oi1-x234.google.com ([2607:f8b0:4864:20::234]:40922) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnPlX-0001ZS-MY; Sat, 07 May 2022 15:06:57 -0400 Received: by mail-oi1-x234.google.com with SMTP id y63so11104761oia.7; Sat, 07 May 2022 12:06:54 -0700 (PDT) Received: from balboa.ibmmodules.com (201-1-57-208.dsl.telesp.net.br. [201.1.57.208]) by smtp.gmail.com with ESMTPSA id p1-20020a0568301d4100b0060603221270sm2907397oth.64.2022.05.07.12.06.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 May 2022 12:06:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=z4dt0AaEFVwxa/sPSU7oQcvtGknrn6YWOKku0j9if14=; b=WRviz0ng5DsyzdE2aOQbdjBpasbl7v07PRUARLUSSTw83JJpo4epjVrx7GRUiOzfuE ISa6AUlNu7Z/pZ0j9QLdcX6LYB8eDhUUR9JZ2OiQHP+irX1Zea0zK7g9e7vgCC3C0EXd f+SrQtNSSdBtF64b/dzQTgNz1lmdKdIMZU7sh/cEP/aoRgp/RFYuFo1OeZq/iYslfE8s IpuGejiBjK4/dIM9RwpeWV9KCC6nr+6Az21SBMDOzmO4JVoC1ivkP6srwhDLRel0oqUF YaGrgiddxgcSAbv6Zf1xPrdtERijvK7X7C96X3dca8B4p5LERm4N/lcDOvAtaCGr0czA 2D3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=z4dt0AaEFVwxa/sPSU7oQcvtGknrn6YWOKku0j9if14=; b=BBY5OSJrEd9lI/Q+QBTouwY7jjpQO/536lQXNhfmAxAX6o7Pm4Y6jkpkaoEJtBwFln gELA+qAz+MRHJVj2c/u1wyWchl8mLtuI73ayo9ab1NJEn7MUYnK5I8P+XD2nzAB7ZeDr XJMeNcuL9WhZ1aIK2QAfS6RVhBjstu6NWWPWYjn6xTiplWSe/SbC9LWnj4M4UyGhK2tB iOul+sNX6NXJDXrBwPkTw3UtfyBl2pCouuyPG/L+jl3dNMucqq2pNf/B+rRDEEHxEtAQ slyAVfOd4aZ8GbIj5qdHtEp5rbhJ7B9KOp0KH0uNYW8AhsPpPPV68xWDXp/m5bmlqQXS TTnQ== X-Gm-Message-State: AOAM532TucJKiDDOB1EypOnh/EMwgDuIlgJHxcicteIJI/Nb9gr6dZoS 3dFN10oQE3ZnCeS3ipXSOA89TkbbPns= X-Google-Smtp-Source: ABdhPJyQwUlqEHpc+AWBwM0GOmvILDTrNbPUyrAKUMGGWpHHIBR0W4Va+yo1euIuX6myxOw5zbre3w== X-Received: by 2002:a05:6808:1646:b0:2f9:4b95:2f04 with SMTP id az6-20020a056808164600b002f94b952f04mr4219398oib.208.1651950414092; Sat, 07 May 2022 12:06:54 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, clg@kaod.org, fbarrat@linux.ibm.com, Daniel Henrique Barboza Subject: [PATCH 09/17] ppc/pnv: user creatable pnv-phb for powernv9 Date: Sat, 7 May 2022 16:06:16 -0300 Message-Id: <20220507190624.507419-10-danielhb413@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220507190624.507419-1-danielhb413@gmail.com> References: <20220507190624.507419-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::234; envelope-from=danielhb413@gmail.com; helo=mail-oi1-x234.google.com 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, 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, 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 @gmail.com) X-ZM-MESSAGEID: 1651951093330100001 Content-Type: text/plain; charset="utf-8" This patch reintroduces the powernv8 bits of the code what was removed in commit 9c10d86fee "ppc/pnv: Remove user-created PHB{3,4,5} devices", using the pnv-phb device instead of the now late pnv-phb4 device, allowing us to enable user creatable pnv-phb devices for the powernv9 machine. Signed-off-by: Daniel Henrique Barboza --- hw/pci-host/pnv_phb4.c | 58 +++++++++++++++++++++++++++++++++++++- hw/pci-host/pnv_phb4_pec.c | 6 ++-- hw/ppc/pnv.c | 2 ++ 3 files changed, 63 insertions(+), 3 deletions(-) diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c index becfd366f1..262251ebcf 100644 --- a/hw/pci-host/pnv_phb4.c +++ b/hw/pci-host/pnv_phb4.c @@ -1544,14 +1544,70 @@ void pnv_phb4_instance_init(Object *obj) object_initialize_child(obj, "source", &phb->xsrc, TYPE_XIVE_SOURCE); } =20 +static PnvPhb4PecState *pnv_phb4_get_pec(PnvChip *chip, PnvPHB *phb, + Error **errp) +{ + Pnv9Chip *chip9 =3D PNV9_CHIP(chip); + int chip_id =3D phb->chip_id; + int index =3D phb->phb_id; + int i, j; + + 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 &chip9->pecs[i]; + + for (j =3D 0; j < pec->num_phbs; j++) { + if (index =3D=3D pnv_phb4_pec_get_phb_id(pec, j)) { + return pec; + } + } + } + + error_setg(errp, + "pnv-phb chip-id %d index %d didn't match any existing PEC", + chip_id, index); + + return NULL; +} + void pnv_phb4_realize(DeviceState *dev, Error **errp) { PnvPHB *phb =3D PNV_PHB(dev); + PnvMachineState *pnv =3D PNV_MACHINE(qdev_get_machine()); + PnvChip *chip =3D pnv_get_chip(pnv, phb->chip_id); PCIHostState *pci =3D PCI_HOST_BRIDGE(dev); XiveSource *xsrc =3D &phb->xsrc; + BusState *s; + Error *local_err =3D NULL; int nr_irqs; char name[32]; =20 + if (!chip) { + error_setg(errp, "invalid chip id: %d", phb->chip_id); + return; + } + + /* User created PHBs need to be assigned to a PEC */ + if (!phb->pec) { + phb->pec =3D pnv_phb4_get_pec(chip, phb, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } + } + + /* Reparent the PHB to the chip to build the device tree */ + pnv_chip_parent_fixup(chip, OBJECT(phb), phb->phb_id); + + s =3D qdev_get_parent_bus(DEVICE(chip)); + if (!qdev_set_parent_bus(DEVICE(phb), s, &local_err)) { + error_propagate(errp, local_err); + return; + } + /* Set the "big_phb" flag */ phb->big_phb =3D phb->phb_id =3D=3D 0 || phb->phb_id =3D=3D 3; =20 @@ -1763,7 +1819,7 @@ static void pnv_phb4_root_port_class_init(ObjectClass= *klass, void *data) PCIERootPortClass *rpc =3D PCIE_ROOT_PORT_CLASS(klass); =20 dc->desc =3D "IBM PHB4 PCIE Root Port"; - dc->user_creatable =3D false; + dc->user_creatable =3D true; =20 device_class_set_parent_realize(dc, pnv_phb4_root_port_realize, &rpc->parent_realize); diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c index 3eed560e44..243a079ea7 100644 --- a/hw/pci-host/pnv_phb4_pec.c +++ b/hw/pci-host/pnv_phb4_pec.c @@ -150,8 +150,10 @@ static void pnv_pec_realize(DeviceState *dev, Error **= errp) pec->num_phbs =3D pecc->num_phbs[pec->index]; =20 /* Create PHBs if running with defaults */ - for (i =3D 0; i < pec->num_phbs; i++) { - pnv_pec_default_phb_realize(pec, i, errp); + if (defaults_enabled()) { + for (i =3D 0; i < pec->num_phbs; i++) { + pnv_pec_default_phb_realize(pec, i, errp); + } } =20 /* Initialize the XSCOM regions for the PEC registers */ diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 34a200a29c..1a3cafcb7a 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -2155,6 +2155,8 @@ static void pnv_machine_power9_class_init(ObjectClass= *oc, void *data) pmc->compat =3D compat; pmc->compat_size =3D sizeof(compat); pmc->dt_power_mgt =3D pnv_dt_power_mgt; + + machine_class_allow_dynamic_sysbus_dev(mc, TYPE_PNV_PHB); } =20 static void pnv_machine_power10_class_init(ObjectClass *oc, void *data) --=20 2.32.0 From nobody Sun May 19 05:00:02 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=1651950751; cv=none; d=zohomail.com; s=zohoarc; b=k1nPmtG0U1atcCnCbOXkb25mdMC5FxR58uNAUZDCl5i/zm+epO/AwnKHBcvD3g0/gjmMADdE7GN8EIf0s/zZZjVvXtqw0tAMu51E/NKr/jKc9pixC51nAfX9Wf3Pm3SyYEj9BS/G8QvODwZeH4L6uyFtHaYmiITh++UFHNxoDGM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651950751; 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=YQKLhDM9WB+4se1Uy+XOaAY75EETpfaNLSKciOTKXd0=; b=LOhCU5b6FWlmxfITLlqyUH3dh1Mc5+FedtrPGf0fvrNlwV6E0uP1Gn8HWzDxdCBOfQLHDFa8GKZAFA4ci4qloCTQqDEexEM8a05lzz8eiq6sNXYM2w74OdeslrQBhUXAVeQ2yo3eK7iTuIEO2qXUJgdtm39euwvlGS/rGbObYPM= 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 1651950751958222.3455478703596; Sat, 7 May 2022 12:12:31 -0700 (PDT) Received: from localhost ([::1]:40688 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnPqw-0005WV-VG for importer@patchew.org; Sat, 07 May 2022 15:12:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54882) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnPlb-0005oT-QC; Sat, 07 May 2022 15:06:59 -0400 Received: from mail-oi1-x22b.google.com ([2607:f8b0:4864:20::22b]:36835) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnPlZ-0001Zg-T5; Sat, 07 May 2022 15:06:59 -0400 Received: by mail-oi1-x22b.google.com with SMTP id v66so11126521oib.3; Sat, 07 May 2022 12:06:57 -0700 (PDT) Received: from balboa.ibmmodules.com (201-1-57-208.dsl.telesp.net.br. [201.1.57.208]) by smtp.gmail.com with ESMTPSA id p1-20020a0568301d4100b0060603221270sm2907397oth.64.2022.05.07.12.06.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 May 2022 12:06:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YQKLhDM9WB+4se1Uy+XOaAY75EETpfaNLSKciOTKXd0=; b=mrKPMlL7SMIv1sWiUl//eIJDyoJgEvVLxt9wIqEOwWkuwLjN8SIBQ2YTRvRpo+ZBsp SBPCEv0PEvRGrvegGoobSkro5oxtmwzVILj+xJe6zhWw6K55J1w4K7dumnvYEYg4axPO JtKpghVd6wMUBQRJkW+OzVcuYr7c9uVFVcr8TXIVXpOIzC93TXupXwQJ6M9JCyJKAr+q zKgRIef8WIlG9Cpy0XOEpbv18JqhBsrB455+fpJWw+ASTF7oje5+R4OBZ6nu1D8TpQiU KnR/7sKDVsBHrnwz3O/6BWTyK9P5yJeJEA5WZwnAxLhtRo2NJ8yiaqcwgnaJPd02t2LG CZ5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YQKLhDM9WB+4se1Uy+XOaAY75EETpfaNLSKciOTKXd0=; b=qaVrNt2405WovtKSX2lrUz2wgEPQ/g59dc06PJzZzRlEjPAdLzv/mRMSx79tY7QyUS iaKGUVIF0vSMMQKAAnOPaOgxjvg2c46rw8qRTaf7pSUTOCq7f/5TstqdbS5YusQpvkS2 N5wM7FjQSVG+8hvn1f39dxIkb5VIZNEupamJOw/wRLqZ3v3UDCKJXtJ1o0JaknfFcc8w 23Yrjrj7hU6Brph069c/cVfl9+C0QjFyVEnMK9le9GqLZV6eodnpLMfGHj2SulzG9Igw PL5D4QDeammAoqwtYwXB7EbwRuo7vAk3ESiDb31aXTSKmcqWAIwA8Ui+MBLXr38jIkeU BKvQ== X-Gm-Message-State: AOAM533CMvvysAatgh1sfpLTrV36dDhZq+t1pkMzYexCYJ+EQgzN1CDj eWi+J7g5OJI1dhz6aJ/tzW7SvdrC64U= X-Google-Smtp-Source: ABdhPJwAJnTcyJO5Oeucp6FradsyPckpRPWBhW5TRPCdNXR5wryvKbgT3XsoU+6v95xeT8aEK8tFZg== X-Received: by 2002:aca:ac8c:0:b0:326:13f6:5f5c with SMTP id v134-20020acaac8c000000b0032613f65f5cmr4330307oie.287.1651950416404; Sat, 07 May 2022 12:06:56 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, clg@kaod.org, fbarrat@linux.ibm.com, Daniel Henrique Barboza Subject: [PATCH 10/17] ppc/pnv: use PnvPHB.version Date: Sat, 7 May 2022 16:06:17 -0300 Message-Id: <20220507190624.507419-11-danielhb413@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220507190624.507419-1-danielhb413@gmail.com> References: <20220507190624.507419-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::22b; envelope-from=danielhb413@gmail.com; helo=mail-oi1-x22b.google.com 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, 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, 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 @gmail.com) X-ZM-MESSAGEID: 1651950754100100003 Content-Type: text/plain; charset="utf-8" The 'version' attribute of the PnvPHB was never used. Instead of removing it, let's make use of it by setting the PHB version the PnvPHB device is currently running. This distinction will be used next patch. Signed-off-by: Daniel Henrique Barboza --- hw/pci-host/pnv_phb.c | 11 +++++++++++ include/hw/pci-host/pnv_phb.h | 7 +++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/hw/pci-host/pnv_phb.c b/hw/pci-host/pnv_phb.c index 9583c703d4..cef6a57d50 100644 --- a/hw/pci-host/pnv_phb.c +++ b/hw/pci-host/pnv_phb.c @@ -63,6 +63,7 @@ static void pnv_phb_instance_init(Object *obj) =20 static void pnv_phb_realize(DeviceState *dev, Error **errp) { + PnvPHB *phb =3D PNV_PHB(dev); g_autofree char *chip_typename =3D pnv_phb_get_chip_typename(); =20 g_assert(chip_typename !=3D NULL); @@ -71,10 +72,20 @@ static void pnv_phb_realize(DeviceState *dev, Error **e= rrp) !strcmp(chip_typename, TYPE_PNV_CHIP_POWER8E) || !strcmp(chip_typename, TYPE_PNV_CHIP_POWER8NVL)) { /* PnvPHB3 */ + phb->version =3D PHB_VERSION_3; pnv_phb3_realize(dev, errp); return; } =20 + if (!strcmp(chip_typename, TYPE_PNV_CHIP_POWER9)) { + phb->version =3D PHB_VERSION_4; + } else if (!strcmp(chip_typename, TYPE_PNV_CHIP_POWER10)) { + phb->version =3D PHB_VERSION_5; + } else { + error_setg(errp, "unknown PNV chip: %s", chip_typename); + return; + } + pnv_phb4_realize(dev, errp); } =20 diff --git a/include/hw/pci-host/pnv_phb.h b/include/hw/pci-host/pnv_phb.h index 46158e124f..cceb37d03c 100644 --- a/include/hw/pci-host/pnv_phb.h +++ b/include/hw/pci-host/pnv_phb.h @@ -103,9 +103,14 @@ typedef struct PnvPhb4PecState PnvPhb4PecState; #define TYPE_PNV_PHB "pnv-phb" OBJECT_DECLARE_SIMPLE_TYPE(PnvPHB, PNV_PHB) =20 +#define PHB_VERSION_3 3 +#define PHB_VERSION_4 4 +#define PHB_VERSION_5 5 + struct PnvPHB { PCIExpressHost parent_obj; =20 + uint64_t version; uint32_t chip_id; uint32_t phb_id; char bus_path[8]; @@ -142,8 +147,6 @@ struct PnvPHB { /* * PnvPHB4 attributes */ - uint64_t version; - /* The owner PEC */ PnvPhb4PecState *pec; =20 --=20 2.32.0 From nobody Sun May 19 05:00:02 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=1651950881; cv=none; d=zohomail.com; s=zohoarc; b=IsqBTWPg7RDTim43pRMCdfvaDPX0iNy8E5f2NEOwIDHuJQSHQuzWje0NVx3ShvUGV0q8z5JO5OeYZeE66QAhkoPf1sb4gu2UUOrXD9EzNfyaxoKMrbouyaAs8+sNYVIHovK6ujHHnGOXOq491o8qM9yjQ3WwqN2wLCK3c3zwOaU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651950881; 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=Lyrqtu/ju6nIMFNI5M52L71ErShd0EbZtz7+D8xmNmM=; b=CbNOh2lQJvXB4/qYTI9Xl4D6qTBBtZqdA8lkDOXrA64BWoNSilkm8mfxdXscv9FgJ4VIABNukFKnz/+0NV7ZmeYbBtwOzVqcHVhRgwkCq9IFNpVOVsYrVE3E5DakUOS46zkRGXsG2YI20d0bd9EwSX2q6vZNzDqRGS3CTe+h9xo= 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 1651950881930978.0842192170386; Sat, 7 May 2022 12:14:41 -0700 (PDT) Received: from localhost ([::1]:49202 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnPt2-0002hU-Fb for importer@patchew.org; Sat, 07 May 2022 15:14:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54908) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnPld-0005r7-KP; Sat, 07 May 2022 15:07:03 -0400 Received: from mail-oi1-x229.google.com ([2607:f8b0:4864:20::229]:43760) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnPlc-0001Zt-51; Sat, 07 May 2022 15:07:01 -0400 Received: by mail-oi1-x229.google.com with SMTP id v65so11105183oig.10; Sat, 07 May 2022 12:06:59 -0700 (PDT) Received: from balboa.ibmmodules.com (201-1-57-208.dsl.telesp.net.br. [201.1.57.208]) by smtp.gmail.com with ESMTPSA id p1-20020a0568301d4100b0060603221270sm2907397oth.64.2022.05.07.12.06.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 May 2022 12:06:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Lyrqtu/ju6nIMFNI5M52L71ErShd0EbZtz7+D8xmNmM=; b=GEaIdZgjMsYAJPz0HSB9oLIsA2XlI1wATZYzC/rsPTYcmTvAM4q+kRwZY5DRWA5q7F LSXAq+zGb0k7fdNdteMPNAhB4T1Fz1TklWxaQ5PVkpzEr1qFsjz0mADSGImnrPIjhznc 4+qtBwmIFJZuEnPhqqDwuWjur7rg8K3lVW1EDrL8B7bHbMhEtKLXgiKdElPdtBF/t6pz KRfI8iCo9tc8wnzVBvJbh4bxoOATHPx+/lN7lfZO+S3DnCTVC7nnP9dvDU5bTShj4kBL qKXh+EM/Kxha3O+toFTWTBFJMdSPXumypriumym++bQUZVwMWfZaf1/kz9Sm8URE8PRP 3uxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Lyrqtu/ju6nIMFNI5M52L71ErShd0EbZtz7+D8xmNmM=; b=gKDM1x/mm7hudxN6rClelrv6IWvBkzFv7P1ZnKAaA3PAh22C5ymKyooHhKv6YWpN1O qEOL0SXz9FL2lZpvXmT+VqoLaC6lzMBvnd0NLrWpRuI3SuDLqNKGZQp5d77M7BFrOlh3 PH68PVydInELBq8391VsbZOi/urWzoXTPGAboNYd/DmP92RnfP3q4vE845Jq6ZejgjxX 2gjPhCIzCK0KYYmovR7ASOf56HY0bANBHuuxlaVGx67IOft4WwdSYc0AvpkMgJPRk+AU sdcSMqVuuFD3VCGJRlQXKpVgHc94R1tlbruF7G4JMqENcpIhScqlshz/d+Cv+nyHuS6Z LLHA== X-Gm-Message-State: AOAM5337867T+IyGPLLi0qIXMFZBRlif6JPuHP4namNSRlBq3Uus384v tzcGnCegPp5yEDhxltJo69R3+AYfF1Y= X-Google-Smtp-Source: ABdhPJxkFcvTQyMZK5+Htm1UDk4M6DcKBN4abk5TlFgvT6I9GJ9mRbVjk+RBARvfWoYUP4JMROIAEg== X-Received: by 2002:a05:6808:ecc:b0:322:319c:cd3 with SMTP id q12-20020a0568080ecc00b00322319c0cd3mr7670277oiv.148.1651950418753; Sat, 07 May 2022 12:06:58 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, clg@kaod.org, fbarrat@linux.ibm.com, Daniel Henrique Barboza Subject: [PATCH 11/17] ppc/pnv: change pnv_phb4_get_pec() to also retrieve chip10->pecs Date: Sat, 7 May 2022 16:06:18 -0300 Message-Id: <20220507190624.507419-12-danielhb413@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220507190624.507419-1-danielhb413@gmail.com> References: <20220507190624.507419-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::229; envelope-from=danielhb413@gmail.com; helo=mail-oi1-x229.google.com 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, 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, 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 @gmail.com) X-ZM-MESSAGEID: 1651950882563100001 Content-Type: text/plain; charset="utf-8" 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_phb4.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c index 262251ebcf..f911957f10 100644 --- a/hw/pci-host/pnv_phb4.c +++ b/hw/pci-host/pnv_phb4.c @@ -1547,17 +1547,29 @@ void pnv_phb4_instance_init(Object *obj) static PnvPhb4PecState *pnv_phb4_get_pec(PnvChip *chip, PnvPHB *phb, Error **errp) { - Pnv9Chip *chip9 =3D PNV9_CHIP(chip); + PnvPhb4PecState *pecs =3D NULL; int chip_id =3D phb->chip_id; int index =3D phb->phb_id; int i, j; =20 + if (phb->version =3D=3D PHB_VERSION_4) { + Pnv9Chip *chip9 =3D PNV9_CHIP(chip); + + pecs =3D chip9->pecs; + } else if (phb->version =3D=3D PHB_VERSION_5) { + Pnv10Chip *chip10 =3D PNV10_CHIP(chip); + + pecs =3D chip10->pecs; + } else { + return NULL; + } + 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 &chip9->pecs[i]; + PnvPhb4PecState *pec =3D &pecs[i]; =20 for (j =3D 0; j < pec->num_phbs; j++) { if (index =3D=3D pnv_phb4_pec_get_phb_id(pec, j)) { --=20 2.32.0 From nobody Sun May 19 05:00:02 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=1651951104; cv=none; d=zohomail.com; s=zohoarc; b=DKFEKtNlxp1OI7JzS//VLbb9IhhODMx1lXPfaBJhAABDGXINyia5LBxQnfEgJ7HxeDw0/2Kn+tkNMTKpqa4Uul1qnusC9g04zdtuWrjKc7xtU2QTIdreOw24ktxSRFAqJc3gcGf407OXGWGs6CaE2VcB+DLDeChugwXJK/KBzCQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651951104; 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=xmyvjZGeJMptuTaPZY79LPqXlpBB0BF1k94gn8nzXV4=; b=mm71AK74Z9+y5Nhatn/bRCcpCo6jM1Ej9I7lSpiAA3hlY+9OlbtRYiFaXohhm0vTIwNLPtco2W30BGVaxVaNo40F9nRk6TIY82/HzA0VhrmVqBDxcfit0E1kAGSquZTu+i8Z+Z2dFxWcNOOecr9UcI/ONGTH6FyxcCOfFs4mTtY= 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 1651951104481177.50554843661985; Sat, 7 May 2022 12:18:24 -0700 (PDT) Received: from localhost ([::1]:60450 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnPwd-0001vt-H5 for importer@patchew.org; Sat, 07 May 2022 15:18:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54930) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnPlf-0005rs-DJ; Sat, 07 May 2022 15:07:03 -0400 Received: from mail-oa1-x2c.google.com ([2001:4860:4864:20::2c]:39927) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnPle-0001XG-1U; Sat, 07 May 2022 15:07:03 -0400 Received: by mail-oa1-x2c.google.com with SMTP id 586e51a60fabf-deb9295679so10547896fac.6; Sat, 07 May 2022 12:07:01 -0700 (PDT) Received: from balboa.ibmmodules.com (201-1-57-208.dsl.telesp.net.br. [201.1.57.208]) by smtp.gmail.com with ESMTPSA id p1-20020a0568301d4100b0060603221270sm2907397oth.64.2022.05.07.12.06.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 May 2022 12:07:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xmyvjZGeJMptuTaPZY79LPqXlpBB0BF1k94gn8nzXV4=; b=Oz3dbZxtZyV7lni0meyjy/6pg+2XbS3jUU4yrwdtzkRDqT9CKGy/N+nmEhZNa5zGop rNRwtiwCRk/W4l18CULUXfT+mDjzTVXIwDx7kkBj6rjlgGR1bdMg10uhBCQEzipPPuwA pzH0muNkE+xXa15cN+xhy/3hvdmqSfnp6RYeHmxEWedx+mqg6lh9ruPX63+qWFXPx9uz EOFqodXDNATgssyz1y4ua+9dnNmlqLdG4Rlc3dY2meoxVdtmwckooojx0+3NxFuD9Axa Ic14SUt0Qa2PwnvziWdPqnkUmH6zk3HivfavKh27t44SGXnJ7ySwuYbovEBvVB7fPE88 4ZFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xmyvjZGeJMptuTaPZY79LPqXlpBB0BF1k94gn8nzXV4=; b=JqHttcIavkdrNiSpLu/NP7SefiPfQMUmRlpigxZhkWXsHPhgHkTZ41zEnHBk8KgKag WzngJkuOLSjUs/dtNzov0Ne2b5/kbd1qaug7IpNz4N9wgGl47aa8IDxOmwho3hkl2zY2 H6NSrr5rILI08KEO4074/qdgbubvtFlgP/ERFfJwerHMz3CZT9ltvWwz40ngiI3uEZTl UVrQ0QKU5gP6IfInvVwwQZjd5B3REcx7P0ozowKByut57BnvEYRIKLR5DRRJQSFTofbU XHOl+REzVaAC36UEEMJu+HXuskbJ64FduN6qHLpy5U6SI4YWL7b9zm6KdTG4x6TZ9EQp ELWA== X-Gm-Message-State: AOAM531FS8eGzK598XQzabMW5OfAayfqky4MEJ2yMVd7tPUbzNw/tcZb GJIev3mcMPa18SfIgLeO+ZKqa3xYvhM= X-Google-Smtp-Source: ABdhPJyFWcdn53SxtieUZ3jAVA0ymS7TyhRi52aoxLErMdOdldoWs9Lv7xCzk/hVUBHJpH+cVK8lvw== X-Received: by 2002:a05:6870:8985:b0:da:b3f:3253 with SMTP id f5-20020a056870898500b000da0b3f3253mr3648866oaq.259.1651950420925; Sat, 07 May 2022 12:07:00 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, clg@kaod.org, fbarrat@linux.ibm.com, Daniel Henrique Barboza Subject: [PATCH 12/17] ppc/pnv: user creatable pnv-phb for powernv10 Date: Sat, 7 May 2022 16:06:19 -0300 Message-Id: <20220507190624.507419-13-danielhb413@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220507190624.507419-1-danielhb413@gmail.com> References: <20220507190624.507419-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=2001:4860:4864:20::2c; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x2c.google.com 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, 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, 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 @gmail.com) X-ZM-MESSAGEID: 1651951105327100003 Content-Type: text/plain; charset="utf-8" Given that powernv9 and powernv10 uses the same pnv-phb backend, the logic = to allow user created pnv-phbs for powernv10 is already in place. This patch just flips the switch. Signed-off-by: Daniel Henrique Barboza --- hw/pci-host/pnv_phb4.c | 2 +- hw/ppc/pnv.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c index f911957f10..fb3222d458 100644 --- a/hw/pci-host/pnv_phb4.c +++ b/hw/pci-host/pnv_phb4.c @@ -1861,7 +1861,7 @@ static void pnv_phb5_root_port_class_init(ObjectClass= *klass, void *data) PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); =20 dc->desc =3D "IBM PHB5 PCIE Root Port"; - dc->user_creatable =3D false; + dc->user_creatable =3D true; =20 k->vendor_id =3D PCI_VENDOR_ID_IBM; k->device_id =3D PNV_PHB5_DEVICE_ID; diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 1a3cafcb7a..bb193b1ed3 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -2174,6 +2174,8 @@ static void pnv_machine_power10_class_init(ObjectClas= s *oc, void *data) pmc->dt_power_mgt =3D pnv_dt_power_mgt; =20 xfc->match_nvt =3D pnv10_xive_match_nvt; + + machine_class_allow_dynamic_sysbus_dev(mc, TYPE_PNV_PHB); } =20 static bool pnv_machine_get_hb(Object *obj, Error **errp) --=20 2.32.0 From nobody Sun May 19 05:00:02 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=1651951284; cv=none; d=zohomail.com; s=zohoarc; b=FaC+THDbZnt+OgFE0Kxmh3zRiSE+viuUbRfoVpEe3ElfBsGmkiToeb6DfjwGMmz12yZehW2QpZJychwobHDsrT+q0t+pu5fhD0+tbeQ3RuVrTpyQ1AHDJz2aFQQjxnivRP6JaoSKXdZHuQmyWeMfAQUthVQWq2RY0HyODIGLjQE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651951284; 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=Gei2OB85I43clXzsP6k10NUHL8FGav4LFxdv8uOXcWs=; b=Xg1ryGe23JcVRos19VuSnn6pjtNWVHRyqBKj1bBZi4DOaCEj0GU/Z5okkZ0gCVr3VPS5X/0atIbEaGnz6fww2OeLk4+ylTTAYMnf30lg7tEJQwRhS2w/cTYBMTfEEWr4Sj1gl/cCT56TqwD9FBAzOypoUcRZG/gbmNRSefnT17Y= 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 1651951284693852.0125534170949; Sat, 7 May 2022 12:21:24 -0700 (PDT) Received: from localhost ([::1]:39582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnPzX-0006ye-KF for importer@patchew.org; Sat, 07 May 2022 15:21:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54946) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnPli-0005wN-EX; Sat, 07 May 2022 15:07:06 -0400 Received: from mail-oa1-x29.google.com ([2001:4860:4864:20::29]:33919) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnPlg-0001aN-N5; Sat, 07 May 2022 15:07:06 -0400 Received: by mail-oa1-x29.google.com with SMTP id 586e51a60fabf-ed9ac77cbbso10560925fac.1; Sat, 07 May 2022 12:07:04 -0700 (PDT) Received: from balboa.ibmmodules.com (201-1-57-208.dsl.telesp.net.br. [201.1.57.208]) by smtp.gmail.com with ESMTPSA id p1-20020a0568301d4100b0060603221270sm2907397oth.64.2022.05.07.12.07.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 May 2022 12:07:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Gei2OB85I43clXzsP6k10NUHL8FGav4LFxdv8uOXcWs=; b=Vfx/wrL/Wanx3y7kG+9M6kwl/56MAHYcdJ5/flAzFKsIpS8XK5e0soGWfesCoBnY+9 o/3EM/gurfKTSXR5HNS3WyLbRZsPUTQ1wNonw/H9TITRZr73HXEyA+Ri41pOtLgZgWbV UB/OGzU6HgmcJwaxBJMECLjqC5u6TajrkOm8hnV7igjM/F15OPWw6/wGe+J5sTXA/4nX /o0hmKKF9lUDET9uTdoWim9Zi8CvtArDX7h4uumicoqN7fJJFtQXdSTWVbMs/6CAQUBa y2vVNkTzdcmZsH2eYKJq91k6eqsfEhoxMfNz1JV+n3NpDr0SaAV1Mg89Js3Cjqz1AKl7 lVhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Gei2OB85I43clXzsP6k10NUHL8FGav4LFxdv8uOXcWs=; b=0VNhibxBQuFgpF/toK0fHZDW7jTH2i/aWiCC6U2uMRN+W/V77C6AWd+KNnjLVjXgmc 4byxllZ71QajNqMysMvBylwHyoEWh40PNvqz2WN8N96nsbSwQ6fdAxWpKFoiQXg+9EV2 cXiEG2vt9PcypthhXVDQisjhG9U5hvZUc0MYIBwCZ/iLUc//zSf5XCKod6yOT56GYx1C /udikTz+jSEhUMYN1N24mZOEMT0w5moDPnxq1EkcpqxVoeUR4CSBkYPYMDowpztOud82 j+Ddsl+zLmctMs4yr0Aruy5l5HLpGjvfP/bHW5I0wNUhvXoLiC5Wzg1j/pZjaM4QN6PX BPHw== X-Gm-Message-State: AOAM531LSkzBcSh41V/fSzVY0rooOoQgjyS8Za1oYQe2+FDm90iXk3rR S4lEFGB/BahNEh7Dqr6RvGrEHcBZTks= X-Google-Smtp-Source: ABdhPJwMDQjTQiOnPgrJLrLdFNepIGM4+07jWWUISprj2ixseNhvbLFPWS/cSS3mY98ZKlMeezJ8Hw== X-Received: by 2002:a05:6870:c348:b0:ed:f231:2b41 with SMTP id e8-20020a056870c34800b000edf2312b41mr6863186oak.23.1651950423404; Sat, 07 May 2022 12:07:03 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, clg@kaod.org, fbarrat@linux.ibm.com, Daniel Henrique Barboza Subject: [PATCH 13/17] ppc/pnv: add pnv_phb_get_current_machine() Date: Sat, 7 May 2022 16:06:20 -0300 Message-Id: <20220507190624.507419-14-danielhb413@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220507190624.507419-1-danielhb413@gmail.com> References: <20220507190624.507419-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=2001:4860:4864:20::29; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x29.google.com 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, 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, 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 @gmail.com) X-ZM-MESSAGEID: 1651951285298100003 Content-Type: text/plain; charset="utf-8" Add a simple helper to avoid hardcoding strcmp() comparisons all around pnv_phb.c. Signed-off-by: Daniel Henrique Barboza --- hw/pci-host/pnv_phb.c | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/hw/pci-host/pnv_phb.c b/hw/pci-host/pnv_phb.c index cef6a57d50..e03062a494 100644 --- a/hw/pci-host/pnv_phb.c +++ b/hw/pci-host/pnv_phb.c @@ -20,6 +20,10 @@ #include "sysemu/sysemu.h" =20 =20 +#define PNV_MACHINE_POWER8 1 +#define PNV_MACHINE_POWER9 2 +#define PNV_MACHINE_POWER10 3 + static char *pnv_phb_get_chip_typename(void) { Object *qdev_machine =3D qdev_get_machine(); @@ -39,7 +43,7 @@ static char *pnv_phb_get_chip_typename(void) return g_steal_pointer(&chip_typename); } =20 -static void pnv_phb_instance_init(Object *obj) +static int pnv_phb_get_current_machine(void) { g_autofree char *chip_typename =3D pnv_phb_get_chip_typename(); =20 @@ -48,12 +52,31 @@ static void pnv_phb_instance_init(Object *obj) * a valid machine->cpu_type value. */ if (!chip_typename) { - return; + return 0; } =20 if (!strcmp(chip_typename, TYPE_PNV_CHIP_POWER8) || !strcmp(chip_typename, TYPE_PNV_CHIP_POWER8E) || !strcmp(chip_typename, TYPE_PNV_CHIP_POWER8NVL)) { + return PNV_MACHINE_POWER8; + } else if (!strcmp(chip_typename, TYPE_PNV_CHIP_POWER9)) { + return PNV_MACHINE_POWER9; + } else if (!strcmp(chip_typename, TYPE_PNV_CHIP_POWER10)) { + return PNV_MACHINE_POWER10; + } + + return 0; +} + +static void pnv_phb_instance_init(Object *obj) +{ + int pnv_current_machine =3D pnv_phb_get_current_machine(); + + if (pnv_current_machine =3D=3D 0) { + return; + } + + if (pnv_current_machine =3D=3D PNV_MACHINE_POWER8) { pnv_phb3_instance_init(obj); return; } @@ -63,25 +86,24 @@ static void pnv_phb_instance_init(Object *obj) =20 static void pnv_phb_realize(DeviceState *dev, Error **errp) { + int pnv_current_machine =3D pnv_phb_get_current_machine(); PnvPHB *phb =3D PNV_PHB(dev); - g_autofree char *chip_typename =3D pnv_phb_get_chip_typename(); =20 - g_assert(chip_typename !=3D NULL); + g_assert(pnv_current_machine !=3D 0); =20 - if (!strcmp(chip_typename, TYPE_PNV_CHIP_POWER8) || - !strcmp(chip_typename, TYPE_PNV_CHIP_POWER8E) || - !strcmp(chip_typename, TYPE_PNV_CHIP_POWER8NVL)) { + if (pnv_current_machine =3D=3D PNV_MACHINE_POWER8) { /* PnvPHB3 */ phb->version =3D PHB_VERSION_3; pnv_phb3_realize(dev, errp); return; } =20 - if (!strcmp(chip_typename, TYPE_PNV_CHIP_POWER9)) { + if (pnv_current_machine =3D=3D PNV_MACHINE_POWER9) { phb->version =3D PHB_VERSION_4; - } else if (!strcmp(chip_typename, TYPE_PNV_CHIP_POWER10)) { + } else if (pnv_current_machine =3D=3D PNV_MACHINE_POWER10) { phb->version =3D PHB_VERSION_5; } else { + g_autofree char *chip_typename =3D pnv_phb_get_chip_typename(); error_setg(errp, "unknown PNV chip: %s", chip_typename); return; } --=20 2.32.0 From nobody Sun May 19 05:00:02 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=1651951373; cv=none; d=zohomail.com; s=zohoarc; b=D66K3kKwUypwxePz3xJaoxV3g46oJIZ/nHhUsPUievwH7WuizmS0J2U1RnPc+P0kK2RK0eLwhEkpasa0OeC75QqQaJfYQCRF3AJ2j4NtWAbqycwugJY9TiWNyVceZ237Mzqa7LEsk1IduDNcSlM306+kPjBnZPFaJEy/jxV2eHg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651951373; 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=kxLQmzrsOhVyYC1L9dTwslzLk5NoF2PfkyKaMt8UvxE=; b=lXuSFYBR2dt3mRFWxU5s4XEbEuBqGqwA4syJ397ZD1IwBYvpi3CmBO9ig+gDN4uF2DBgiPNWrq9uV+MM6nwgFNrr+bxN/w79i+jrtwf3EvKKRyirv5RRTW/1HPjhm4yieGZtTDlhri0B7qcCDPwjno7QTJkiGZfpSrf8mdKV3cI= 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 1651951373333351.7769708495664; Sat, 7 May 2022 12:22:53 -0700 (PDT) Received: from localhost ([::1]:43646 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnQ0y-0001Pg-5f for importer@patchew.org; Sat, 07 May 2022 15:22:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54960) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnPlk-0005yv-Tg; Sat, 07 May 2022 15:07:09 -0400 Received: from mail-ot1-x329.google.com ([2607:f8b0:4864:20::329]:41887) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnPlj-0001ah-C8; Sat, 07 May 2022 15:07:08 -0400 Received: by mail-ot1-x329.google.com with SMTP id y14-20020a9d460e000000b00605ee347da1so7226389ote.8; Sat, 07 May 2022 12:07:06 -0700 (PDT) Received: from balboa.ibmmodules.com (201-1-57-208.dsl.telesp.net.br. [201.1.57.208]) by smtp.gmail.com with ESMTPSA id p1-20020a0568301d4100b0060603221270sm2907397oth.64.2022.05.07.12.07.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 May 2022 12:07:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kxLQmzrsOhVyYC1L9dTwslzLk5NoF2PfkyKaMt8UvxE=; b=gsAdwrUZ4NlV2WK6vFClWV+FUs9WD7YhM2SlUn6/ak3oU5wX89aSpT9S5/iGQsmLWT C2NCnOMz8pJMc9mFQe4iBYldD54dcqMsE3aT39gSUsCGtdXSEfR9xnC5uSIwuu62AxDi GhQIU+RR9AXyRzLu4mJsiuMA2SGG7kqWYecrqqDHfjAm83NwSLaQYs1zlPUI4Dps/OJm 408+Fusajacur/A1d+SKjOXPcBouu1RjP7MmhUwFyTxDRd0yxK+2zMDfQ73nEfGyJ3h/ kV0m9RNE/DRAAKg+va99UizEJZFFaoQsyKsKKMsuTxiYkWD7AGRuK6HYS8lIexkvCQ6u XO+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kxLQmzrsOhVyYC1L9dTwslzLk5NoF2PfkyKaMt8UvxE=; b=KHl3nPhz5b16Ki4lmbMLSjhODOTnpbWhbJpnTSR01nW9TwSEsu0l+yqx+x6E+oN3S8 YRmg7EgPVZbf8OdjiqXlEN22Ca1Ack2fyoKoC5+CeUQMCPdYL21YF3VipmYVhQCmqIiH oeEiWaZ998xZAjgPXm8mmmzxR+jsCy00aBr4EzC2zx95b4Vbt/MQigltTDvMVWhV/Inf l/jNs++TKGiLPMorDqz3J++40uxx1jHlE2FT10QdjQWzQnGYSLQRtGnaqrd/ZZtV75DD yn3JGBrna8OYNun+uYlaZ63bvKaAPWRHQGhrgul21PwEWC1EQew60nK9ahKzgC+bGSq9 FAww== X-Gm-Message-State: AOAM530U2YcufQ8iWOWLSOEThjrjev8y4931lnKiF97WPUH5mqrLTnhF mcNjAFQcYKfas3xPHsZIGmxHIfw4RSI= X-Google-Smtp-Source: ABdhPJyieuAD3TBtcapVb3ad/eVqi8RiGF36HcUmY/PVS+jEOhJ2tHRsqTMMELvBuGlt2lktci9Gbg== X-Received: by 2002:a05:6830:2307:b0:606:1573:172a with SMTP id u7-20020a056830230700b006061573172amr3250433ote.334.1651950425853; Sat, 07 May 2022 12:07:05 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, clg@kaod.org, fbarrat@linux.ibm.com, Daniel Henrique Barboza Subject: [PATCH 14/17] ppc/pnv: add pnv-phb-root-port device Date: Sat, 7 May 2022 16:06:21 -0300 Message-Id: <20220507190624.507419-15-danielhb413@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220507190624.507419-1-danielhb413@gmail.com> References: <20220507190624.507419-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::329; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x329.google.com 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, 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, 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 @gmail.com) X-ZM-MESSAGEID: 1651951373572100001 Content-Type: text/plain; charset="utf-8" We have two very similar root-port devices, pnv-phb3-root-port and pnv-phb4-root-port. Both consist of a wrapper around the PCIESlot device that, until now, has no additional attributes. The main difference between the PHB3 and PHB4 root ports is that pnv-phb4-root-port has the pnv_phb4_root_port_reset() callback. All other differences can be merged in a single device without too much trouble. This patch introduces the unified pnv-phb-root-port that, in time, will be used as the default root port for the pnv-phb device. Signed-off-by: Daniel Henrique Barboza --- hw/pci-host/pnv_phb.c | 93 +++++++++++++++++++++++++++++++++++ include/hw/pci-host/pnv_phb.h | 11 +++++ 2 files changed, 104 insertions(+) diff --git a/hw/pci-host/pnv_phb.c b/hw/pci-host/pnv_phb.c index e03062a494..369dc21931 100644 --- a/hw/pci-host/pnv_phb.c +++ b/hw/pci-host/pnv_phb.c @@ -157,9 +157,102 @@ static const TypeInfo pnv_phb_type_info =3D { }, }; =20 +static void pnv_phb_root_port_reset(DeviceState *dev) +{ + PCIERootPortClass *rpc =3D PCIE_ROOT_PORT_GET_CLASS(dev); + PCIDevice *d =3D PCI_DEVICE(dev); + uint8_t *conf =3D d->config; + int pnv_current_machine =3D pnv_phb_get_current_machine(); + + rpc->parent_reset(dev); + + if (pnv_current_machine =3D=3D PNV_MACHINE_POWER8) { + return; + } + + pci_byte_test_and_set_mask(conf + PCI_IO_BASE, + PCI_IO_RANGE_MASK & 0xff); + pci_byte_test_and_clear_mask(conf + PCI_IO_LIMIT, + PCI_IO_RANGE_MASK & 0xff); + pci_set_word(conf + PCI_MEMORY_BASE, 0); + pci_set_word(conf + PCI_MEMORY_LIMIT, 0xfff0); + pci_set_word(conf + PCI_PREF_MEMORY_BASE, 0x1); + pci_set_word(conf + PCI_PREF_MEMORY_LIMIT, 0xfff1); + pci_set_long(conf + PCI_PREF_BASE_UPPER32, 0x1); /* Hack */ + pci_set_long(conf + PCI_PREF_LIMIT_UPPER32, 0xffffffff); + pci_config_set_interrupt_pin(conf, 0); +} + +static void pnv_phb_root_port_realize(DeviceState *dev, Error **errp) +{ + PCIERootPortClass *rpc =3D PCIE_ROOT_PORT_GET_CLASS(dev); + PCIDevice *pci =3D PCI_DEVICE(dev); + PCIBus *bus =3D pci_get_bus(pci); + PnvPHB *phb =3D NULL; + Error *local_err =3D NULL; + + phb =3D (PnvPHB *) object_dynamic_cast(OBJECT(bus->qbus.parent), + TYPE_PNV_PHB); + + if (!phb) { + error_setg(errp, +"pnv_phb_root_port devices must be connected to pnv-phb buses"); + return; + } + + /* Set unique chassis/slot values for the root port */ + qdev_prop_set_uint8(&pci->qdev, "chassis", phb->chip_id); + qdev_prop_set_uint16(&pci->qdev, "slot", phb->phb_id); + + rpc->parent_realize(dev, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } + pci_config_set_interrupt_pin(pci->config, 0); +} + +static void pnv_phb_root_port_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); + PCIERootPortClass *rpc =3D PCIE_ROOT_PORT_CLASS(klass); + + dc->desc =3D "IBM PHB PCIE Root Port"; + + device_class_set_parent_realize(dc, pnv_phb_root_port_realize, + &rpc->parent_realize); + + device_class_set_parent_reset(dc, pnv_phb_root_port_reset, + &rpc->parent_reset); + dc->reset =3D &pnv_phb_root_port_reset; + + dc->user_creatable =3D true; + + k->vendor_id =3D PCI_VENDOR_ID_IBM; + /* + * k->device_id is defaulted to PNV_PHB3_DEVICE_ID. We'll fix + * it during instance_init() when we are aware of what machine + * we're running. + */ + k->device_id =3D 0x03dc; + k->revision =3D 0; + + rpc->exp_offset =3D 0x48; + rpc->aer_offset =3D 0x100; +} + +static const TypeInfo pnv_phb_root_port_info =3D { + .name =3D TYPE_PNV_PHB_ROOT_PORT, + .parent =3D TYPE_PCIE_ROOT_PORT, + .instance_size =3D sizeof(PnvPHBRootPort), + .class_init =3D pnv_phb_root_port_class_init, +}; + static void pnv_phb_register_types(void) { type_register_static(&pnv_phb_type_info); + type_register_static(&pnv_phb_root_port_info); } =20 type_init(pnv_phb_register_types) diff --git a/include/hw/pci-host/pnv_phb.h b/include/hw/pci-host/pnv_phb.h index cceb37d03c..ff90a9c200 100644 --- a/include/hw/pci-host/pnv_phb.h +++ b/include/hw/pci-host/pnv_phb.h @@ -210,4 +210,15 @@ struct PnvPHB { QLIST_HEAD(, PnvPhb4DMASpace) dma_spaces; }; =20 +/* + * PHB PCIe Root port + */ +typedef struct PnvPHBRootPort { + PCIESlot parent_obj; +} PnvPHBRootPort; + +#define TYPE_PNV_PHB_ROOT_PORT "pnv-phb-root-port" +#define PNV_PHB_ROOT_PORT(obj) \ + OBJECT_CHECK(PnvPHBRootPort, obj, TYPE_PNV_PHB_ROOT_PORT) + #endif /* PCI_HOST_PNV_PHB_H */ --=20 2.32.0 From nobody Sun May 19 05:00:02 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=1651951452; cv=none; d=zohomail.com; s=zohoarc; b=XsIywGokLhGAUU1wwAiKQxUa4ESSP+vfGnmxd1Zlusx75UAuJ7oYekjcE/a1LL8ngm6kzqBbwE50yEBf+bpqlUUrkLlIrOqEG0E4+dGO09IzKdWg63rb9PlRlxh+Jid3TwDX300c1+Mon/ur8VxcX6S9i3StVJQJkOszpTeqzFU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651951452; 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=ofHjr863M55zAJYZjc/8WB8QUpdLBzZ169xhUdZ2QEs=; b=JN1+SZdeGyFIt4kLUqViAORqXtxn8+VYu9rXT4Vpqt3YVLgQeCk+1u16QZM+CGNJxB/PuWaZEGEb3XPHpJ66ypJ3voPlQZDwzLl4vFC0IUau0ofxqh+BZ8vQXl6QyAP5gcplrJWX2VKiSXRo/prOq7LwIKfZCnXHeHTQUQTGWo0= 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 1651951452016874.183231236975; Sat, 7 May 2022 12:24:12 -0700 (PDT) Received: from localhost ([::1]:45830 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnQ2F-0002uU-1i for importer@patchew.org; Sat, 07 May 2022 15:24:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54974) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnPln-00063R-32; Sat, 07 May 2022 15:07:11 -0400 Received: from mail-oa1-x35.google.com ([2001:4860:4864:20::35]:45654) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnPll-0001at-J7; Sat, 07 May 2022 15:07:10 -0400 Received: by mail-oa1-x35.google.com with SMTP id 586e51a60fabf-e93bbb54f9so10526703fac.12; Sat, 07 May 2022 12:07:08 -0700 (PDT) Received: from balboa.ibmmodules.com (201-1-57-208.dsl.telesp.net.br. [201.1.57.208]) by smtp.gmail.com with ESMTPSA id p1-20020a0568301d4100b0060603221270sm2907397oth.64.2022.05.07.12.07.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 May 2022 12:07:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ofHjr863M55zAJYZjc/8WB8QUpdLBzZ169xhUdZ2QEs=; b=DFssnT6AToJcuOlTaGw17gO4UyGXTqgkPKSpjMmQnNOxnpYPLWOLqMN+piOrVXzPg2 QMYVUtjzr3KEZBK0+17IawRnH3YHQG+b3R4xRzO0E1of+u8EPmrbEs9NE3Cs/bGqUoYR oKk61pmQaoz90Vo4FYqijK5O3DTWZdK7ouY41s0DOql9NV2pV++q6aZ9SNgxPQDAqoaY EE0pkrvzJ9NTCrfl8m7ijbh3HkLJZ85J4MoxL8xfM/xodwwikCBMrOaRfiJJWHOLAZv3 aMRs2MBgcSvCDpxzGEKJ2Hhq+LxukGX4CF6wZEjFdoo1aE+71Rc8ry9ckocr4aHMxB7T w/AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ofHjr863M55zAJYZjc/8WB8QUpdLBzZ169xhUdZ2QEs=; b=Qm9QmVKEEYQkS/y4kSwIlbLPcJIH4wtMW5jMZGa4N7MdHv8ZSsgBmUHWOZwkPBrlta 4ISJeEfnfIBXsQwxNEtWi3ukTbVI0e7XdJhb+zeDda6rt3Wqob+JLLyOm07PUpOr0Iay R2cppwLb2jvVjWzNYszv5p4pisY3c9pBt8hLelhI42M5ctokt5AFam7BEGJBztLQh/41 xNJpiaRMjZGX4V8m5Mtuphu/Ou61rhq9YpvBFJaAqdg8N8nxjNeDwhJUJnPBmQkR2763 fTiWugwVHoU4G008XnskZBsgRWUG8ScA+kw3Rag+8mTV9+Ny0K6cxQmPSG6z019OvMNi mwzg== X-Gm-Message-State: AOAM530pRzqn35mbPHJMsNxvaLS5QxfMbB4iTNIsxm0s7IfQ6q2lKCZW N1ByrrYplcUxiPMeQ97IVmXKAPS6VMw= X-Google-Smtp-Source: ABdhPJzV5lQwlcl1NQ2VGHLWVXPBMVG9sjRAg1uYdeemzaCZjnk0tzf6BGqiwU3TrZiQrR5c1qaH0Q== X-Received: by 2002:a05:6870:7093:b0:e6:210a:d98d with SMTP id v19-20020a056870709300b000e6210ad98dmr3805661oae.68.1651950428204; Sat, 07 May 2022 12:07:08 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, clg@kaod.org, fbarrat@linux.ibm.com, Daniel Henrique Barboza Subject: [PATCH 15/17] ppc/pnv: remove pnv-phb3-root-port Date: Sat, 7 May 2022 16:06:22 -0300 Message-Id: <20220507190624.507419-16-danielhb413@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220507190624.507419-1-danielhb413@gmail.com> References: <20220507190624.507419-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=2001:4860:4864:20::35; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x35.google.com 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, 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, 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 @gmail.com) X-ZM-MESSAGEID: 1651951453247100001 Content-Type: text/plain; charset="utf-8" The unified pnv-phb-root-port can be used in its place. There is no ABI breakage in doing so because no official QEMU release introduced user creatable pnv-phb3-root-port devices. Signed-off-by: Daniel Henrique Barboza --- hw/pci-host/pnv_phb3.c | 59 +--------------------------------- include/hw/pci-host/pnv_phb3.h | 7 ---- 2 files changed, 1 insertion(+), 65 deletions(-) diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c index a6d6a10c52..1c52df4c3f 100644 --- a/hw/pci-host/pnv_phb3.c +++ b/hw/pci-host/pnv_phb3.c @@ -1078,7 +1078,7 @@ void pnv_phb3_realize(DeviceState *dev, Error **errp) =20 if (defaults_enabled()) { pnv_phb_attach_root_port(PCI_HOST_BRIDGE(phb), - TYPE_PNV_PHB3_ROOT_PORT); + TYPE_PNV_PHB_ROOT_PORT); } } =20 @@ -1125,66 +1125,9 @@ static const TypeInfo pnv_phb3_root_bus_info =3D { }, }; =20 -static void pnv_phb3_root_port_realize(DeviceState *dev, Error **errp) -{ - PCIERootPortClass *rpc =3D PCIE_ROOT_PORT_GET_CLASS(dev); - PCIDevice *pci =3D PCI_DEVICE(dev); - PCIBus *bus =3D pci_get_bus(pci); - PnvPHB *phb =3D NULL; - Error *local_err =3D NULL; - - phb =3D (PnvPHB *) object_dynamic_cast(OBJECT(bus->qbus.parent), - TYPE_PNV_PHB); - - if (!phb) { - error_setg(errp, -"pnv_phb3_root_port devices must be connected to pnv-phb buses"); - return; - } - - /* Set unique chassis/slot values for the root port */ - qdev_prop_set_uint8(&pci->qdev, "chassis", phb->chip_id); - qdev_prop_set_uint16(&pci->qdev, "slot", phb->phb_id); - - rpc->parent_realize(dev, &local_err); - if (local_err) { - error_propagate(errp, local_err); - return; - } - pci_config_set_interrupt_pin(pci->config, 0); -} - -static void pnv_phb3_root_port_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); - PCIERootPortClass *rpc =3D PCIE_ROOT_PORT_CLASS(klass); - - dc->desc =3D "IBM PHB3 PCIE Root Port"; - - device_class_set_parent_realize(dc, pnv_phb3_root_port_realize, - &rpc->parent_realize); - dc->user_creatable =3D true; - - k->vendor_id =3D PCI_VENDOR_ID_IBM; - k->device_id =3D 0x03dc; - k->revision =3D 0; - - rpc->exp_offset =3D 0x48; - rpc->aer_offset =3D 0x100; -} - -static const TypeInfo pnv_phb3_root_port_info =3D { - .name =3D TYPE_PNV_PHB3_ROOT_PORT, - .parent =3D TYPE_PCIE_ROOT_PORT, - .instance_size =3D sizeof(PnvPHB3RootPort), - .class_init =3D pnv_phb3_root_port_class_init, -}; - static void pnv_phb3_register_types(void) { type_register_static(&pnv_phb3_root_bus_info); - type_register_static(&pnv_phb3_root_port_info); type_register_static(&pnv_phb3_iommu_memory_region_info); } =20 diff --git a/include/hw/pci-host/pnv_phb3.h b/include/hw/pci-host/pnv_phb3.h index 1c4af98fee..417b0f99a7 100644 --- a/include/hw/pci-host/pnv_phb3.h +++ b/include/hw/pci-host/pnv_phb3.h @@ -43,13 +43,6 @@ OBJECT_DECLARE_SIMPLE_TYPE(PnvPBCQState, PNV_PBCQ) */ #define TYPE_PNV_PHB3_ROOT_BUS "pnv-phb3-root" =20 -#define TYPE_PNV_PHB3_ROOT_PORT "pnv-phb3-root-port" - -typedef struct PnvPHB3RootPort { - PCIESlot parent_obj; -} PnvPHB3RootPort; - - #define PNV_PHB3_NUM_M64 16 #define PNV_PHB3_NUM_REGS (0x1000 >> 3) #define PNV_PHB3_NUM_LSI 8 --=20 2.32.0 From nobody Sun May 19 05:00:02 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=1651950966; cv=none; d=zohomail.com; s=zohoarc; b=YKEEM+TEqFFXzeNYJk5rTYjKS5jEFXAT2YpVCKsygIp3XI4jeQJjBbYSB42BR1RnpjLqUoLPC4mzQACeIYK/aNXXnfwHxW56Nj1Fy0a5nmQqJwtJSh+uDviOVunMrcVNhNR0vs1B0MvTZX8S+V2YCti2+RyWS4zozeVRwTMHjrE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651950966; 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=qVv3d83OfpC/OHOL5tZ0g4PPPAUib/MUu/nDDkfekWc=; b=Zq81Mle9Wta6BJmotR4oyYg7sGgvr8MRbF+pimTphXCQb30nxPEqSbmu8IeMN6zDyyWYUQJOtaAANOC808qW6iRciWgrUWJWPRWLUkDbN7qEOC7lOdIppyl0+DnDoyyLjROrljYIuXnYGpDvrX3AUhy5E+sX/BmH751eMIY0ha4= 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 1651950966261188.87174909100884; Sat, 7 May 2022 12:16:06 -0700 (PDT) Received: from localhost ([::1]:52692 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnPuP-00051K-6b for importer@patchew.org; Sat, 07 May 2022 15:16:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54992) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnPlp-000694-NT; Sat, 07 May 2022 15:07:14 -0400 Received: from mail-ot1-x32c.google.com ([2607:f8b0:4864:20::32c]:45750) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnPlo-0001b9-0G; Sat, 07 May 2022 15:07:13 -0400 Received: by mail-ot1-x32c.google.com with SMTP id s18-20020a056830149200b006063fef3e17so7217417otq.12; Sat, 07 May 2022 12:07:11 -0700 (PDT) Received: from balboa.ibmmodules.com (201-1-57-208.dsl.telesp.net.br. [201.1.57.208]) by smtp.gmail.com with ESMTPSA id p1-20020a0568301d4100b0060603221270sm2907397oth.64.2022.05.07.12.07.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 May 2022 12:07:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qVv3d83OfpC/OHOL5tZ0g4PPPAUib/MUu/nDDkfekWc=; b=DtiP4vtu6KffPoz9eONhsoog62eggQXQgAwkcp6AGAt6D8haRbNxAWgKMiAro1TfdO bYO0+H7bWJ7xmsVnDy/y9Akxsdyj1rlNLoAuvCS7TUtCinpXUFzW2g85mGmzD5iWaqLc nkPZIAWUHzZ8aSnR58puBNErUaVCLi9YudBMKpxYvbWdam02NyZcbIRFppCO45C6MH+h rKnvbtqwqlI6DyKHT6HB5+4KNhc7a7vsODDNFxvF4Q2nR0yENleIQYPFVQ4CL2N9wCha NnsYe7TTwju2uhjdzKMWPXGFGFppuDJmVqvj73yHxujWgSOAIqOnBEe5w9vvBvsUx+GM zBLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qVv3d83OfpC/OHOL5tZ0g4PPPAUib/MUu/nDDkfekWc=; b=eYDm8XBfOiTOgG2ArCzRgD8m9p5azuHyD+NzLqiYn1lXJL7cgdMumo8kVtbhYZbxI5 nRAkSoc5yxU5dCcZCQQIC8wPAZm1ewr32scPzlJuVu5z96r41XF4IROrdb1SBTxQJOr9 rT9H/i96IXze+npwJfT04hQOdc2YR6fhqS47GRHmcHFUH/gR3ndz6GNbSH5CMSpkr3gf Yu/ZzBCpzwd9KOCgyJySZDSah3WubgcvT5fV52p0lwZzA2Q09XhOSEGrBioGrg+LbGKg YpZF25IlDURVpNAJnRq0IH8lD0pL3ImvDOiouwYxbDbtWzB6s0GwXBT6kTkY+y8Pf4Cy 1fYw== X-Gm-Message-State: AOAM532LMLRmVbRpS25yaMMuTzDiMDhgRClZFsSWlXtxXfd6c+uWl6VY lvKzaJjbiOT1OjCAAy+Ca0FKEazjcJM= X-Google-Smtp-Source: ABdhPJy5G5gOdF6K6jmNqBVmvEpYcO7yAUJ1ZYd6QC2rqup7rvDpQ82APnlX9Q7L+/bnbHY3Su/fHQ== X-Received: by 2002:a05:6830:60c:b0:606:3e1:322c with SMTP id w12-20020a056830060c00b0060603e1322cmr3192286oti.53.1651950430550; Sat, 07 May 2022 12:07:10 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, clg@kaod.org, fbarrat@linux.ibm.com, Daniel Henrique Barboza Subject: [PATCH 16/17] ppc/pnv: remove pnv-phb4-root-port Date: Sat, 7 May 2022 16:06:23 -0300 Message-Id: <20220507190624.507419-17-danielhb413@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220507190624.507419-1-danielhb413@gmail.com> References: <20220507190624.507419-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::32c; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x32c.google.com 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, 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, 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 @gmail.com) X-ZM-MESSAGEID: 1651950966937100001 Content-Type: text/plain; charset="utf-8" The unified pnv-phb-root-port can be used instead. THe pnv-phb4-root-port device isn't exposed to the user in any official QEMU release so there's no ABI breakage in removing it. Signed-off-by: Daniel Henrique Barboza --- hw/pci-host/pnv_phb4.c | 100 --------------------------------- hw/pci-host/pnv_phb4_pec.c | 4 +- include/hw/pci-host/pnv_phb4.h | 9 --- 3 files changed, 2 insertions(+), 111 deletions(-) diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c index fb3222d458..2dce10830d 100644 --- a/hw/pci-host/pnv_phb4.c +++ b/hw/pci-host/pnv_phb4.c @@ -1776,109 +1776,9 @@ static const TypeInfo pnv_phb4_root_bus_info =3D { }, }; =20 -static void pnv_phb4_root_port_reset(DeviceState *dev) -{ - PCIERootPortClass *rpc =3D PCIE_ROOT_PORT_GET_CLASS(dev); - PCIDevice *d =3D PCI_DEVICE(dev); - uint8_t *conf =3D d->config; - - rpc->parent_reset(dev); - - pci_byte_test_and_set_mask(conf + PCI_IO_BASE, - PCI_IO_RANGE_MASK & 0xff); - pci_byte_test_and_clear_mask(conf + PCI_IO_LIMIT, - PCI_IO_RANGE_MASK & 0xff); - pci_set_word(conf + PCI_MEMORY_BASE, 0); - pci_set_word(conf + PCI_MEMORY_LIMIT, 0xfff0); - pci_set_word(conf + PCI_PREF_MEMORY_BASE, 0x1); - pci_set_word(conf + PCI_PREF_MEMORY_LIMIT, 0xfff1); - pci_set_long(conf + PCI_PREF_BASE_UPPER32, 0x1); /* Hack */ - pci_set_long(conf + PCI_PREF_LIMIT_UPPER32, 0xffffffff); - pci_config_set_interrupt_pin(conf, 0); -} - -static void pnv_phb4_root_port_realize(DeviceState *dev, Error **errp) -{ - PCIERootPortClass *rpc =3D PCIE_ROOT_PORT_GET_CLASS(dev); - PCIDevice *pci =3D PCI_DEVICE(dev); - PCIBus *bus =3D pci_get_bus(pci); - PnvPHB *phb =3D NULL; - Error *local_err =3D NULL; - - phb =3D (PnvPHB *) object_dynamic_cast(OBJECT(bus->qbus.parent), - TYPE_PNV_PHB); - - if (!phb) { - error_setg(errp, "%s must be connected to pnv-phb buses", dev->id); - return; - } - - /* Set unique chassis/slot values for the root port */ - qdev_prop_set_uint8(&pci->qdev, "chassis", phb->chip_id); - qdev_prop_set_uint16(&pci->qdev, "slot", phb->phb_id); - - rpc->parent_realize(dev, &local_err); - if (local_err) { - error_propagate(errp, local_err); - return; - } -} - -static void pnv_phb4_root_port_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); - PCIERootPortClass *rpc =3D PCIE_ROOT_PORT_CLASS(klass); - - dc->desc =3D "IBM PHB4 PCIE Root Port"; - dc->user_creatable =3D true; - - device_class_set_parent_realize(dc, pnv_phb4_root_port_realize, - &rpc->parent_realize); - device_class_set_parent_reset(dc, pnv_phb4_root_port_reset, - &rpc->parent_reset); - - k->vendor_id =3D PCI_VENDOR_ID_IBM; - k->device_id =3D PNV_PHB4_DEVICE_ID; - k->revision =3D 0; - - rpc->exp_offset =3D 0x48; - rpc->aer_offset =3D 0x100; - - dc->reset =3D &pnv_phb4_root_port_reset; -} - -static const TypeInfo pnv_phb4_root_port_info =3D { - .name =3D TYPE_PNV_PHB4_ROOT_PORT, - .parent =3D TYPE_PCIE_ROOT_PORT, - .instance_size =3D sizeof(PnvPHB4RootPort), - .class_init =3D pnv_phb4_root_port_class_init, -}; - -static void pnv_phb5_root_port_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); - - dc->desc =3D "IBM PHB5 PCIE Root Port"; - dc->user_creatable =3D true; - - k->vendor_id =3D PCI_VENDOR_ID_IBM; - k->device_id =3D PNV_PHB5_DEVICE_ID; -} - -static const TypeInfo pnv_phb5_root_port_info =3D { - .name =3D TYPE_PNV_PHB5_ROOT_PORT, - .parent =3D TYPE_PNV_PHB4_ROOT_PORT, - .instance_size =3D sizeof(PnvPHB4RootPort), - .class_init =3D pnv_phb5_root_port_class_init, -}; - static void pnv_phb4_register_types(void) { type_register_static(&pnv_phb4_root_bus_info); - type_register_static(&pnv_phb5_root_port_info); - type_register_static(&pnv_phb4_root_port_info); type_register_static(&pnv_phb5_type_info); type_register_static(&pnv_phb4_iommu_memory_region_info); } diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c index 243a079ea7..51821276e9 100644 --- a/hw/pci-host/pnv_phb4_pec.c +++ b/hw/pci-host/pnv_phb4_pec.c @@ -266,7 +266,7 @@ static void pnv_pec_class_init(ObjectClass *klass, void= *data) pecc->version =3D PNV_PHB4_VERSION; pecc->phb_type =3D TYPE_PNV_PHB; pecc->num_phbs =3D pnv_pec_num_phbs; - pecc->rp_model =3D TYPE_PNV_PHB4_ROOT_PORT; + pecc->rp_model =3D TYPE_PNV_PHB_ROOT_PORT; } =20 static const TypeInfo pnv_pec_type_info =3D { @@ -319,7 +319,7 @@ static void pnv_phb5_pec_class_init(ObjectClass *klass,= void *data) pecc->version =3D PNV_PHB5_VERSION; pecc->phb_type =3D TYPE_PNV_PHB5; pecc->num_phbs =3D pnv_phb5_pec_num_stacks; - pecc->rp_model =3D TYPE_PNV_PHB5_ROOT_PORT; + pecc->rp_model =3D TYPE_PNV_PHB_ROOT_PORT; } =20 static const TypeInfo pnv_phb5_pec_type_info =3D { diff --git a/include/hw/pci-host/pnv_phb4.h b/include/hw/pci-host/pnv_phb4.h index 65a16f2067..8c57d836d1 100644 --- a/include/hw/pci-host/pnv_phb4.h +++ b/include/hw/pci-host/pnv_phb4.h @@ -44,16 +44,7 @@ typedef struct PnvPhb4DMASpace { QLIST_ENTRY(PnvPhb4DMASpace) list; } PnvPhb4DMASpace; =20 -/* - * PHB4 PCIe Root port - */ #define TYPE_PNV_PHB4_ROOT_BUS "pnv-phb4-root" -#define TYPE_PNV_PHB4_ROOT_PORT "pnv-phb4-root-port" -#define TYPE_PNV_PHB5_ROOT_PORT "pnv-phb5-root-port" - -typedef struct PnvPHB4RootPort { - PCIESlot parent_obj; -} PnvPHB4RootPort; =20 struct PnvPHB4DeviceClass { DeviceClass parent_class; --=20 2.32.0 From nobody Sun May 19 05:00:02 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=1651951529; cv=none; d=zohomail.com; s=zohoarc; b=GDVPF77BKpnq5TRsqssCWgx9YapGk9MCBAFNWjmtrZCuR758dMK47JUKJSG5a858zLd6TdRG3/uf3HVoTAYndLNKBb+0XAKNo0rl7fuiulgaJ7XrS9luQxSq+9vGaFXf4tpnG/oAQrsQQuH08Vy25F+MC/secxWv3r4JdKEdG5k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651951529; 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=FOJO9raqz4oO5wZuKU5nJraBsnKISn5vRpyh3JyIUO4=; b=XyibNzPsf/NzmFdxVaTdVb+aHr5BPSMdkc7YhhiyHTV8ArR0JlQAb4Leo1e31X57cwUP9j4WUz6ZX+Xs1e09ZyjDlR5R3zwJCcEEVaeuIH/9R98i9dZTm5/652XBw5nzVb4cYOiT/17J9nWzVo5dnLcUXUfYu3svCmaK4oaof3Q= 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 1651951529482566.7580406488073; Sat, 7 May 2022 12:25:29 -0700 (PDT) Received: from localhost ([::1]:48200 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnQ3U-0004bI-5R for importer@patchew.org; Sat, 07 May 2022 15:25:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55014) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnPls-0006C3-4T; Sat, 07 May 2022 15:07:17 -0400 Received: from mail-ot1-x332.google.com ([2607:f8b0:4864:20::332]:45756) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnPlq-0001bT-JX; Sat, 07 May 2022 15:07:15 -0400 Received: by mail-ot1-x332.google.com with SMTP id s18-20020a056830149200b006063fef3e17so7217480otq.12; Sat, 07 May 2022 12:07:13 -0700 (PDT) Received: from balboa.ibmmodules.com (201-1-57-208.dsl.telesp.net.br. [201.1.57.208]) by smtp.gmail.com with ESMTPSA id p1-20020a0568301d4100b0060603221270sm2907397oth.64.2022.05.07.12.07.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 May 2022 12:07:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FOJO9raqz4oO5wZuKU5nJraBsnKISn5vRpyh3JyIUO4=; b=ZB6Ce5Yrzxfi4xbiS0f2RWxKLrpGg+48Hx4cySuvOnfytGg3jskGkGsTKr965XeWup JXQmxxYTbsQv7wz4Gb5tHnbE8trNKWrV9ipsuL9O3zBRq+p1LRE/trYHPTqAZ+D7pHQP 94O0IgjO17jenHz0S2ApNBE0XIJCBBqkcg30+X8UhK6pblmlW3q9u3sQGc9700hI9XqW 3cfJpOfxbEpwYraNsynmAGWi/UkjiGqUCxeGarsRioMOaqUu9Bc+E86GRoUwkMPuYJTa 7S77uvMXbfEpKAKvLo4N+Eowfiep5voo/asSyCO+a41IX9k1C4Gez1tmtu0yJTzcBFBv 88HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FOJO9raqz4oO5wZuKU5nJraBsnKISn5vRpyh3JyIUO4=; b=L56oSmguDX+a+YN2L56xVlWDQQTdQjgsjcNGYCPuzcPFLml7zJ3CUgvtwq2MwMazEn AI86XLOwWI/If911Hjx/Adk1JhkZqL4HvcYqUzt4NUsRDRZ0nNU0UrihgM0CwEPr65MK jIsANJ2Nd3/KQPHJtj1c42WtIF3WN0wV+AKm97039mmK30l9NP+ZC7paYMqkTk2UWF59 gMudX4CGlszsa4gUABQwq9Vg7ud8HDYXov5L39EyXqDrJL7z/3E1E/q2BaDhwjPCeAJm wLl3oklRsGYg368PCsSyHfsx1qau3nhh7cCcOUA68Ot5jX0bUsnjIVPi7223OzVB8AZB JQrA== X-Gm-Message-State: AOAM532HfDDMkRPf6DX7Z3c7FYCbSfWibTLazoUYgioAGDuzpcDYItIZ qqgPx2ThXfTmVkH9rl4p5wo2eiO3jt0= X-Google-Smtp-Source: ABdhPJyfqofVV0/biF/RUT/TMB1boW6Wbcv+cHPc7466R4bVN3Wltzvpyx332UwEFbKvKn9pegtwjg== X-Received: by 2002:a05:6830:1d64:b0:606:799a:8e9a with SMTP id l4-20020a0568301d6400b00606799a8e9amr603153oti.147.1651950432858; Sat, 07 May 2022 12:07:12 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, clg@kaod.org, fbarrat@linux.ibm.com, Daniel Henrique Barboza Subject: [PATCH 17/17] ppc/pnv: remove pecc->rp_model Date: Sat, 7 May 2022 16:06:24 -0300 Message-Id: <20220507190624.507419-18-danielhb413@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220507190624.507419-1-danielhb413@gmail.com> References: <20220507190624.507419-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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, 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 @gmail.com) X-ZM-MESSAGEID: 1651951531886100001 Content-Type: text/plain; charset="utf-8" The attribute is always being set to TYPE_PNV_PHB_ROOT_PORT. Signed-off-by: Daniel Henrique Barboza --- hw/pci-host/pnv_phb4_pec.c | 4 +--- include/hw/pci-host/pnv_phb4.h | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c index 51821276e9..509039bfe6 100644 --- a/hw/pci-host/pnv_phb4_pec.c +++ b/hw/pci-host/pnv_phb4_pec.c @@ -132,7 +132,7 @@ static void pnv_pec_default_phb_realize(PnvPhb4PecState= *pec, } =20 /* Add a single Root port if running with defaults */ - pnv_phb_attach_root_port(PCI_HOST_BRIDGE(phb), pecc->rp_model); + pnv_phb_attach_root_port(PCI_HOST_BRIDGE(phb), TYPE_PNV_PHB_ROOT_PORT); } =20 static void pnv_pec_realize(DeviceState *dev, Error **errp) @@ -266,7 +266,6 @@ static void pnv_pec_class_init(ObjectClass *klass, void= *data) pecc->version =3D PNV_PHB4_VERSION; pecc->phb_type =3D TYPE_PNV_PHB; pecc->num_phbs =3D pnv_pec_num_phbs; - pecc->rp_model =3D TYPE_PNV_PHB_ROOT_PORT; } =20 static const TypeInfo pnv_pec_type_info =3D { @@ -319,7 +318,6 @@ static void pnv_phb5_pec_class_init(ObjectClass *klass,= void *data) pecc->version =3D PNV_PHB5_VERSION; pecc->phb_type =3D TYPE_PNV_PHB5; pecc->num_phbs =3D pnv_phb5_pec_num_stacks; - pecc->rp_model =3D TYPE_PNV_PHB_ROOT_PORT; } =20 static const TypeInfo pnv_phb5_pec_type_info =3D { diff --git a/include/hw/pci-host/pnv_phb4.h b/include/hw/pci-host/pnv_phb4.h index 8c57d836d1..b2c59ea1a0 100644 --- a/include/hw/pci-host/pnv_phb4.h +++ b/include/hw/pci-host/pnv_phb4.h @@ -116,7 +116,6 @@ struct PnvPhb4PecClass { uint64_t version; const char *phb_type; const uint32_t *num_phbs; - const char *rp_model; }; =20 /* --=20 2.32.0