aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorFrederic Barrat <fbarrat@linux.ibm.com>2019-10-09 21:38:07 +0200
committerOliver O'Halloran <oohall@gmail.com>2019-10-22 17:31:45 +1100
commitdbc70aea3a2eec5d8d3c092c2397b2997e35ba60 (patch)
treeb0121d2d49e3f52eb0abe7db762f8187c27a051f /hw
parent7989d6edfcbbe9ba061b667f53b82f6860ffff01 (diff)
downloadskiboot-dbc70aea3a2eec5d8d3c092c2397b2997e35ba60.zip
skiboot-dbc70aea3a2eec5d8d3c092c2397b2997e35ba60.tar.gz
skiboot-dbc70aea3a2eec5d8d3c092c2397b2997e35ba60.tar.bz2
npu2-opencapi: Detect PHY reset errors
PHY reset can fail! Though past problems are now fixed, let's handle any future failure. Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com> Reviewed-by: Christophe Lombard <clombard@linux.vnet.ibm.com> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/npu2-hw-procedures.c13
-rw-r--r--hw/npu2-opencapi.c7
2 files changed, 16 insertions, 4 deletions
diff --git a/hw/npu2-hw-procedures.c b/hw/npu2-hw-procedures.c
index ad1627a..8379cbb 100644
--- a/hw/npu2-hw-procedures.c
+++ b/hw/npu2-hw-procedures.c
@@ -1041,10 +1041,17 @@ void npu2_opencapi_phy_init(struct npu2_dev *dev)
}
}
-void npu2_opencapi_phy_reset(struct npu2_dev *dev)
+int npu2_opencapi_phy_reset(struct npu2_dev *dev)
{
- run_procedure(dev, 4); /* procedure_phy_reset */
- run_procedure(dev, 6); /* procedure_phy_rx_dccal */
+ int rc;
+
+ rc = run_procedure(dev, 4); /* procedure_phy_reset */
+ if (rc != PROCEDURE_COMPLETE)
+ return -1;
+ rc = run_procedure(dev, 6); /* procedure_phy_rx_dccal */
+ if (rc != PROCEDURE_COMPLETE)
+ return -1;
+ return 0;
}
void npu2_opencapi_phy_prbs31(struct npu2_dev *dev)
diff --git a/hw/npu2-opencapi.c b/hw/npu2-opencapi.c
index ead6f5f..140b8ef 100644
--- a/hw/npu2-opencapi.c
+++ b/hw/npu2-opencapi.c
@@ -1187,6 +1187,7 @@ static int64_t npu2_opencapi_freset(struct pci_slot *slot)
struct npu2_dev *dev = phb_to_npu2_dev_ocapi(slot->phb);
uint32_t chip_id = dev->npu->chip_id;
uint8_t presence = 1;
+ int rc;
switch (slot->state) {
case OCAPI_SLOT_NORMAL:
@@ -1216,7 +1217,11 @@ static int64_t npu2_opencapi_freset(struct pci_slot *slot)
return pci_slot_set_sm_timeout(slot, msecs_to_tb(5));
case OCAPI_SLOT_FRESET_ASSERT_DELAY:
- npu2_opencapi_phy_reset(dev);
+ rc = npu2_opencapi_phy_reset(dev);
+ if (rc) {
+ OCAPIERR(dev, "FRESET: couldn't reset PHY state\n");
+ return OPAL_HARDWARE;
+ }
deassert_odl_reset(chip_id, dev->brick_index);
deassert_adapter_reset(dev);
pci_slot_set_state(slot,