Skip to content

Commit

Permalink
npu2-opencapi: Log ODL endpoint information register
Browse files Browse the repository at this point in the history
If the link trains in degraded mode, log the ODL endpoint information
register for debug. Its content is specific to the DLx and TLx
implementation, so this is really information useful for the hardware
team.

Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
  • Loading branch information
fbarrat authored and stewartsmith committed Nov 28, 2018
1 parent 64d06b1 commit e1a8469
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
29 changes: 28 additions & 1 deletion hw/npu2-opencapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,30 @@ static uint64_t get_odl_training_status(uint32_t gcid, uint64_t index)
return reg;
}

static uint64_t get_odl_endpoint_info(uint32_t gcid, uint64_t index)
{
uint64_t status_xscom, reg;

switch (index) {
case 2:
status_xscom = OB0_ODL0_ENDPOINT_INFO;
break;
case 3:
status_xscom = OB0_ODL1_ENDPOINT_INFO;
break;
case 4:
status_xscom = OB3_ODL1_ENDPOINT_INFO;
break;
case 5:
status_xscom = OB3_ODL0_ENDPOINT_INFO;
break;
default:
assert(false);
}
xscom_read(gcid, status_xscom, &reg);
return reg;
}

static void disable_nvlink(uint32_t gcid, int index)
{
uint64_t phy_config_scom, reg;
Expand Down Expand Up @@ -1047,9 +1071,12 @@ static int64_t npu2_opencapi_get_link_state(struct pci_slot *slot, uint8_t *val)

static void check_trained_link(struct npu2_dev *dev, uint64_t odl_status)
{
if (get_link_width(odl_status) != OPAL_SHPC_LINK_UP_x8)
if (get_link_width(odl_status) != OPAL_SHPC_LINK_UP_x8) {
OCAPIERR(dev, "Link trained in degraded mode (%016llx)\n",
odl_status);
OCAPIDBG(dev, "Link endpoint info: %016llx\n",
get_odl_endpoint_info(dev->npu->chip_id, dev->brick_index));
}
}

static int64_t npu2_opencapi_retry_state(struct pci_slot *slot,
Expand Down
5 changes: 5 additions & 0 deletions include/npu2-regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -751,4 +751,9 @@ void npu2_scom_write(uint64_t gcid, uint64_t scom_base,
#define OB3_ODL1_TRAINING_STATUS 0xC01082F
#define OB_ODL_TRAINING_STATUS_STS_RX_PATTERN_B PPC_BITMASK(8, 15)

#define OB0_ODL0_ENDPOINT_INFO 0x9010832
#define OB0_ODL1_ENDPOINT_INFO 0x9010833
#define OB3_ODL0_ENDPOINT_INFO 0xC010832
#define OB3_ODL1_ENDPOINT_INFO 0xC010833

#endif /* __NPU2_REGS_H */

0 comments on commit e1a8469

Please sign in to comment.