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: 838098 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=codeaurora.org header.i=@codeaurora.org header.b="IRywdD93"; dkim=pass (1024-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="k8mUpAw4"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3ycBv30CZ5z9sDB for ; Wed, 15 Nov 2017 15:57:19 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754867AbdKOE5R (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= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED, T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 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-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org 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