From patchwork Mon Apr 9 14:41:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oza Pawandeep X-Patchwork-Id: 10331583 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 AFE4A60236 for ; Mon, 9 Apr 2018 14:43:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1CCD289B1 for ; Mon, 9 Apr 2018 14:43:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 961CD289B8; Mon, 9 Apr 2018 14:43:21 +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=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham 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 1E9CE289B1 for ; Mon, 9 Apr 2018 14:43:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752882AbeDIOnT (ORCPT ); Mon, 9 Apr 2018 10:43:19 -0400 Received: from sabertooth01.qualcomm.com ([65.197.215.72]:50652 "EHLO sabertooth01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751736AbeDIOmS (ORCPT ); Mon, 9 Apr 2018 10:42:18 -0400 X-IronPort-AV: E=Sophos;i="5.48,427,1517904000"; d="scan'208";a="125698236" Received: from unknown (HELO ironmsg01-sd.qualcomm.com) ([10.53.140.141]) by sabertooth01.qualcomm.com with ESMTP; 09 Apr 2018 07:42:17 -0700 Received: from westreach.qualcomm.com ([10.228.196.125]) by ironmsg01-sd.qualcomm.com with ESMTP; 09 Apr 2018 07:42:16 -0700 Received: by westreach.qualcomm.com (Postfix, from userid 467151) id 3BEAA1EDC; Mon, 9 Apr 2018 10:42:15 -0400 (EDT) From: Oza Pawandeep To: Bjorn Helgaas , Philippe Ombredanne , Thomas Gleixner , Greg Kroah-Hartman , Kate Stewart , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Dongdong Liu , Keith Busch , Wei Zhang , Sinan Kaya , Timur Tabi Cc: Oza Pawandeep Subject: [PATCH v13 6/6] PCI/DPC: Do not do recovery for hotplug enabled system Date: Mon, 9 Apr 2018 10:41:54 -0400 Message-Id: <1523284914-2037-7-git-send-email-poza@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523284914-2037-1-git-send-email-poza@codeaurora.org> References: <1523284914-2037-1-git-send-email-poza@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 DPC and AER should attempt recovery in the same way, except the cases where system is with hotplug enabled. Signed-off-by: Oza Pawandeep diff --git a/drivers/pci/pcie/pcie-dpc.c b/drivers/pci/pcie/pcie-dpc.c index 8e1553b..6d9a841 100644 --- a/drivers/pci/pcie/pcie-dpc.c +++ b/drivers/pci/pcie/pcie-dpc.c @@ -108,8 +108,6 @@ static void dpc_wait_link_inactive(struct dpc_dev *dpc) */ static pci_ers_result_t dpc_reset_link(struct pci_dev *pdev) { - struct pci_bus *parent = pdev->subordinate; - struct pci_dev *dev, *temp; struct dpc_dev *dpc; struct pcie_device *pciedev; struct device *devdpc; @@ -120,19 +118,6 @@ static pci_ers_result_t dpc_reset_link(struct pci_dev *pdev) dpc = get_service_data(pciedev); cap = dpc->cap_pos; - pci_lock_rescan_remove(); - list_for_each_entry_safe_reverse(dev, temp, &parent->devices, - bus_list) { - pci_dev_get(dev); - pci_dev_set_disconnected(dev, NULL); - if (pci_has_subordinate(dev)) - pci_walk_bus(dev->subordinate, - pci_dev_set_disconnected, NULL); - pci_stop_and_remove_bus_device(dev); - pci_dev_put(dev); - } - pci_unlock_rescan_remove(); - dpc_wait_link_inactive(dpc); if (dpc->rp_extensions && dpc_wait_rp_inactive(dpc)) return PCI_ERS_RESULT_DISCONNECT; @@ -152,13 +137,37 @@ static pci_ers_result_t dpc_reset_link(struct pci_dev *pdev) return PCI_ERS_RESULT_RECOVERED; } +static void dpc_reset_link_remove_dev(struct pci_dev *pdev) +{ + struct pci_bus *parent = pdev->subordinate; + struct pci_dev *dev, *temp; + + pci_lock_rescan_remove(); + list_for_each_entry_safe_reverse(dev, temp, &parent->devices, + bus_list) { + pci_dev_get(dev); + pci_dev_set_disconnected(dev, NULL); + if (pci_has_subordinate(dev)) + pci_walk_bus(dev->subordinate, + pci_dev_set_disconnected, NULL); + pci_stop_and_remove_bus_device(dev); + pci_dev_put(dev); + } + pci_unlock_rescan_remove(); + + dpc_reset_link(pdev); +} + static void dpc_work(struct work_struct *work) { struct dpc_dev *dpc = container_of(work, struct dpc_dev, work); struct pci_dev *pdev = dpc->dev->port; /* From DPC point of view error is always FATAL. */ - pcie_do_recovery(pdev, DPC_FATAL); + if (!pdev->is_hotplug_bridge) + pcie_do_recovery(pdev, DPC_FATAL); + else + dpc_reset_link_remove_dev(pdev); } static void dpc_process_rp_pio_error(struct dpc_dev *dpc) {