ppc/pnv: Add a nest MMU model
PATCH v2 1/1 ppc/pnv: Add a nest MMU model
The nest MMU is used for translations needed by I/O subsystems on Power10. The nest is the shared, on-chip infrastructure that connects CPU cores, memory controllers, and I/O.
This patch sets up a basic skeleton with its xscom area, mapping both needed xscom regions. Support required for PowerVM bringup.
Use Power9 property for device tree to allow OPAL to work with Power9 and Power10.
--- hw/ppc/meson.build | 1 + hw/ppc/pnv.c | 20 ++++++ hw/ppc/pnv_nmmu.c | 132 +++++++++++++++++++++++++++++++++++++ include/hw/ppc/pnv_chip.h | 3 + include/hw/ppc/pnv_nmmu.h | 28 ++++++++ include/hw/ppc/pnv_xscom.h | 4 ++ 6 files changed, 188 insertions(+) create mode 100644 hw/ppc/pnv_nmmu.c create mode 100644 include/hw/ppc/pnv_nmmu.h
hw/ppc/meson.build +1 -0
@@ -56,6 +56,7 @@ ppc_ss.add(when: 'CONFIG_POWERNV', if_true: files( 'pnv_pnor.c', 'pnv_nest_pervasive.c', 'pnv_n1_chiplet.c', + 'pnv_nmmu.c' )) # PowerPC 4xx boards ppc_ss.add(when: 'CONFIG_PPC405', if_true: files(
hw/ppc/pnv.c +20 -0
@@ -2196,6 +2196,11 @@ static void pnv_chip_power10_instance_init(Object *obj) TYPE_PNV_PHB5_PEC); } +for (i =0 ; i <PNV10_CHIP_MAX_NMMU ; i++) { +object_initialize_child (obj,"nmmu[*]" , &chip10->nmmu[i], +TYPE_PNV_NMMU ); + } +for (i =0 ; i < pcc->i2c_num_engines; i++) {object_initialize_child (obj,"i2c[*]" , &chip10->i2c[i],TYPE_PNV_I2C ); }
@@ -2410,6 +2415,21 @@ static void pnv_chip_power10_realize(DeviceState *dev, Error **errp)pnv_xscom_add_subregion (chip,PNV10_XSCOM_N1_PB_SCOM_ES_BASE , &chip10->n1_chiplet.xscom_pb_es_mr); +/* nest0/1 MMU */ +for (i =0 ; i <PNV10_CHIP_MAX_NMMU ; i++) { +object_property_set_int (OBJECT (&chip10->nmmu[i]),"nmmu_id" , + i , &error_fatal); +object_property_set_link (OBJECT (&chip10->nmmu[i]),"chip" , +OBJECT (chip), &error_abort); +if (!qdev_realize (DEVICE (&chip10->nmmu[i]),NULL , errp)) { +return ; + } + } +pnv_xscom_add_subregion (chip,PNV10_XSCOM_NEST0_MMU_BASE , + &chip10->nmmu[0 ].xscom_regs); +pnv_xscom_add_subregion (chip,PNV10_XSCOM_NEST1_MMU_BASE , + &chip10->nmmu[1 ].xscom_regs); +/* PHBs */ pnv_chip_power10_phb_realize (chip, &local_err);if (local_err) {
hw/ppc/pnv_nmmu.c new file +132 -0
132 lines not on this page · raw message
include/hw/ppc/pnv_chip.h +3 -0
@@ -7,6 +7,7 @@#include "hw/ppc/pnv_core.h" #include "hw/ppc/pnv_homer.h" #include "hw/ppc/pnv_n1_chiplet.h" +#include "hw/ppc/pnv_nmmu.h" #include "hw/ssi/pnv_spi.h" #include "hw/ppc/pnv_lpc.h" #include "hw/ppc/pnv_occ.h"
@@ -126,6 +127,8 @@ struct Pnv10Chip {PnvN1Chiplet n1_chiplet;#define PNV10_CHIP_MAX_PIB_SPIC 6PnvSpi pib_spic[PNV10_CHIP_MAX_PIB_SPIC ]; +#define PNV10_CHIP_MAX_NMMU 2 +PnvNMMU nmmu[PNV10_CHIP_MAX_NMMU ];uint32_t nr_quads;PnvQuad *quads;
include/hw/ppc/pnv_nmmu.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* QEMU PowerPC nest MMU model +* +* Copyright (c) 2025, IBM Corporation. +* +* SPDX-License-Identifier: GPL-2.0-or-later +* +* This code is licensed under the GPL version 2 or later. See the +* COPYING file in the top-level directory. +*/ + +#ifndef PPC_PNV_NMMU_H +#define PPC_PNV_NMMU_H + +#define TYPE_PNV_NMMU "pnv-nmmu" +#define PNV_NMMU (obj) OBJECT_CHECK(PnvNMMU, (obj), TYPE_PNV_NMMU) + +typedef struct PnvNMMU { +DeviceState parent; + +struct PnvChip *chip; + +MemoryRegion xscom_regs; +uint32_t nmmu_id; +uint64_t ptcr; +}PnvNMMU ; + +#endif /*PPC_PNV_NMMU_H */
include/hw/ppc/pnv_xscom.h +4 -0
@@ -196,6 +196,10 @@ struct PnvXScomInterfaceClass {#define PNV10_XSCOM_N1_PB_SCOM_ES_BASE 0x3011300#define PNV10_XSCOM_N1_PB_SCOM_ES_SIZE 0x100 +#define PNV10_XSCOM_NEST0_MMU_BASE 0x2010c40 +#define PNV10_XSCOM_NEST1_MMU_BASE 0x3010c40 +#define PNV10_XSCOM_NMMU_SIZE 0x20 +#define PNV10_XSCOM_PEC_NEST_BASE 0x3011800/* index goes downwards ... */ #define PNV10_XSCOM_PEC_NEST_SIZE 0x100
Signature · 1 line
2.47.3
Quoted 8 lines · Caleb Schlossin
The nest MMU is used for translations needed by I/O subsystems on Power10. The nest is the shared, on-chip infrastructure that connects CPU cores, memory controllers, and I/O.
This patch sets up a basic skeleton with its xscom area, mapping both needed xscom regions. Support required for PowerVM bringup.
Quoted 8 lines
Use Power9 property for device tree to allow OPAL to work with Power9 and Power10.
Reviewed-by Chalapathi V <[email protected]>Reviewed-by Glenn Miles <[email protected]>Signed-off-by Frederic Barrat <[email protected]>Signed-off-by Chalapathi V <[email protected]>Signed-off-by Caleb Schlossin <[email protected]>
Thanks for the patch.
- Aditya G
Quoted 18 lines · Aditya Gupta
Quoted 8 lines · Caleb Schlossin
The nest MMU is used for translations needed by I/O subsystems on Power10. The nest is the shared, on-chip infrastructure that connects CPU cores, memory controllers, and I/O.
This patch sets up a basic skeleton with its xscom area, mapping both needed xscom regions. Support required for PowerVM bringup.
Quoted 8 lines
Use Power9 property for device tree to allow OPAL to work with Power9 and Power10.
Reviewed-by Chalapathi V <[email protected]>Reviewed-by Glenn Miles <[email protected]>Signed-off-by Frederic Barrat <[email protected]>Signed-off-by Chalapathi V <[email protected]>Signed-off-by Caleb Schlossin <[email protected]>
Quoted 3 lines
Thanks for the patch.
Reviewed-by Aditya Gupta <[email protected]>
Btw, tested it with OPAL too, it works with OPAL too, as with the changed compat, opal correctly identifies the nmmu.
Thanks,
- Aditya G