Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp652300imm; Fri, 22 Jun 2018 03:01:26 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKl1NqstJI4JEaXrsPiG1x1SJxYXOWtEOS8PeGydkT+uO/jWW/ISxJvmqHtqmo2vTjh4FbK X-Received: by 2002:a17:902:5588:: with SMTP id g8-v6mr945588pli.99.1529661686590; Fri, 22 Jun 2018 03:01:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529661686; cv=none; d=google.com; s=arc-20160816; b=kTj/TFFgUX4RI0rV56V/OWumTLm7OYtaeCFw80E1oZ3KJz2J75olheQ356s5nMtBvZ Jak8mWaQnBWh9BfQqOO1h5dFpZ26hZ25BOKAyp56EkYo3EqAAnES+BjDg6IeY8ZcAwhF J7cKHUQCwNGg0vgOx+ZCvHYN+vinGpkcfo6GrBbAX8DMJMIbAQSTW4+w2zo91VlktJV0 dITcAzos7WCZ0cmScVCfLqq2xb5GCHM2PMI+lhwy1pzhV8EhDLfhCtjYDR3c0c0Mejc6 YYSzAkLEHBdkXdd6nSWaidpkpXdpsrkBpi9ets04W+h21cauFcyzowm9bXMsoCH+QKZ/ LO4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=01AygdIDxfjzgvxNZ6CQVPf5SsMquvREuprs+HvHUyA=; b=liW7x/+UR8V0tJqfmxvyt+9+eG8ai/KGb7Qs/dMvmJdbi7i+LCpCuKmglkxxbY8jP1 Kx3kzhC4237UKA/cyf+1h2fBy2UOOfnwxPLYHgSB6ZewH6HDNp7XCFNnGYAauxn4h5JH rxR/wwDgwBcgxRZgnQpU1D8bcVq9Y85HMnGB+hQWObsuYHiKRNKs7x5lY3RW41Rt6Pcz 8m59CLztwpK5LC/hUfg5rFMTLzM+G9cqSIV317th4otZiJ2NhAQX3ZeMfteddMImISCy kWY/Q8bak84PR0nZoVo4aaQ01H6zgifLv5kI3DRBeqx2vwQFkm7WYV8ikdj0QKEnimN4 uLnw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f59-v6si7115346plf.500.2018.06.22.03.01.12; Fri, 22 Jun 2018 03:01:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754337AbeFVJ67 (ORCPT + 99 others); Fri, 22 Jun 2018 05:58:59 -0400 Received: from wolverine01.qualcomm.com ([199.106.114.254]:37799 "EHLO wolverine01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752029AbeFVJ6V (ORCPT ); Fri, 22 Jun 2018 05:58:21 -0400 X-IronPort-AV: E=Sophos;i="5.51,256,1526367600"; d="scan'208";a="346278395" Received: from unknown (HELO ironmsg-SD-alpha.qualcomm.com) ([10.53.140.30]) by wolverine01.qualcomm.com with ESMTP; 22 Jun 2018 02:58:20 -0700 X-IronPort-AV: E=McAfee;i="5900,7806,8931"; a="222664697" Received: from westreach.qualcomm.com ([10.228.196.125]) by ironmsg-SD-alpha.qualcomm.com with ESMTP; 22 Jun 2018 02:58:18 -0700 Received: by westreach.qualcomm.com (Postfix, from userid 467151) id 129C41EE2; Fri, 22 Jun 2018 05:58:17 -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 v2 1/6] PCI/AER: Take severity mask into account while clearing error bits Date: Fri, 22 Jun 2018 05:58:09 -0400 Message-Id: <1529661494-20936-2-git-send-email-poza@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1529661494-20936-1-git-send-email-poza@codeaurora.org> References: <1529661494-20936-1-git-send-email-poza@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pci_cleanup_aer_uncorrect_error_status() is called by different slot_reset callbacks in case of ERR_NONFATAL. AER uncorrectable error status should take severity into account in order to clear the bits, so that ERR_NONFATAL path does not clear the bit which are marked with severity fatal. Signed-off-by: Oza Pawandeep diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index a2e8838..d6cb1f0 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -360,13 +360,16 @@ EXPORT_SYMBOL_GPL(pci_disable_pcie_error_reporting); int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev) { int pos; - u32 status; + u32 status, mask; pos = dev->aer_cap; if (!pos) return -EIO; + /* Clean AER Root Error Status */ 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 (status) pci_write_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS, status); @@ -1336,8 +1339,6 @@ static pci_ers_result_t aer_root_reset(struct pci_dev *dev) */ static void aer_error_resume(struct pci_dev *dev) { - int pos; - u32 status, mask; u16 reg16; /* Clean up Root device status */ @@ -1345,11 +1346,7 @@ static void aer_error_resume(struct pci_dev *dev) pcie_capability_write_word(dev, PCI_EXP_DEVSTA, reg16); /* Clean AER Root Error Status */ - 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 */ - pci_write_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS, status); + pci_cleanup_aer_uncorrect_error_status(dev); } static struct pcie_port_service_driver aerdriver = { -- 2.7.4