[Skiboot] [RFC PATCH 17/23] hw/phb4: Move link tracing into poll_link()

Oliver O'Halloran oohall at gmail.com
Wed Apr 3 20:09:14 AEDT 2019


Currently when we bring the link up we'll stay in the and the link
training trace is enabled we stay in the FRESET_ASSERT_DELAY state until
the link is trained.

Although this is not wrong, it does mean that we don't get a link training
trace in the HRESET case and it's additional PHB4 specific behavior
in the FRESET path. We want to move to a generic FRESET function that
correctly deals with power-controlled slots, so this patch moves the
link trace into the poll_link() function to handle the HRESET case
and make the FRESET path more generic.

Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
 hw/phb4.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/hw/phb4.c b/hw/phb4.c
index c63e916da0b7..3a6b05b4a5a6 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -2789,8 +2789,11 @@ static int64_t phb4_poll_link(struct pci_slot *slot)
 		PHBDBG(p, "LINK: Start polling\n");
 		slot->retries = PHB4_LINK_ELECTRICAL_RETRIES;
 		pci_slot_set_state(slot, PHB4_SLOT_LINK_WAIT_ELECTRICAL);
-		/* Polling early here has no chance of a false positive */
-		return pci_slot_set_sm_timeout(slot, msecs_to_tb(1));
+
+		if (pci_tracing)
+			phb4_training_trace(p);
+
+		/* fallthrough */
 	case PHB4_SLOT_LINK_WAIT_ELECTRICAL:
 		/*
 		 * Wait for the link electrical connection to be
@@ -3049,8 +3052,6 @@ static int64_t phb4_freset(struct pci_slot *slot)
 		PHBDBG(p, "FRESET: Deassert\n");
 		phb4_assert_perst(slot, false);
 
-		phb4_training_trace(p);
-
 		pci_slot_set_state(slot, PHB4_SLOT_LINK_START);
 		return slot->ops.poll_link(slot);
 	default:
-- 
2.20.1



More information about the Skiboot mailing list