Skip to content

Commit

Permalink
npu3: Don't use the device tree to assign the phb-index of the PHB
Browse files Browse the repository at this point in the history
On Axone, there's a 1-to-1 mapping between virtual PHBs and NPUs. We
could keep assigning the phb-index of the virtual PHB from the value
found in the npu node of the device tree, but to be consistent with
P9/npu2 and avoid confusion, this patch assigns the phb-index when the
virtual PHB is created, based on the npu index, similarly to what we
do on P9.

Reviewed-by: Reza Arbab <arbab@linux.ibm.com>
Reviewed-by: Andrew Donnellan <ajd@linux.ibm.com>
Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
  • Loading branch information
fbarrat authored and oohal committed Jan 29, 2020
1 parent da28a66 commit 57d43ef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion hw/npu3-nvlink.c
Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions include/npu3.h
Expand Up @@ -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 */

0 comments on commit 57d43ef

Please sign in to comment.