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: 10351525 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 6084F60365 for ; Thu, 19 Apr 2018 19:57:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D46E284E4 for ; Thu, 19 Apr 2018 19:57:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F81828501; Thu, 19 Apr 2018 19:57:40 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A03AD284E4 for ; Thu, 19 Apr 2018 19:57:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OF7CzOwXiUf53kVrDzVZ3L1eJ7pQko6EJ0OuAoTW1nQ=; b=t+MIJqU/N/Vcta nv+c/ACOz6L9dqpGaHwix3JzNiBXBw3YOKUJT8q2cpAPbS3IUrnaOe8pDX/BIaL1jaayD4okUAR4M e8Znymn+sTdOcJywhqVFlmTiVAqmiNadcph5wcsarGbB4SUEYQF4pSaVVgLh0aya2GZDmA8qAmRSt /CnwfzWkNzc/86fvwDebF834jZIyGxjgkvlX3BFBc/WKXWnqxwxGdbUI00Av8P82dLD/VHcM3XQl9 MEFLAo7ETgBcnvQ2FpKDCZs42FKeOYwm5r38V7CioE/xfPbq4WmLCWnrGs/rkuK4UUvHLSdf7UMcu Dx0m1+tX7wZg0rwBQHqA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f9FgN-0005T6-AY; Thu, 19 Apr 2018 19:57:27 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f9Ffc-000594-Kq for linux-arm-kernel@lists.infradead.org; Thu, 19 Apr 2018 19:56:42 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id A1BEC60F74; 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180419_125640_748550_F71C021B X-CRM114-Status: GOOD ( 14.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Keith Busch , Tyler Baicar , "Juan J. Alvarez" , Gabriele Paoloni , Frederick Lawler , linux-arm-msm@vger.kernel.org, Russell Currey , open list , Sinan Kaya , "Bryant G. Ly" , Greg Kroah-Hartman , Bjorn Helgaas , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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; }