Skip to contentSkip to conversation

hw/pci-host: Split PowerNV PHB5 code from PHB4 files

PATCH Superseded Jishnu Warrier 2 participants 2 messages Jun 1 – Jun 2 Arm/Amlogic Meson SoC support

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/pci-host: Split PowerNV PHB5 code from PHB4 files

Separate Power10/11 PHB5 implementation from Power9 PHB4 code for better maintainability and clarity. This is a pure code movement with no functional changes.

---
 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
hw/pci-host/meson.build +2 -0
index 86b754d0b0..3217e7e912 100644
@@ -44,5 +44,7 @@ specific_ss.add(when: 'CONFIG_PCI_POWERNV', if_true: files(
   'pnv_phb3_pbcq.c',
   'pnv_phb4.c',
   'pnv_phb4_pec.c',
+  'pnv_phb5.c',
+  'pnv_phb5_pec.c',
   'pnv_phb.c',
 ))
hw/pci-host/pnv_phb4.c +0 -6
index 396bc47817..705a5bcf07 100644
@@ -1721,11 +1721,6 @@ static const TypeInfo pnv_phb4_type_info = {
     }
 };
 
-static const TypeInfo pnv_phb5_type_info = {
-    .name          = TYPE_PNV_PHB5,
-    .parent        = TYPE_PNV_PHB4,
-    .instance_size = sizeof(PnvPHB4),
-};
 
 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);
 }
 
hw/pci-host/pnv_phb4_pec.c +0 -58

67 lines not on this page · raw message

hw/pci-host/pnv_phb5.c new file +23 -0
new file mode 100644
index 0000000000..4b72539cec
@@ -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 = {
+    .name          = TYPE_PNV_PHB5,
+    .parent        = TYPE_PNV_PHB4,
+    .instance_size = sizeof(PnvPHB4),
+};
+
+static void pnv_phb5_register_types(void)
+{
+    type_register_static(&pnv_phb5_type_info);
+}
+
+type_init(pnv_phb5_register_types);
hw/pci-host/pnv_phb5_pec.c new file +89 -0

89 lines not on this page · raw message

Signature · 1 line
2.53.0
#1 lore raw

Thanks for this patch jishnu

Quoted 7 lines · Jishnu Warrier

Separate Power10/11 PHB5 implementation from Power9 PHB4 code for better maintainability and clarity. This is a pure code movement with no functional changes.

<...snip...>

Quoted 7 lines

+/*
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
+ * QEMU PowerPC PowerNV (POWER10) PHB5 model
+ *
+ * Copyright (c) 2018-2026, IBM Corporation.
+ */

minor nit: generally the file description is at the top, SPDX line can go at the end of comment

Quoted 35 lines
hw/pci-host/pnv_phb5.c new file +16 -0
+#include "qemu/osdep.h"
+#include "hw/pci-host/pnv_phb4.h"
+#include "qom/object.h"
+
+static const TypeInfo pnv_phb5_type_info = {
+    .name          = TYPE_PNV_PHB5,
+    .parent        = TYPE_PNV_PHB4,
+    .instance_size = sizeof(PnvPHB4),
+};
+
+static void pnv_phb5_register_types(void)
+{
+    type_register_static(&pnv_phb5_type_info);
+}
+
+type_init(pnv_phb5_register_types);
hw/pci-host/pnv_phb5_pec.c new file +13 -0
new file mode 100644
index 0000000000..d48bc09b8b
@@ -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"

hw/pci-host/pnv_phb5_pec.c line 23

Quoted 10 lines
hw/pci-host/pnv_phb5_pec.c new file +10 -0
+#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 <libfdt.h>

nit: fdt related and other headers are not required, for me, below includes look enough:

    #include "qemu/osdep.h"
    #include "hw/pci-host/pnv_phb4.h"
    #include "hw/ppc/pnv_xscom.h"

similarly qom/object.h isn't required in pnv_phb5.c

rest of the code looks good to me.

Thanks,

- Aditya G