From nobody Mon Jun 8 05:27:34 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1780330735; cv=none; d=zohomail.com; s=zohoarc; b=WmtVWzVNH1nC5QotnvgGdbtpu9iszyZ8//XAD0k6GJA3kzw7s4AZW6uNd9m/lNWbxw+SHIdhOxkmkH1o/3X2sEAq3JNjRKRbzJDMLem3v0R+v3pYeNS56azK4Pxr+3if6Zyj8OQdNn9k3/gtn+lX9SS+hh0CcOJSodiPmPcsN0c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1780330735; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=n5zzaT0gfooSGkYcsXOz9BLFa9jLzqbvKkPRUfRvEo0=; b=IhHPRRUNEu8ZpET8nxsY/BnVi+sD+rXWJ8rFShDieubEJPkTZqPi2ozZ6Mo+mKvlXIOA9cUCXY8+/z3McSPhv092vG7Dmlz/JttnVQW/9HKS2DlPNlqPQEDWvhtSgjb+1mZQzIp5BBCRDSZ9C6cn2TCGpnbO5Sd8GYWPuW/yNN4= 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=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 178033073591373.93303874337562; Mon, 1 Jun 2026 09:18:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wU5LZ-0007YW-1t; Mon, 01 Jun 2026 12:18:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wU5LR-0007XF-PJ; Mon, 01 Jun 2026 12:18:33 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wU5LP-0002Ot-KL; Mon, 01 Jun 2026 12:18:29 -0400 Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 651FmZit2337749; Mon, 1 Jun 2026 16:18:25 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4efpae1f4v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 01 Jun 2026 16:18:24 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 651G97Zx000698; Mon, 1 Jun 2026 16:18:23 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4egcegerm6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 01 Jun 2026 16:18:23 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 651GIKgH34734510 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 1 Jun 2026 16:18:20 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1C8BC20043; Mon, 1 Jun 2026 16:18:20 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 54C3F20040; Mon, 1 Jun 2026 16:18:17 +0000 (GMT) Received: from li-0bf05b4c-28e4-11b2-a85c-ce7af937d338.ibm.com.com (unknown [9.39.22.2]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 1 Jun 2026 16:18:17 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:message-id:mime-version :subject:to; s=pp1; bh=n5zzaT0gfooSGkYcsXOz9BLFa9jLzqbvKkPRUfRvE o0=; b=cum5XNLsNIao0xSo+ALQ/Ea/GrWnkMMLNwMzzHZ4sG0zfWmsv7kvEzGX0 TeAIWNHgPecusMg6xg7qUsZK8xF7FRIb62K7b/+q+y8Sa+h07O3IfZG+aPS86zFM v8TS98nSfbHXk4VxqRY/DW/rbZ8jxF0BIRKwku2i56Zoqj9J9yIyN1KjwMq8emXD GvE/D2yVRr6aOvDhONipQ5p5RY/oX0f31tT0UabWvGCF3kDYUkWpyFaQtZe8FABD gxYWlG/V0AaxrNI535CLJFYBs6c7Hvwqzk/XLkjAf/gT+dwEPrzIi6ASVjhLAUXi e4q4o/iZ64rgICS1/+TvReuY8B0sQ== From: Jishnu Warrier To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: Nicholas Piggin , Harsh Prateek Bora , Glenn Miles , Aditya Gupta , Mahesh Salgaonkar , Jishnu Warrier Subject: [PATCH] hw/pci-host: Split PowerNV PHB5 code from PHB4 files Date: Mon, 1 Jun 2026 21:48:02 +0530 Message-ID: <20260601161802.202512-1-jishnuvw@linux.ibm.com> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Authority-Analysis: v=2.4 cv=Zt3d7d7G c=1 sm=1 tr=0 ts=6a1db0d1 cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=FelO9ux0wxsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VnNF1IyMAAAA:8 a=Ktw8pwExaukf0xcacNkA:9 X-Proofpoint-GUID: pqx9g2TLA95hhdapWnZh6QSX3YkAGCE3 X-Proofpoint-ORIG-GUID: Qdo_Fw7T0awqhFumvhDMuAhgKGpl4rWR X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjAxMDE2MCBTYWx0ZWRfXydo+Vf+N66fM eYV0zH1jvSRbAYcVwRWX1vqKBTmdWGgDnr6y3UVjj8IR9zr+8NXUeP/PfB6uzChVHTSyhJW/Cie eqMzNZAC4BXB/g2OSgWtzPaPORaQMUDU8mhMeFMrOrUNpzNcLAdVtERn/LTby1Ew3fMxw4Hcu3r ODli4u3CUwoHPmAm3sGW07Tx+gM4j+T1RMiNjJ+qpJLYTYMGDDPhTa7T/oBdBvq59dWa/q0ENYG 8b+jkZQHA/yF3zMVFsSkLodcEUtmLt+yhwpVAgBoADBVJFWymB+LyJXlr2cCfKVc4PJq0Azimru V2qMQFMVoJD0LnqxeoxPEevfF2+tmHtoQh0+DGDyJm/l0+hJB+cZqCmlS6txItFNPLRMKvhxrLa sYxiknGfTEne7ISB/oKH6BCRbliBIJI1/j3O47+8dBs0TmOBFsiFuNiXg/e4gfz/yYdiKke/nO0 +bMF+hdU5jYtSsp/nSg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-06-01_04,2026-05-28_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 clxscore=1015 phishscore=0 spamscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605210000 definitions=main-2606010160 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=lists1p.gnu.org; Received-SPF: pass client-ip=148.163.158.5; envelope-from=jishnuvw@linux.ibm.com; helo=mx0b-001b2d01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1780330736840158500 Content-Type: text/plain; charset="utf-8" Separate Power10/11 PHB5 implementation from Power9 PHB4 code for better maintainability and clarity. This is a pure code movement with no functional changes. Signed-off-by: Jishnu Warrier --- hw/pci-host/meson.build | 2 + hw/pci-host/pnv_phb4.c | 6 --- hw/pci-host/pnv_phb4_pec.c | 58 ------------------------- hw/pci-host/pnv_phb5.c | 23 ++++++++++ hw/pci-host/pnv_phb5_pec.c | 89 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 114 insertions(+), 64 deletions(-) create mode 100644 hw/pci-host/pnv_phb5.c create mode 100644 hw/pci-host/pnv_phb5_pec.c diff --git a/hw/pci-host/meson.build b/hw/pci-host/meson.build index 86b754d0b0..3217e7e912 100644 --- a/hw/pci-host/meson.build +++ b/hw/pci-host/meson.build @@ -44,5 +44,7 @@ specific_ss.add(when: 'CONFIG_PCI_POWERNV', if_true: file= s( 'pnv_phb3_pbcq.c', 'pnv_phb4.c', 'pnv_phb4_pec.c', + 'pnv_phb5.c', + 'pnv_phb5_pec.c', 'pnv_phb.c', )) diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c index 396bc47817..705a5bcf07 100644 --- a/hw/pci-host/pnv_phb4.c +++ b/hw/pci-host/pnv_phb4.c @@ -1721,11 +1721,6 @@ static const TypeInfo pnv_phb4_type_info =3D { } }; =20 -static const TypeInfo pnv_phb5_type_info =3D { - .name =3D TYPE_PNV_PHB5, - .parent =3D TYPE_PNV_PHB4, - .instance_size =3D sizeof(PnvPHB4), -}; =20 static void pnv_phb4_root_bus_get_prop(Object *obj, Visitor *v, const char *name, @@ -1794,7 +1789,6 @@ static void pnv_phb4_register_types(void) { type_register_static(&pnv_phb4_root_bus_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 diff --git a/hw/pci-host/pnv_phb4_pec.c b/hw/pci-host/pnv_phb4_pec.c index 58ec14ec2f..ee5cdc3e45 100644 --- a/hw/pci-host/pnv_phb4_pec.c +++ b/hw/pci-host/pnv_phb4_pec.c @@ -394,67 +394,9 @@ static const TypeInfo pnv_pec_type_info =3D { } }; =20 -/* - * POWER10 definitions - */ -static uint32_t pnv_phb5_pec_xscom_cplt_base(PnvPhb4PecState *pec) -{ - return PNV10_XSCOM_PEC_NEST_CPLT_BASE + XPEC_PCI_CPLT_OFFSET * pec->in= dex; -} - -static uint32_t pnv_phb5_pec_xscom_pci_base(PnvPhb4PecState *pec) -{ - return PNV10_XSCOM_PEC_PCI_BASE + 0x1000000 * pec->index; -} - -static uint32_t pnv_phb5_pec_xscom_nest_base(PnvPhb4PecState *pec) -{ - /* index goes down ... */ - return PNV10_XSCOM_PEC_NEST_BASE - 0x1000000 * pec->index; -} - -/* - * PEC0 -> 3 stacks - * PEC1 -> 3 stacks - */ -static const uint32_t pnv_phb5_pec_num_stacks[] =3D { 3, 3 }; - -static void pnv_phb5_pec_class_init(ObjectClass *klass, const void *data) -{ - PnvPhb4PecClass *pecc =3D PNV_PHB4_PEC_CLASS(klass); - static const char compat[] =3D "ibm,power10-pbcq"; - static const char stk_compat[] =3D "ibm,power10-phb-stack"; - - pecc->xscom_cplt_base =3D pnv_phb5_pec_xscom_cplt_base; - pecc->xscom_nest_base =3D pnv_phb5_pec_xscom_nest_base; - pecc->xscom_pci_base =3D pnv_phb5_pec_xscom_pci_base; - pecc->xscom_nest_size =3D PNV10_XSCOM_PEC_NEST_SIZE; - pecc->xscom_pci_size =3D PNV10_XSCOM_PEC_PCI_SIZE; - pecc->compat =3D compat; - pecc->compat_size =3D sizeof(compat); - pecc->stk_compat =3D stk_compat; - pecc->stk_compat_size =3D sizeof(stk_compat); - pecc->version =3D PNV_PHB5_VERSION; - pecc->phb_type =3D TYPE_PNV_PHB5; - pecc->num_phbs =3D pnv_phb5_pec_num_stacks; -} - -static const TypeInfo pnv_phb5_pec_type_info =3D { - .name =3D TYPE_PNV_PHB5_PEC, - .parent =3D TYPE_PNV_PHB4_PEC, - .instance_size =3D sizeof(PnvPhb4PecState), - .class_init =3D pnv_phb5_pec_class_init, - .class_size =3D sizeof(PnvPhb4PecClass), - .interfaces =3D (const InterfaceInfo[]) { - { TYPE_PNV_XSCOM_INTERFACE }, - { } - } -}; - static void pnv_pec_register_types(void) { type_register_static(&pnv_pec_type_info); - type_register_static(&pnv_phb5_pec_type_info); } =20 type_init(pnv_pec_register_types); diff --git a/hw/pci-host/pnv_phb5.c b/hw/pci-host/pnv_phb5.c new file mode 100644 index 0000000000..4b72539cec --- /dev/null +++ b/hw/pci-host/pnv_phb5.c @@ -0,0 +1,23 @@ +/* + * SPDX-License-Identifier: GPL-2.0-or-later + * + * QEMU PowerPC PowerNV (POWER10) PHB5 model + * + * Copyright (c) 2018-2026, IBM Corporation. + */ +#include "qemu/osdep.h" +#include "hw/pci-host/pnv_phb4.h" +#include "qom/object.h" + +static const TypeInfo pnv_phb5_type_info =3D { + .name =3D TYPE_PNV_PHB5, + .parent =3D TYPE_PNV_PHB4, + .instance_size =3D sizeof(PnvPHB4), +}; + +static void pnv_phb5_register_types(void) +{ + type_register_static(&pnv_phb5_type_info); +} + +type_init(pnv_phb5_register_types); diff --git a/hw/pci-host/pnv_phb5_pec.c b/hw/pci-host/pnv_phb5_pec.c new file mode 100644 index 0000000000..d48bc09b8b --- /dev/null +++ b/hw/pci-host/pnv_phb5_pec.c @@ -0,0 +1,89 @@ +/* + * SPDX-License-Identifier: GPL-2.0-or-later + * + * QEMU PowerPC PowerNV (POWER10) PHB5 PEC model + * + * Copyright (c) 2018-2026, IBM Corporation. + */ +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qemu/log.h" +#include "target/ppc/cpu.h" +#include "hw/ppc/fdt.h" +#include "hw/pci-host/pnv_phb4_regs.h" +#include "hw/pci-host/pnv_phb4.h" +#include "hw/ppc/pnv_xscom.h" +#include "hw/pci/pci_bridge.h" +#include "hw/pci/pci_bus.h" +#include "hw/ppc/pnv.h" +#include "hw/ppc/pnv_chip.h" +#include "hw/core/qdev-properties.h" +#include "system/system.h" + +#include + +#define XPEC_PCI_CPLT_OFFSET 0x1000000ULL + +/* + * POWER10 definitions + */ +static uint32_t pnv_phb5_pec_xscom_cplt_base(PnvPhb4PecState *pec) +{ + return PNV10_XSCOM_PEC_NEST_CPLT_BASE + XPEC_PCI_CPLT_OFFSET * pec->in= dex; +} + +static uint32_t pnv_phb5_pec_xscom_pci_base(PnvPhb4PecState *pec) +{ + return PNV10_XSCOM_PEC_PCI_BASE + 0x1000000 * pec->index; +} + +static uint32_t pnv_phb5_pec_xscom_nest_base(PnvPhb4PecState *pec) +{ + /* index goes down ... */ + return PNV10_XSCOM_PEC_NEST_BASE - 0x1000000 * pec->index; +} + +/* + * PEC0 -> 3 stacks + * PEC1 -> 3 stacks + */ +static const uint32_t pnv_phb5_pec_num_stacks[] =3D { 3, 3 }; + +static void pnv_phb5_pec_class_init(ObjectClass *klass, const void *data) +{ + PnvPhb4PecClass *pecc =3D PNV_PHB4_PEC_CLASS(klass); + static const char compat[] =3D "ibm,power10-pbcq"; + static const char stk_compat[] =3D "ibm,power10-phb-stack"; + + pecc->xscom_cplt_base =3D pnv_phb5_pec_xscom_cplt_base; + pecc->xscom_nest_base =3D pnv_phb5_pec_xscom_nest_base; + pecc->xscom_pci_base =3D pnv_phb5_pec_xscom_pci_base; + pecc->xscom_nest_size =3D PNV10_XSCOM_PEC_NEST_SIZE; + pecc->xscom_pci_size =3D PNV10_XSCOM_PEC_PCI_SIZE; + pecc->compat =3D compat; + pecc->compat_size =3D sizeof(compat); + pecc->stk_compat =3D stk_compat; + pecc->stk_compat_size =3D sizeof(stk_compat); + pecc->version =3D PNV_PHB5_VERSION; + pecc->phb_type =3D TYPE_PNV_PHB5; + pecc->num_phbs =3D pnv_phb5_pec_num_stacks; +} + +static const TypeInfo pnv_phb5_pec_type_info =3D { + .name =3D TYPE_PNV_PHB5_PEC, + .parent =3D TYPE_PNV_PHB4_PEC, + .instance_size =3D sizeof(PnvPhb4PecState), + .class_init =3D pnv_phb5_pec_class_init, + .class_size =3D sizeof(PnvPhb4PecClass), + .interfaces =3D (const InterfaceInfo[]) { + { TYPE_PNV_XSCOM_INTERFACE }, + { } + } +}; + +static void pnv_phb5_pec_register_types(void) +{ + type_register_static(&pnv_phb5_pec_type_info); +} + +type_init(pnv_phb5_pec_register_types); --=20 2.53.0