From patchwork Sun Sep 24 00:16:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 9967693 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4EE6160384 for ; Sun, 24 Sep 2017 00:18:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 355B029028 for ; Sun, 24 Sep 2017 00:18:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2661C29219; Sun, 24 Sep 2017 00:18:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A657F2900F for ; Sun, 24 Sep 2017 00:18:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751932AbdIXARQ (ORCPT ); Sat, 23 Sep 2017 20:17:16 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:52526 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751920AbdIXARM (ORCPT ); Sat, 23 Sep 2017 20:17:12 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 08BFF60865; Sun, 24 Sep 2017 00:17:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1506212232; bh=WjQSnzV4QmYLzJsgIhYiRV6NNrlQ1wa8lbZ2jJOS4/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nKkcA/KdpwYnOUmeIvPOQZ+EE/WfY15384Yvx22z4Jcsx3co5siqNDcnfr+Va5C2U P7L/zakyDFQlWNkS69DI3m1QQBQFYc6mKNW/E9dYnYyFUSJJ98NVX6fdd7hlvYlL24 0ohdk/kFylMxPXTMKblKqTi3RC4zOZvv7nPc28zo= Received: from drakthul.qualcomm.com (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: okaya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 9C5F960768; Sun, 24 Sep 2017 00:17:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1506212231; bh=WjQSnzV4QmYLzJsgIhYiRV6NNrlQ1wa8lbZ2jJOS4/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ot/G0e6/EAvyfNm24jCNz8t8m61Pz0xFyHmyIOq/QOg53q6QwzE4FPwYioAW76kyY Wk0ssKUyv//4Xprd7cajL2W05HfiasXeQXqASOaFjpzjoqNUXnA6ZIBEHMsUr6LBX8 mah8rNW2ShH/VV19ZRyizkBkzzZYR4WQtQenqYCw= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 9C5F960768 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=okaya@codeaurora.org From: Sinan Kaya To: linux-pci@vger.kernel.org, timur@codeaurora.org, alex.williamson@redhat.com Cc: linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sinan Kaya , Bjorn Helgaas , linux-kernel@vger.kernel.org Subject: [PATCH 5/5] PCI: add device wait after slot and bus reset Date: Sat, 23 Sep 2017 20:16:58 -0400 Message-Id: <1506212218-29103-5-git-send-email-okaya@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1506212218-29103-1-git-send-email-okaya@codeaurora.org> References: <1506212218-29103-1-git-send-email-okaya@codeaurora.org> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Rev 3.1 Sec 2.3.1 Request Handling Rules indicates that a device can issue CRS following secondary bus reset. Handle device presence gracefully. Signed-off-by: Sinan Kaya --- drivers/pci/pci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 074adf9..7131aab 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -4056,7 +4056,7 @@ static int pci_parent_bus_reset(struct pci_dev *dev, int probe) pci_reset_bridge_secondary_bus(dev->bus->self); - return 0; + return pci_dev_wait(dev, "bus reset", 1000, 60000); } static int pci_reset_hotplug_slot(struct hotplug_slot *hotplug, int probe) @@ -4077,6 +4077,7 @@ static int pci_reset_hotplug_slot(struct hotplug_slot *hotplug, int probe) static int pci_dev_reset_slot_function(struct pci_dev *dev, int probe) { struct pci_dev *pdev; + int rc; if (dev->subordinate || !dev->slot || dev->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET) @@ -4086,7 +4087,11 @@ static int pci_dev_reset_slot_function(struct pci_dev *dev, int probe) if (pdev != dev && pdev->slot == dev->slot) return -ENOTTY; - return pci_reset_hotplug_slot(dev->slot->hotplug, probe); + rc = pci_reset_hotplug_slot(dev->slot->hotplug, probe); + if (!rc && !probe) + rc = pci_dev_wait(dev, "slot reset", 1000, 60000); + + return rc; } static void pci_dev_lock(struct pci_dev *dev)