From patchwork Wed Nov 15 04:56:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oza Pawandeep X-Patchwork-Id: 10058851 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 31C9F6023A for ; Wed, 15 Nov 2017 04:57:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2371629D34 for ; Wed, 15 Nov 2017 04:57:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1626E29DB7; Wed, 15 Nov 2017 04:57:19 +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=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 AD5B629D34 for ; Wed, 15 Nov 2017 04:57:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754777AbdKOE5R (ORCPT ); Tue, 14 Nov 2017 23:57:17 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:39198 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752233AbdKOE5Q (ORCPT ); Tue, 14 Nov 2017 23:57:16 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 833136081A; Wed, 15 Nov 2017 04:57:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1510721835; bh=2tbS7LoVaZEoRsf302gMnOkewWOyHhYMVvd4kYAPj9k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IRywdD93AYKzZUJkcGY7humQeNWaN9L0mDWKFkuR6Dw5ArQF1exbwsUER+4BR4hyO HCHaTaD3cgfT2d2rNoh3YGy0APKyKcxfwB2r1XeqqZF+s9/dXH+8VbZLBKFWn6qhuI O9he+qPWKHZ9VsLi2+AeGhRNEBZJhfpngcXqm8Po= 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 1E8BC6086D; Wed, 15 Nov 2017 04:57:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1510721832; bh=2tbS7LoVaZEoRsf302gMnOkewWOyHhYMVvd4kYAPj9k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k8mUpAw4TBkaezzrr/0nw2K67eBOZBtEjdFfhGj4xpFsmtdJsuchUOMExHRmWMans HeKV/ZnAHnjONRxOrIEmSOOxwzf/qCb2Z1k4quPILq5w4iEi5NPsyPh8oGC92W4gc4 36G6LLhJiBDqeMOiBncCzFNkClB1wU/O22YVgCDA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 1E8BC6086D 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: linux-pci@vger.kernel.org, okaya@codeaurora.org, timur@codeaurora.org Cc: Bjorn Helgaas , Dongdong Liu , Gabriele Paoloni , Thomas Gleixner , Greg Kroah-Hartman , linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Oza Pawandeep Subject: [PATCH v2 4/4] PCI/AER: Dont do recovery when DPC is enabled Date: Wed, 15 Nov 2017 10:26:48 +0530 Message-Id: <1510721808-27164-5-git-send-email-poza@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1510721808-27164-1-git-send-email-poza@codeaurora.org> References: <1510721808-27164-1-git-send-email-poza@codeaurora.org> 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 PCI Express Base Specification, Rev. 4.0 Version 0.9 6.2.10: Downstream Port Containment (DPC) DPC is an optional normative feature of a Downstream Port. DPC halts PCI Express traffic below a Downstream Port after an unmasked uncorrectable error is detected at or below the Port, avoiding the potential spread of any data corruption, and permitting error recovery if supported by software Triggering DPC disables its Link by directing the LTSSM to the Disabled state. Once the LTSSM reaches the Disabled state, it remains in that state until the DPC Trigger Status bit is Cleared So when DPC service is active and registered to port driver, AER should not attempt to recover, since DPC will be removing downstream devices, and do the recovery. Signed-off-by: Oza Pawandeep diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c index 7448052..a9108ea 100644 --- a/drivers/pci/pcie/aer/aerdrv_core.c +++ b/drivers/pci/pcie/aer/aerdrv_core.c @@ -482,6 +482,27 @@ static pci_ers_result_t reset_link(struct pci_dev *dev) } /** + * pcie_port_query_uptream_service - query upstream service + * @dev: pointer to a pci_dev data structure of agent detecting an error + * @service: service to be queried + * + * Invoked to know the status of the service for pci device. + */ +static bool pcie_port_query_uptream_service(struct pci_dev *dev, u32 service) +{ + struct pci_dev *upstream_dev = dev; + + do { + if (pcie_port_query_service(upstream_dev, service)) + return true; + upstream_dev = pcie_port_upstream_bridge(upstream_dev); + } while (upstream_dev); + + return false; +} + + +/** * do_recovery - handle nonfatal/fatal error recovery process * @dev: pointer to a pci_dev data structure of agent detecting an error * @severity: error severity type @@ -495,6 +516,18 @@ static void do_recovery(struct pci_dev *dev, int severity) pci_ers_result_t status, result = PCI_ERS_RESULT_RECOVERED; enum pci_channel_state state; + /* + * If DPC is enabled, there is no need to attempt recovery. + * Since DPC disables its Link by directing the LTSSM to + * the Disabled state. + * DPC driver will take care of the recovery, there is no need + * for AER driver to race. + */ + if (pcie_port_query_uptream_service(dev, PCIE_PORT_SERVICE_DPC)) { + dev_info(&dev->dev, "AER: Device recovery to be done by DPC\n"); + return; + } + if (severity == AER_FATAL) state = pci_channel_io_frozen; else