From patchwork Thu Sep 14 07:28:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell Currey X-Patchwork-Id: 813721 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xt9Pr5rGFz9t1t for ; Thu, 14 Sep 2017 17:38:40 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="STS5rMlE"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xt9Pr4G2YzDrVq for ; Thu, 14 Sep 2017 17:38:40 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="STS5rMlE"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=russell.cc (client-ip=66.111.4.27; helo=out3-smtp.messagingengine.com; envelope-from=ruscur@russell.cc; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="STS5rMlE"; dkim-atps=neutral X-Greylist: delayed 562 seconds by postgrey-1.36 at bilbo; Thu, 14 Sep 2017 17:38:21 AEST Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3xt9PT63dTzDrG1 for ; Thu, 14 Sep 2017 17:38:21 +1000 (AEST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id E609620B6D; Thu, 14 Sep 2017 03:28:55 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute6.internal (MEProxy); Thu, 14 Sep 2017 03:28:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=/+rkfC OTlxY+dRme1eJon4cwGY0xVVCxMUcwKiDe+vs=; b=STS5rMlEZIYf7ewmNvllqK b+hCU8NlSt8HMnwIFIAqqf68Ej/qOqgOvYry1jFl3yli3tHQKDy8w0f+l2GmMy1p oUa+OB/j1YMFJAqyXKO4LYRyjW5bEkMDTYYiuS/Tw7AXhVAKGEJjLRxw5lUduC5J DXT/GXtxkL7ixvOXsU0/Rm+Akzv0uvqprCiy92WSDOYD9S5/qT94hSnbCtu/m1Av 49kbpL8t2EYf4UTtNC2rst6qXkJSoQQrTPvSkWn8T9oPoBogw+4O0j3P1Qeg5W/P g9RBLbzT814D4RzV/uxykndUU+wcWdKA1bQNCneV0AD4LTBeFeWRB/NxmIpCkXjA == X-ME-Sender: X-Sasl-enc: RtEFpZNSZVDbiD+s+PbybPPlOM/yJWXPm7DVd88tlz04 1505374135 Received: from snap.ozlabs.ibm.com (unknown [122.99.82.10]) by mail.messagingengine.com (Postfix) with ESMTPA id C68C1244B4; Thu, 14 Sep 2017 03:28:54 -0400 (EDT) From: Russell Currey To: skiboot@lists.ozlabs.org Date: Thu, 14 Sep 2017 17:28:40 +1000 Message-Id: <20170914072840.11373-1-ruscur@russell.cc> X-Mailer: git-send-email 2.14.1 Subject: [Skiboot] [PATCH] phb4: Avoid complete reset without finishing slot polling X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" 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 --- 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: