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: 10058861 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 7C7C6604D4 for ; Wed, 15 Nov 2017 05:03:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F27529DBA for ; Wed, 15 Nov 2017 05:03:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 63F0429DBE; Wed, 15 Nov 2017 05:03:16 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 EB14229DBA for ; Wed, 15 Nov 2017 05:03:15 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=bubAHkCXz6niieX+FYNpS01rBVtCX99ZQD2sVB+2zco=; b=MCyQIa1H1aXgrCjZ/URj64S8Eh kWsOAHq1QEyTCyYig64vvAhUvcmJ738S3GGwh8qVuCIA9e7XfW4P7THToIMo/ixO+VqmK2jK7KL2D flYldep/d5d9YNEjmFgC4UkvA/hf8fUEiTYnQ0sSQ+3VZbgYuMxoMN1fqyDT6jdItYdNxbqzUZO6V q/ZNp3DDK4V7d3BAWC08YFzB/7t7YzqOWTT6OClSn0Ptzrm/KFPfxKFt3R665LajegikkrsagY/eY 1CmcxMiccWYz6wrvhRN2YZgFmugUSFcDLFZedhZ9vJ98FrodtNiEb34vC1dK/m9kbSiKOqW8XoPbw xDzYhoxg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eEpqy-0004kh-1a; Wed, 15 Nov 2017 05:03:12 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eEplV-0000AI-SE for linux-arm-kernel@lists.infradead.org; Wed, 15 Nov 2017 04:57:36 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 340C860850; 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171114_205734_047739_2ADF12AE X-CRM114-Status: GOOD ( 14.71 ) 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: Oza Pawandeep , Gabriele Paoloni , Greg Kroah-Hartman , Dongdong Liu , linux-arm-msm@vger.kernel.org, Bjorn Helgaas , Thomas Gleixner , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 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 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