From patchwork Wed Apr 10 18:07:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Spencer Lingard X-Patchwork-Id: 1083548 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=mellanox.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44fXQm1P64z9s71 for ; Thu, 11 Apr 2019 04:15:59 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729818AbfDJSP6 (ORCPT ); Wed, 10 Apr 2019 14:15:58 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:44861 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729811AbfDJSP6 (ORCPT ); Wed, 10 Apr 2019 14:15:58 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from spencer@mellanox.com) with ESMTPS (AES256-SHA encrypted); 10 Apr 2019 21:15:56 +0300 Received: from farm-1.mtbu.labs.mlnx (farm-1.mtbu.labs.mlnx [10.15.2.31]) by mtbu-labmailer.labs.mlnx (8.14.4/8.14.4) with ESMTP id x3AIFtPr026890; Wed, 10 Apr 2019 14:15:55 -0400 Received: (from spencer@localhost) by farm-1.mtbu.labs.mlnx (8.14.7/8.13.8/Submit) id x3AIFsYn024960; Wed, 10 Apr 2019 14:15:54 -0400 From: Spencer Lingard To: lukas@wunner.de Cc: linux-pci@vger.kernel.org, Spencer Lingard Subject: [PATCH] PCI: pciehp: Fix false command timeouts on boot Date: Wed, 10 Apr 2019 14:07:48 -0400 Message-Id: <1554919668-24873-1-git-send-email-spencer@mellanox.com> X-Mailer: git-send-email 2.1.2 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org During command writes, pcie_poll_cmd() is invoked if Command Completed notifications are disabled. When polling, if Command Completed is set, the bit is reset and success is returned, but ctrl->cmd_busy is not set back to 0. The next command write then attempts to wait on a command that has already been completed, timing out after 2 seconds. This delay occurs more frequently at boot time, since pcie_init() disables notifications when powering down empty slots. Clear cmd_busy upon successful command completion during pcie_poll_cmd(). Signed-off-by: Spencer Lingard Cc: Lukas Wunner Reviewed-by: Lukas Wunner --- drivers/pci/hotplug/pciehp_hpc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 6a2365c..28c70cf 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -77,6 +77,7 @@ static int pcie_poll_cmd(struct controller *ctrl, int timeout) if (slot_status & PCI_EXP_SLTSTA_CC) { pcie_capability_write_word(pdev, PCI_EXP_SLTSTA, PCI_EXP_SLTSTA_CC); + ctrl->cmd_busy = 0; return 1; } if (timeout < 0)