mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-11 03:24:58 -06:00
ppc/pnv/phb4: Add pervasive chiplet support to PHB4/5
Each non-core chiplet on a chip has a "pervasive chiplet" unit and its xscom register set. This adds support for PHB4/5. skiboot reads the CPLT_CONF1 register in __phb4/5_get_max_link_width(), which shows up as unimplemented xscom reads. Set a value in PCI CONF1 register's link-width field to demonstrate skiboot doing something interesting with it. In the bigger picture, it might be better to model the pervasive chiplet type as parent that each non-core chiplet model derives from. For now this is enough to get the PHB registers implemented and working for skiboot, and provides a second example (after the N1 chiplet) that will help if the design is reworked as such. Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
This commit is contained in:
parent
7f98b4f25e
commit
6b56bb6dbc
4 changed files with 71 additions and 1 deletions
|
@ -197,6 +197,9 @@ static PnvPHB *pnv_pec_default_phb_realize(PnvPhb4PecState *pec,
|
||||||
return phb;
|
return phb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define XPEC_P9_PCI_LANE_CFG PPC_BITMASK(10, 11)
|
||||||
|
#define XPEC_P10_PCI_LANE_CFG PPC_BITMASK(0, 1)
|
||||||
|
|
||||||
static void pnv_pec_realize(DeviceState *dev, Error **errp)
|
static void pnv_pec_realize(DeviceState *dev, Error **errp)
|
||||||
{
|
{
|
||||||
PnvPhb4PecState *pec = PNV_PHB4_PEC(dev);
|
PnvPhb4PecState *pec = PNV_PHB4_PEC(dev);
|
||||||
|
@ -211,6 +214,43 @@ static void pnv_pec_realize(DeviceState *dev, Error **errp)
|
||||||
|
|
||||||
pec->num_phbs = pecc->num_phbs[pec->index];
|
pec->num_phbs = pecc->num_phbs[pec->index];
|
||||||
|
|
||||||
|
/* Pervasive chiplet */
|
||||||
|
object_initialize_child(OBJECT(pec), "nest-pervasive-common",
|
||||||
|
&pec->nest_pervasive,
|
||||||
|
TYPE_PNV_NEST_CHIPLET_PERVASIVE);
|
||||||
|
if (!qdev_realize(DEVICE(&pec->nest_pervasive), NULL, errp)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set up pervasive chiplet registers */
|
||||||
|
/*
|
||||||
|
* Most registers are not set up, this just sets the PCI CONF1 link-width
|
||||||
|
* field because skiboot probes it.
|
||||||
|
*/
|
||||||
|
if (pecc->version == PNV_PHB4_VERSION) {
|
||||||
|
/*
|
||||||
|
* On P9, PEC2 has configurable 1/2/3-furcation).
|
||||||
|
* Make it trifurcated (x8, x4, x4) to match pnv_pec_num_phbs.
|
||||||
|
*/
|
||||||
|
if (pec->index == 2) {
|
||||||
|
pec->nest_pervasive.control_regs.cplt_cfg1 =
|
||||||
|
SETFIELD(XPEC_P9_PCI_LANE_CFG,
|
||||||
|
pec->nest_pervasive.control_regs.cplt_cfg1,
|
||||||
|
0b10);
|
||||||
|
}
|
||||||
|
} else if (pecc->version == PNV_PHB5_VERSION) {
|
||||||
|
/*
|
||||||
|
* On P10, both PECs are configurable 1/2/3-furcation).
|
||||||
|
* Both are trifurcated to match pnv_phb5_pec_num_stacks.
|
||||||
|
*/
|
||||||
|
pec->nest_pervasive.control_regs.cplt_cfg1 =
|
||||||
|
SETFIELD(XPEC_P10_PCI_LANE_CFG,
|
||||||
|
pec->nest_pervasive.control_regs.cplt_cfg1,
|
||||||
|
0b10);
|
||||||
|
} else {
|
||||||
|
g_assert_not_reached();
|
||||||
|
}
|
||||||
|
|
||||||
/* Create PHBs if running with defaults */
|
/* Create PHBs if running with defaults */
|
||||||
if (defaults_enabled()) {
|
if (defaults_enabled()) {
|
||||||
g_assert(pec->num_phbs <= MAX_PHBS_PER_PEC);
|
g_assert(pec->num_phbs <= MAX_PHBS_PER_PEC);
|
||||||
|
@ -290,9 +330,16 @@ static const Property pnv_pec_properties[] = {
|
||||||
PnvChip *),
|
PnvChip *),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define XPEC_PCI_CPLT_OFFSET 0x1000000ULL
|
||||||
|
|
||||||
|
static uint32_t pnv_pec_xscom_cplt_base(PnvPhb4PecState *pec)
|
||||||
|
{
|
||||||
|
return PNV9_XSCOM_PEC_NEST_CPLT_BASE + XPEC_PCI_CPLT_OFFSET * pec->index;
|
||||||
|
}
|
||||||
|
|
||||||
static uint32_t pnv_pec_xscom_pci_base(PnvPhb4PecState *pec)
|
static uint32_t pnv_pec_xscom_pci_base(PnvPhb4PecState *pec)
|
||||||
{
|
{
|
||||||
return PNV9_XSCOM_PEC_PCI_BASE + 0x1000000 * pec->index;
|
return PNV9_XSCOM_PEC_PCI_BASE + XPEC_PCI_CPLT_OFFSET * pec->index;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t pnv_pec_xscom_nest_base(PnvPhb4PecState *pec)
|
static uint32_t pnv_pec_xscom_nest_base(PnvPhb4PecState *pec)
|
||||||
|
@ -321,6 +368,7 @@ static void pnv_pec_class_init(ObjectClass *klass, void *data)
|
||||||
device_class_set_props(dc, pnv_pec_properties);
|
device_class_set_props(dc, pnv_pec_properties);
|
||||||
dc->user_creatable = false;
|
dc->user_creatable = false;
|
||||||
|
|
||||||
|
pecc->xscom_cplt_base = pnv_pec_xscom_cplt_base;
|
||||||
pecc->xscom_nest_base = pnv_pec_xscom_nest_base;
|
pecc->xscom_nest_base = pnv_pec_xscom_nest_base;
|
||||||
pecc->xscom_pci_base = pnv_pec_xscom_pci_base;
|
pecc->xscom_pci_base = pnv_pec_xscom_pci_base;
|
||||||
pecc->xscom_nest_size = PNV9_XSCOM_PEC_NEST_SIZE;
|
pecc->xscom_nest_size = PNV9_XSCOM_PEC_NEST_SIZE;
|
||||||
|
@ -349,6 +397,10 @@ static const TypeInfo pnv_pec_type_info = {
|
||||||
/*
|
/*
|
||||||
* POWER10 definitions
|
* 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->index;
|
||||||
|
}
|
||||||
|
|
||||||
static uint32_t pnv_phb5_pec_xscom_pci_base(PnvPhb4PecState *pec)
|
static uint32_t pnv_phb5_pec_xscom_pci_base(PnvPhb4PecState *pec)
|
||||||
{
|
{
|
||||||
|
@ -373,6 +425,7 @@ static void pnv_phb5_pec_class_init(ObjectClass *klass, void *data)
|
||||||
static const char compat[] = "ibm,power10-pbcq";
|
static const char compat[] = "ibm,power10-pbcq";
|
||||||
static const char stk_compat[] = "ibm,power10-phb-stack";
|
static const char stk_compat[] = "ibm,power10-phb-stack";
|
||||||
|
|
||||||
|
pecc->xscom_cplt_base = pnv_phb5_pec_xscom_cplt_base;
|
||||||
pecc->xscom_nest_base = pnv_phb5_pec_xscom_nest_base;
|
pecc->xscom_nest_base = pnv_phb5_pec_xscom_nest_base;
|
||||||
pecc->xscom_pci_base = pnv_phb5_pec_xscom_pci_base;
|
pecc->xscom_pci_base = pnv_phb5_pec_xscom_pci_base;
|
||||||
pecc->xscom_nest_size = PNV10_XSCOM_PEC_NEST_SIZE;
|
pecc->xscom_nest_size = PNV10_XSCOM_PEC_NEST_SIZE;
|
||||||
|
|
|
@ -1753,6 +1753,7 @@ static void pnv_chip_power9_pec_realize(PnvChip *chip, Error **errp)
|
||||||
for (i = 0; i < chip->num_pecs; i++) {
|
for (i = 0; i < chip->num_pecs; i++) {
|
||||||
PnvPhb4PecState *pec = &chip9->pecs[i];
|
PnvPhb4PecState *pec = &chip9->pecs[i];
|
||||||
PnvPhb4PecClass *pecc = PNV_PHB4_PEC_GET_CLASS(pec);
|
PnvPhb4PecClass *pecc = PNV_PHB4_PEC_GET_CLASS(pec);
|
||||||
|
uint32_t pec_cplt_base;
|
||||||
uint32_t pec_nest_base;
|
uint32_t pec_nest_base;
|
||||||
uint32_t pec_pci_base;
|
uint32_t pec_pci_base;
|
||||||
|
|
||||||
|
@ -1765,9 +1766,12 @@ static void pnv_chip_power9_pec_realize(PnvChip *chip, Error **errp)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pec_cplt_base = pecc->xscom_cplt_base(pec);
|
||||||
pec_nest_base = pecc->xscom_nest_base(pec);
|
pec_nest_base = pecc->xscom_nest_base(pec);
|
||||||
pec_pci_base = pecc->xscom_pci_base(pec);
|
pec_pci_base = pecc->xscom_pci_base(pec);
|
||||||
|
|
||||||
|
pnv_xscom_add_subregion(chip, pec_cplt_base,
|
||||||
|
&pec->nest_pervasive.xscom_ctrl_regs_mr);
|
||||||
pnv_xscom_add_subregion(chip, pec_nest_base, &pec->nest_regs_mr);
|
pnv_xscom_add_subregion(chip, pec_nest_base, &pec->nest_regs_mr);
|
||||||
pnv_xscom_add_subregion(chip, pec_pci_base, &pec->pci_regs_mr);
|
pnv_xscom_add_subregion(chip, pec_pci_base, &pec->pci_regs_mr);
|
||||||
}
|
}
|
||||||
|
@ -2027,6 +2031,7 @@ static void pnv_chip_power10_phb_realize(PnvChip *chip, Error **errp)
|
||||||
for (i = 0; i < chip->num_pecs; i++) {
|
for (i = 0; i < chip->num_pecs; i++) {
|
||||||
PnvPhb4PecState *pec = &chip10->pecs[i];
|
PnvPhb4PecState *pec = &chip10->pecs[i];
|
||||||
PnvPhb4PecClass *pecc = PNV_PHB4_PEC_GET_CLASS(pec);
|
PnvPhb4PecClass *pecc = PNV_PHB4_PEC_GET_CLASS(pec);
|
||||||
|
uint32_t pec_cplt_base;
|
||||||
uint32_t pec_nest_base;
|
uint32_t pec_nest_base;
|
||||||
uint32_t pec_pci_base;
|
uint32_t pec_pci_base;
|
||||||
|
|
||||||
|
@ -2039,9 +2044,12 @@ static void pnv_chip_power10_phb_realize(PnvChip *chip, Error **errp)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pec_cplt_base = pecc->xscom_cplt_base(pec);
|
||||||
pec_nest_base = pecc->xscom_nest_base(pec);
|
pec_nest_base = pecc->xscom_nest_base(pec);
|
||||||
pec_pci_base = pecc->xscom_pci_base(pec);
|
pec_pci_base = pecc->xscom_pci_base(pec);
|
||||||
|
|
||||||
|
pnv_xscom_add_subregion(chip, pec_cplt_base,
|
||||||
|
&pec->nest_pervasive.xscom_ctrl_regs_mr);
|
||||||
pnv_xscom_add_subregion(chip, pec_nest_base, &pec->nest_regs_mr);
|
pnv_xscom_add_subregion(chip, pec_nest_base, &pec->nest_regs_mr);
|
||||||
pnv_xscom_add_subregion(chip, pec_pci_base, &pec->pci_regs_mr);
|
pnv_xscom_add_subregion(chip, pec_pci_base, &pec->pci_regs_mr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "hw/pci-host/pnv_phb.h"
|
#include "hw/pci-host/pnv_phb.h"
|
||||||
#include "hw/pci/pci_bus.h"
|
#include "hw/pci/pci_bus.h"
|
||||||
#include "hw/ppc/pnv.h"
|
#include "hw/ppc/pnv.h"
|
||||||
|
#include "hw/ppc/pnv_nest_pervasive.h"
|
||||||
#include "hw/ppc/xive.h"
|
#include "hw/ppc/xive.h"
|
||||||
#include "qom/object.h"
|
#include "qom/object.h"
|
||||||
|
|
||||||
|
@ -174,6 +175,9 @@ struct PnvPhb4PecState {
|
||||||
uint32_t index;
|
uint32_t index;
|
||||||
uint32_t chip_id;
|
uint32_t chip_id;
|
||||||
|
|
||||||
|
/* Pervasive chiplet control */
|
||||||
|
PnvNestChipletPervasive nest_pervasive;
|
||||||
|
|
||||||
/* Nest registers, excuding per-stack */
|
/* Nest registers, excuding per-stack */
|
||||||
#define PHB4_PEC_NEST_REGS_COUNT 0xf
|
#define PHB4_PEC_NEST_REGS_COUNT 0xf
|
||||||
uint64_t nest_regs[PHB4_PEC_NEST_REGS_COUNT];
|
uint64_t nest_regs[PHB4_PEC_NEST_REGS_COUNT];
|
||||||
|
@ -196,6 +200,7 @@ struct PnvPhb4PecState {
|
||||||
struct PnvPhb4PecClass {
|
struct PnvPhb4PecClass {
|
||||||
DeviceClass parent_class;
|
DeviceClass parent_class;
|
||||||
|
|
||||||
|
uint32_t (*xscom_cplt_base)(PnvPhb4PecState *pec);
|
||||||
uint32_t (*xscom_nest_base)(PnvPhb4PecState *pec);
|
uint32_t (*xscom_nest_base)(PnvPhb4PecState *pec);
|
||||||
uint32_t xscom_nest_size;
|
uint32_t xscom_nest_size;
|
||||||
uint32_t (*xscom_pci_base)(PnvPhb4PecState *pec);
|
uint32_t (*xscom_pci_base)(PnvPhb4PecState *pec);
|
||||||
|
|
|
@ -126,6 +126,8 @@ struct PnvXScomInterfaceClass {
|
||||||
#define PNV9_XSCOM_PEC_PCI_BASE 0xd010800
|
#define PNV9_XSCOM_PEC_PCI_BASE 0xd010800
|
||||||
#define PNV9_XSCOM_PEC_PCI_SIZE 0x200
|
#define PNV9_XSCOM_PEC_PCI_SIZE 0x200
|
||||||
|
|
||||||
|
#define PNV9_XSCOM_PEC_NEST_CPLT_BASE 0x0d000000
|
||||||
|
|
||||||
/* XSCOM PCI "pass-through" window to PHB SCOM */
|
/* XSCOM PCI "pass-through" window to PHB SCOM */
|
||||||
#define PNV9_XSCOM_PEC_PCI_STK0 0x100
|
#define PNV9_XSCOM_PEC_PCI_STK0 0x100
|
||||||
#define PNV9_XSCOM_PEC_PCI_STK1 0x140
|
#define PNV9_XSCOM_PEC_PCI_STK1 0x140
|
||||||
|
@ -197,6 +199,8 @@ struct PnvXScomInterfaceClass {
|
||||||
#define PNV10_XSCOM_PEC_NEST_BASE 0x3011800 /* index goes downwards ... */
|
#define PNV10_XSCOM_PEC_NEST_BASE 0x3011800 /* index goes downwards ... */
|
||||||
#define PNV10_XSCOM_PEC_NEST_SIZE 0x100
|
#define PNV10_XSCOM_PEC_NEST_SIZE 0x100
|
||||||
|
|
||||||
|
#define PNV10_XSCOM_PEC_NEST_CPLT_BASE 0x08000000
|
||||||
|
|
||||||
#define PNV10_XSCOM_PEC_PCI_BASE 0x8010800 /* index goes upwards ... */
|
#define PNV10_XSCOM_PEC_PCI_BASE 0x8010800 /* index goes upwards ... */
|
||||||
#define PNV10_XSCOM_PEC_PCI_SIZE 0x200
|
#define PNV10_XSCOM_PEC_PCI_SIZE 0x200
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue