diff options
author | Oliver O'Halloran <oohall@gmail.com> | 2017-09-20 19:46:01 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-09-20 20:13:35 -0500 |
commit | 768403ebcdf94d7667a47ba85d12debf0cb733dd (patch) | |
tree | b4a4beb49c2872de8d57e778ff4bc6d212bd35a7 | |
parent | 429abacbe43b441ef7f79bd25353f810d1b3f53d (diff) | |
download | skiboot-768403ebcdf94d7667a47ba85d12debf0cb733dd.zip skiboot-768403ebcdf94d7667a47ba85d12debf0cb733dd.tar.gz skiboot-768403ebcdf94d7667a47ba85d12debf0cb733dd.tar.bz2 |
npu2: Read slot label from the link node
Binding GPU to emulated NPU PCI devices is done using the slot labels
since the NPU devices do not have a patching slot node we need to
copy the label in here.
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | hw/npu2.c | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -710,6 +710,7 @@ static int npu2_dn_fixup(struct phb *phb, struct npu2 *p = phb_to_npu2(phb); struct npu2_dev *dev; uint32_t speed; + const char *label; dev = npu2_bdf_to_dev(p, pd->bdfn); assert(dev); @@ -730,9 +731,20 @@ static int npu2_dn_fixup(struct phb *phb, if (speed != 0xff) dt_add_property_cells(pd->dn, "ibm,nvlink-speed", speed); - /* NPU2 devices require a slot location to associate with GPUs */ - dev->slot_label = dt_prop_get_def(pd->dn, "ibm,slot-label", NULL); - if (!dev->slot_label) { + /* + * NPU2 devices require a slot location to associate with GPUs. + * This can be added via the slot table matching, otherwise we + * read it from the link node. + */ + label = dt_prop_get_def(pd->dn, "ibm,slot-label", NULL); + + if (!label) { + label = dt_prop_get_def(dev->dt_node, "ibm,slot-label", NULL); + if (label) + dt_add_property_string(pd->dn, "ibm,slot-label", label); + } + + if (!label) { /** * @fwts-label NPUNoPHBSlotLabel * @fwts-advice No GPU/NPU2 slot information was found. @@ -742,6 +754,8 @@ static int npu2_dn_fixup(struct phb *phb, return 0; } + dev->slot_label = label; + /* * Bind the emulated PCI device with the real one, which can't * be done until the PCI devices are populated. Once the real |