From patchwork Fri Dec 29 07:24:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oza Pawandeep X-Patchwork-Id: 10136135 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 68DE5600C5 for ; Fri, 29 Dec 2017 07:25:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A97C2CBD8 for ; Fri, 29 Dec 2017 07:25:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4E52B2CC01; Fri, 29 Dec 2017 07:25:24 +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 D7C062CBD8 for ; Fri, 29 Dec 2017 07:25:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755184AbdL2HZL (ORCPT ); Fri, 29 Dec 2017 02:25:11 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:50186 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932140AbdL2HYp (ORCPT ); Fri, 29 Dec 2017 02:24:45 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 785D9607DC; Fri, 29 Dec 2017 07:24:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1514532285; bh=IHy9u4WU22UW2iv6Cat11ezxyeaaQOxdQuA76SmVipc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RFDEjNyi1gHlnyceiPInQQFobygd5igsjFWsW/kTgglmDyHSR5Yjn1VxV6UzzVxpz wyCVSms4HRHRCSOgzSfWMVT2yVeqzU0PGSTP3Z8NICmtR7/bsTbr1Gdr7TVEHHotIP F5yBHvdzoVmEIcNZCUp0E+9DoZQP7fdb+6XPnIn8= Received: from blr-ubuntu-poza.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.18.19]) (using TLSv1.1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: poza@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id BDA9D60B69; Fri, 29 Dec 2017 07:24:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1514532284; bh=IHy9u4WU22UW2iv6Cat11ezxyeaaQOxdQuA76SmVipc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i0omOJ31U4qhcK/x34NoVlnsKraOwfoNqungiFlOX+tCkRjFEGu78tagTnnDrvpTN klZt+etI/evINHwrz8OU4qVxB0Qsx4t64ScRPeL8cF90MPRZKR81mCGaP2RM5qpyXp irPgt1mwrHobpYu5q5uq/E9+Z/ooEs2q6CZs5nwI= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org BDA9D60B69 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=poza@codeaurora.org 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 , Gabriele Paoloni , Keith Busch , Wei Zhang , Sinan Kaya , Timur Tabi Cc: Oza Pawandeep Subject: [PATCH v2 3/4] PCI/ERR: Do not do recovery if DPC service is active Date: Fri, 29 Dec 2017 12:54:18 +0530 Message-Id: <1514532259-19383-4-git-send-email-poza@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1514532259-19383-1-git-send-email-poza@codeaurora.org> References: <1514532259-19383-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 If AER attempts to do recovery for any device, and DPC is active on any upstream port, AER should not do recovery, since it will be handled by DPC Change-Id: Ida507ce9145f420e35302db34e967f1b421e15c9 Signed-off-by: Oza Pawandeep diff --git a/drivers/pci/pcie/pcie-err.c b/drivers/pci/pcie/pcie-err.c index 858c94c..1991cc8 100644 --- a/drivers/pci/pcie/pcie-err.c +++ b/drivers/pci/pcie/pcie-err.c @@ -274,6 +274,22 @@ pci_ers_result_t pci_broadcast_error_message(struct pci_dev *dev, return result_data.result; } +/* + * pcie_port_upstream_bridge - returns immediate upstream bridge. + * dev: pcie device + */ +static struct pci_dev *pcie_port_upstream_bridge(struct pci_dev *dev) +{ + struct pci_dev *parent; + + parent = pci_upstream_bridge(dev); + + if (parent && pci_is_pcie(parent)) + return parent; + + return NULL; +} + /** * pci_do_recovery - handle nonfatal/fatal error recovery process * @dev: pointer to a pci_dev data structure of agent detecting an error @@ -287,9 +303,29 @@ void pci_do_recovery(struct pci_dev *dev, int severity) { pci_ers_result_t status, result = PCI_ERS_RESULT_RECOVERED; enum pci_channel_state state; + struct pcie_port_service_driver *driver; + struct pci_dev *pdev = dev; mutex_lock(&pci_err_recovery_lock); + if (severity != PCI_ERR_DPC_FATAL) { + /* + * DPC service could be running in RP + * or any upstream switch. + */ + do { + driver = pci_find_dpc_service(pdev); + if (driver) { + dev_printk(KERN_NOTICE, &dev->dev, + "AER: Recovery to be done by DPC %s\n", + pci_name(dev)); + mutex_unlock(&pci_err_recovery_lock); + return; + } + pdev = pcie_port_upstream_bridge(dev); + } while (pdev); + } + if ((severity == PCI_ERR_AER_FATAL) || (severity == PCI_ERR_DPC_FATAL)) state = pci_channel_io_frozen;