From patchwork Wed Dec 27 10:20:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oza Pawandeep X-Patchwork-Id: 10133569 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 89F0B6020A for ; Wed, 27 Dec 2017 10:21:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D44F2DA2A for ; Wed, 27 Dec 2017 10:21:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 716E72DBE5; Wed, 27 Dec 2017 10:21:41 +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 1E6C22DA2A for ; Wed, 27 Dec 2017 10:21:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751320AbdL0KUz (ORCPT ); Wed, 27 Dec 2017 05:20:55 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:44148 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751864AbdL0KUw (ORCPT ); Wed, 27 Dec 2017 05:20:52 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 70C7360B27; Wed, 27 Dec 2017 10:20:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1514370051; bh=l3yYbqaPaOEYUaIJU6M/8XtPErIcEGI/CTaowOlc5U0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=St/0gqkFud4kW8eu9mKyt+yIbhjPxPtaPViKxAs2oxcbCdS1kinB2kncVkrYKN/wr wzAjWS6tAOrUbXe/jtAc7n4oWCMt8IlycGYA1B/c5tfJ/Q5WQEuH49uOXRiVvEfQ+j 8RSBqTS74Mr6xYxExlrA9jiw97P0k9VNXuZ2egS8= 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 B502C60B20; Wed, 27 Dec 2017 10:20:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1514370050; bh=l3yYbqaPaOEYUaIJU6M/8XtPErIcEGI/CTaowOlc5U0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dbSVgGSau/xyZ2ypIJJQgqRIKIMDxNsgyecioUjruvXLwOw5mUly73lZjC+YrCCmW m77eHTPIv0xjVO8vMPlyVQgKYYdtcXLqfDNkNjiBMFSrVsM9jxC5y7z4e2yQcHUX1b FOgM1OC256djHbRglgrsGqlbQN4xo/MVT9yy03ak= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org B502C60B20 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 3/4] PCI/ERR: Do not do recovery if DPC service is active Date: Wed, 27 Dec 2017 15:50:21 +0530 Message-Id: <1514370022-4431-4-git-send-email-poza@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1514370022-4431-1-git-send-email-poza@codeaurora.org> References: <1514370022-4431-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 8bac584..1f01e76 100644 --- a/drivers/pci/pcie/pcie-err.c +++ b/drivers/pci/pcie/pcie-err.c @@ -267,6 +267,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 @@ -280,9 +296,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;