From patchwork Thu Apr 19 19:56:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 10351519 X-Patchwork-Delegate: agross@codeaurora.org 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 D318260365 for ; Thu, 19 Apr 2018 19:56:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C26EF284C9 for ; Thu, 19 Apr 2018 19:56:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6D6C28517; Thu, 19 Apr 2018 19:56:57 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 5C061284C9 for ; Thu, 19 Apr 2018 19:56:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753411AbeDST4k (ORCPT ); Thu, 19 Apr 2018 15:56:40 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:40320 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751876AbeDST4i (ORCPT ); Thu, 19 Apr 2018 15:56:38 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id D698260F93; Thu, 19 Apr 2018 19:56:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524167797; bh=UK9IgQMTQXUQ6aXEyagwVLmTaXx12ZggO1+jNxEpLic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n1AmC4ug+ekvRFivVjAkIy4BQij1cvgRRw531MiI8Slw1r2loR++jYMY9yllYEc8n rsTYyM4faYkwv8rih+1DWSD9pAzulkE+jCw+ZLWevccFCoxatrhyA3f5FugTHQanFp zLuvjazPjvtjGT+Qx/lgDWqEn6Hnaac/ArGPCD3g= 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 31EAE60863; Thu, 19 Apr 2018 19:56:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524167796; bh=UK9IgQMTQXUQ6aXEyagwVLmTaXx12ZggO1+jNxEpLic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RrXG3UxtN6T71AUDrZI58NL9F/NIfLxZYADmhGHSNAlGg9BVOSZ7v9A+M11sPNm7A JoeFoSXchGT5SOm4RBNGPeB6v3D1GdEpwR4vJCP6Fn8lwnLvKObSi8c5bW4WrYkkY6 VeMqh+QqZKpmit23H0l3Rb/S2Eu1hjFg50Af/g0c= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 31EAE60863 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, sulrich@codeaurora.org, timur@codeaurora.org Cc: linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sinan Kaya , Bjorn Helgaas , Frederick Lawler , Greg Kroah-Hartman , "Juan J. Alvarez" , Russell Currey , Gabriele Paoloni , Keith Busch , Tyler Baicar , "Bryant G. Ly" , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 2/2] PCI/AER: Try slot reset before secondary bus reset Date: Thu, 19 Apr 2018 15:56:24 -0400 Message-Id: <1524167784-5911-2-git-send-email-okaya@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1524167784-5911-1-git-send-email-okaya@codeaurora.org> References: <1524167784-5911-1-git-send-email-okaya@codeaurora.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The endpoint observing AER_FATAL error might be connected to a PCI hotplug slot. Performing secondary bus reset on a hotplug slot causes PCI link up/down interrupts. Hotplug driver removes the device from system when a link down interrupt is observed and performs re-enumeration when link up interrupt is observed. This conflicts with what this code is trying to do. Try secondary bus reset only if pci_reset_slot() fails/unsupported. Signed-off-by: Sinan Kaya --- drivers/pci/pcie/aer/aerdrv.c | 3 ++- drivers/pci/pcie/aer/aerdrv_core.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pcie/aer/aerdrv.c b/drivers/pci/pcie/aer/aerdrv.c index 779b387..4eaa524 100644 --- a/drivers/pci/pcie/aer/aerdrv.c +++ b/drivers/pci/pcie/aer/aerdrv.c @@ -318,7 +318,8 @@ static pci_ers_result_t aer_root_reset(struct pci_dev *dev) reg32 &= ~ROOT_PORT_INTR_ON_MESG_MASK; pci_write_config_dword(dev, pos + PCI_ERR_ROOT_COMMAND, reg32); - pci_reset_bridge_secondary_bus(dev); + if (pci_reset_slot(dev->slot)) + pci_reset_bridge_secondary_bus(dev); pci_printk(KERN_DEBUG, dev, "Root Port link has been reset\n"); /* Clear Root Error Status */ diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c index 0ea5acc..a915b0e6 100644 --- a/drivers/pci/pcie/aer/aerdrv_core.c +++ b/drivers/pci/pcie/aer/aerdrv_core.c @@ -407,7 +407,8 @@ static pci_ers_result_t broadcast_error_message(struct pci_dev *dev, */ static pci_ers_result_t default_reset_link(struct pci_dev *dev) { - pci_reset_bridge_secondary_bus(dev); + if (pci_reset_slot(dev->slot)) + pci_reset_bridge_secondary_bus(dev); pci_printk(KERN_DEBUG, dev, "downstream link has been reset\n"); return PCI_ERS_RESULT_RECOVERED; }