Skip to content

Commit

Permalink
hdata/slots: Apply slot label to the parent slot
Browse files Browse the repository at this point in the history
Slot names only really make sense when applied to an actual slot rather
than a device. On witherspoon the GPU devices have a name associated with
the device rather than the slot for the GPUs. Add a hack that moves the
slot label to the parent slot rather than on the device itself.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
  • Loading branch information
oohal authored and stewartsmith committed Apr 23, 2018
1 parent 6878b80 commit ac11641
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
16 changes: 15 additions & 1 deletion hdata/iohub.c
Original file line number Diff line number Diff line change
Expand Up @@ -757,9 +757,23 @@ static void parse_one_slot(const struct slot_map_entry *entry,
dt_add_property_cells(node, "lanes-reversed",
be16_to_cpu(entry->lane_reverse));

if (strnlen(entry->name, sizeof(entry->name)))
if (strnlen(entry->name, sizeof(entry->name))) {
/*
* HACK: On some platforms (witherspoon) the slot label is
* applied to the device rather than the pcie downstream port
* that has the slot under it. Hack around this by moving the
* slot label up if the parent port doesn't have one.
*/
if (dt_node_is_compatible(node->parent, "ibm,pcie-port") &&
!dt_find_property(node->parent, "ibm,slot-label")) {
dt_add_property_nstr(node->parent, "ibm,slot-label",
entry->name, sizeof(entry->name));
}

dt_add_property_nstr(node, "ibm,slot-label",
entry->name, sizeof(entry->name));
}

if (entry->type == st_slot || entry->type == st_rc_slot)
dt_add_property(node, "ibm,pluggable", NULL, 0);

Expand Down
8 changes: 7 additions & 1 deletion hdata/spira.c
Original file line number Diff line number Diff line change
Expand Up @@ -1529,7 +1529,13 @@ static void add_npu(struct dt_node *xscom, const struct HDIF_array_hdr *links,
continue;
}

name = dt_prop_get_def(slot, "ibm,slot-label",
/*
* The slot_id points to a node that indicates that
* this GPU should appear under the slot. Grab the
* slot-label from the parent node that represents
* the actual slot.
*/
name = dt_prop_get_def(slot->parent, "ibm,slot-label",
(char *)"<SLOT NAME MISSING>");

prlog(PR_DEBUG, "NPU: %04x:%d: Target slot %s\n",
Expand Down

0 comments on commit ac11641

Please sign in to comment.