aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/npu3-nvlink.c2
-rw-r--r--include/npu3.h6
2 files changed, 7 insertions, 1 deletions
diff --git a/hw/npu3-nvlink.c b/hw/npu3-nvlink.c
index 9630158..b8856dd 100644
--- a/hw/npu3-nvlink.c
+++ b/hw/npu3-nvlink.c
@@ -1478,7 +1478,7 @@ static void npu3_dt_add_props(struct npu3 *npu)
"ibm,ioda2-npu3-phb");
dt_add_property_cells(dn, "ibm,phb-index",
- dt_prop_get_u32(npu->dt_node, "ibm,phb-index"));
+ npu3_get_phb_index(npu->index));
dt_add_property_cells(dn, "ibm,phb-diag-data-size", 0);
dt_add_property_cells(dn, "ibm,opal-num-pes", NPU3_MAX_PE_NUM);
dt_add_property_cells(dn, "ibm,opal-reserved-pe", NPU3_RESERVED_PE_NUM);
diff --git a/include/npu3.h b/include/npu3.h
index 1c657f9..0fdad4d 100644
--- a/include/npu3.h
+++ b/include/npu3.h
@@ -177,4 +177,10 @@ int64_t npu3_map_lpar(struct phb *phb, uint64_t bdf, uint64_t lparid,
int64_t npu3_set_relaxed_order(struct phb *phb, uint32_t gcid, int pec,
bool enable);
+#define NPU3_PHB_INDEX_BASE 6 /* immediately after real PHBs */
+static inline int npu3_get_phb_index(unsigned int npu_index)
+{
+ return NPU3_PHB_INDEX_BASE + npu_index;
+}
+
#endif /* __NPU3_H */