[Skiboot] [PATCH] phb4: Reassign link_retries counter in IODA purge

Guilherme G. Piccoli gpiccoli at linux.vnet.ibm.com
Sat Sep 30 10:05:22 AEST 2017

Recently, a link_retries counter was added in pci/phb4 in order
Skiboot can retry to train a link some times - default number of
attempts to retrain a link is 3.

Happens that, if during a regular boot process we exhaust the
link retries and fail to train a PHB, the variable link_retries
is stuck in 0. If a kdump happens later, a PHB reset procedure is
triggered by Linux and, since we have a decrement-and-test in this
variable, we end up setting it to -1; it's unsigned, hence we get
an overflow.

This patch fixes the issue by reassigning the default value to
link_retries in every IODA purge.

Signed-off-by: Guilherme G. Piccoli <gpiccoli at linux.vnet.ibm.com>
 hw/phb4.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/phb4.c b/hw/phb4.c
index b94d4925..de627b63 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -1099,6 +1099,8 @@ static int64_t phb4_ioda_reset(struct phb *phb, bool purge)
 	if (purge) {
 		PHBDBG(p, "Purging all IODA tables...\n");
+		if (phb->slot)
+			phb->slot->link_retries = PHB4_LINK_LINK_RETRIES;

More information about the Skiboot mailing list