[Skiboot] [PATCH] phb4: Avoid complete reset without finishing slot polling

Russell Currey ruscur at russell.cc
Thu Sep 14 17:28:40 AEST 2017


In rare circumstances, a complete reset can be requested on a slot while
it is still going through the link polling process.  This results in the
link never coming up.  In complete reset, check to see if the link needs
to complete its state transitions, and if so poll to completion.

Signed-off-by: Russell Currey <ruscur at russell.cc>
---
 hw/phb4.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/hw/phb4.c b/hw/phb4.c
index 1e148e0b..8dd16b69 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -2744,11 +2744,15 @@ static int64_t phb4_creset(struct pci_slot *slot)
 		pci_slot_set_state(slot, PHB4_SLOT_NORMAL);
 		return slot->ops.freset(slot);
 	default:
-		PHBERR(p, "CRESET: Unexpected slot state %08x, resetting...\n",
-		       slot->state);
-		pci_slot_set_state(slot, PHB4_SLOT_NORMAL);
-		return slot->ops.creset(slot);
-
+		if (slot->state & PCI_SLOT_STATE_LINK) {
+			PHBINF(p, "CRESET: Slot needs link polling\n");
+			return slot->ops.poll_link(slot);
+		} else {
+			PHBERR(p, "CRESET: Unexpected slot state %08x\n",
+			       slot->state);
+			pci_slot_set_state(slot, PHB4_SLOT_NORMAL);
+			return slot->ops.creset(slot);
+		}
 	}
 
 error:
-- 
2.14.1



More information about the Skiboot mailing list