From patchwork Thu Jun 7 06:00:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oza Pawandeep X-Patchwork-Id: 10451185 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 3C3A960233 for ; Thu, 7 Jun 2018 06:01:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2EB9229C4D for ; Thu, 7 Jun 2018 06:01:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 23B2729C57; Thu, 7 Jun 2018 06:01:37 +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=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 D5E4429C4D for ; Thu, 7 Jun 2018 06:01:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753110AbeFGGB2 (ORCPT ); Thu, 7 Jun 2018 02:01:28 -0400 Received: from alexa-out-sd-02.qualcomm.com ([199.106.114.39]:20187 "EHLO alexa-out-sd-02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752561AbeFGGAj (ORCPT ); Thu, 7 Jun 2018 02:00:39 -0400 X-IronPort-AV: E=Sophos;i="5.49,486,1520924400"; d="scan'208";a="4326793" Received: from unknown (HELO ironmsg02-sd.qualcomm.com) ([10.53.140.142]) by alexa-out-sd-02.qualcomm.com with ESMTP; 06 Jun 2018 23:00:38 -0700 Received: from westreach.qualcomm.com ([10.228.196.125]) by ironmsg02-sd.qualcomm.com with ESMTP; 06 Jun 2018 23:00:36 -0700 Received: by westreach.qualcomm.com (Postfix, from userid 467151) id CDC2E1F06; Thu, 7 Jun 2018 02:00:35 -0400 (EDT) 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 , Keith Busch , Wei Zhang , Sinan Kaya , Timur Tabi Cc: Oza Pawandeep Subject: [PATCH NEXT 2/6] PCI/AER: Clear uncorrectable fatal error status bits Date: Thu, 7 Jun 2018 02:00:30 -0400 Message-Id: <1528351234-26914-2-git-send-email-poza@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528351234-26914-1-git-send-email-poza@codeaurora.org> References: <1528351234-26914-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 During ERR_FATAL handling, AER calls pci_cleanup_aer_uncorrect_error_status which should handle pci_channel_io_frozen case in order to determine if it has to clear fatal bits or nonfatal bits. Signed-off-by: Oza Pawandeep diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c index 309f3f5..6745e37 100644 --- a/drivers/pci/pcie/aer/aerdrv_core.c +++ b/drivers/pci/pcie/aer/aerdrv_core.c @@ -60,7 +60,12 @@ int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev) pos = dev->aer_cap; pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS, &status); pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_SEVER, &mask); - status &= ~mask; /* Clear corresponding nonfatal bits */ + + if (dev->error_state == pci_channel_io_normal) + status &= ~mask; /* Clear corresponding nonfatal bits */ + else + status &= mask; /* Clear corresponding fatal bits */ + if (status) pci_write_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS, status); diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c index f7ce0cb..00d2875 100644 --- a/drivers/pci/pcie/err.c +++ b/drivers/pci/pcie/err.c @@ -288,6 +288,7 @@ void pcie_do_fatal_recovery(struct pci_dev *dev, u32 service) struct pci_dev *pdev, *temp; pci_ers_result_t result; + dev->error_state = pci_channel_io_frozen; if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) udev = dev; else @@ -323,6 +324,7 @@ void pcie_do_fatal_recovery(struct pci_dev *dev, u32 service) if (pcie_wait_for_link(udev, true)) pci_rescan_bus(udev->bus); pci_info(dev, "Device recovery from fatal error successful\n"); + dev->error_state = pci_channel_io_normal; } else { pci_uevent_ers(dev, PCI_ERS_RESULT_DISCONNECT); pci_info(dev, "Device recovery from fatal error failed\n");