Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp903218imm; Wed, 18 Jul 2018 12:46:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdiSoE6jnpdryu3V8k9f8jooWALFRo91VV+71LMzEyllqRAGnKXGYk3WAOwVJy37FGVuI1L X-Received: by 2002:a62:3f44:: with SMTP id m65-v6mr3667475pfa.98.1531943205149; Wed, 18 Jul 2018 12:46:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531943205; cv=none; d=google.com; s=arc-20160816; b=tByNPHiFwK+6SHpW9GA0magD1Atz7qGzUiPkolUOQAWQsVJ3ZkLvy51rQC2Cgb0Hd/ sOGj1eXEf9Wdw9+z78gZt782e2ASAiYxDNGSephkCW/FBk+rJ8Y/b6aOHCz286MfiK6j CUAYRRdF3vtID4X2f5ojq2e8/TiC/c0syzL7sz7ixdj78avw5gP2isLJxWxuWfI5FAG0 G3GbNa11oYBRL9MUIXNQtmky2BhmuZSY3Rkcj9EiIMYOnQkfmhV90hvYlPJRAdflgnwN TnNoZqwao/wX+4GeJZ/sAWA3FyeJwm+M0GkJ2BOEZ91begFQN/D7yslycI8/ienD/9rm 0BpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature:arc-authentication-results; bh=066vbEmXdpd4BX3qDeP+RkaOoSeFALw2HWC2yB8DliA=; b=Jjl8c2BYfq0lSNn8UdCDHOmF5bh1hCKrHM7hZiysDbZuGdjeTg6ym+0xpLxJmwbIFq 39bDcJ9YzvK39TsdOZI0jEFcNpqMgJN2pka1mptesfDIrSkSe8P5mxmnTVjSZZPCqoey TcWBG+J+n7ebm/immLM+QhOhxH/SpXA35pGh5aAvDP1FQcECbx4Wgw31fxtuiUjyzO/N UVpG43kr+7TeKgUdBchLVFfu9CXG5KTbBL/0hTzYP8/WO2LEMrDNgSKzv82Agnmr6ADJ /9PAs2uYuBZ3AZYhjhBDiZLiwS4GtInQVQfDse4YPSKwhz99T5Bb3NeIvB/x7ngSsq1/ CVow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0SWrPjvf; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x190-v6si4150792pgb.158.2018.07.18.12.46.07; Wed, 18 Jul 2018 12:46:45 -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; dkim=pass header.i=@kernel.org header.s=default header.b=0SWrPjvf; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730490AbeGRUXt (ORCPT + 99 others); Wed, 18 Jul 2018 16:23:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:33630 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729642AbeGRUXt (ORCPT ); Wed, 18 Jul 2018 16:23:49 -0400 Received: from localhost (unknown [69.71.4.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 387DC20850; Wed, 18 Jul 2018 19:44:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1531943066; bh=rIkp0pxv7nNLpouOglKJUSpimXMsVW3fBEXh5OF7oBU=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=0SWrPjvf1kmwGvCkVS++kGiZSovV3y/r7hH0idCHUmhTaj9N8S3FxRLarSWlqubBh NWoWmJBlDbGkcjEg9xwSmqw97mwBmFdyZQ2VKSV1w9jGsKHNT/CjXEdPDoaF7EIHVB CvVWYdz2eEugDSgKhQ6k1/EycP84JUN3G4MIky0k= Subject: [PATCH v3 1/7] PCI/AER: Clear only ERR_FATAL status bits during fatal recovery From: Bjorn Helgaas To: Oza Pawandeep Cc: Philippe Ombredanne , Thomas Gleixner , Greg Kroah-Hartman , Kate Stewart , Dongdong Liu , Keith Busch , Wei Zhang , Sinan Kaya , Timur Tabi , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Date: Wed, 18 Jul 2018 14:44:25 -0500 Message-ID: <153194306515.191586.15135574361122079715.stgit@bhelgaas-glaptop.roam.corp.google.com> In-Reply-To: <153194245964.191586.14782253252654776509.stgit@bhelgaas-glaptop.roam.corp.google.com> References: <153194245964.191586.14782253252654776509.stgit@bhelgaas-glaptop.roam.corp.google.com> User-Agent: StGit/0.18 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bjorn Helgaas During recovery from fatal errors, we previously called pci_cleanup_aer_uncorrect_error_status(), which cleared *all* uncorrectable error status bits (both ERR_FATAL and ERR_NONFATAL). Instead, call a new pci_aer_clear_fatal_status() that clears only the ERR_FATAL bits (as indicated by the PCI_ERR_UNCOR_SEVER register). Based-on-patch-by: Oza Pawandeep Signed-off-by: Bjorn Helgaas --- drivers/pci/pci.h | 4 ++++ drivers/pci/pcie/aer.c | 17 +++++++++++++++++ drivers/pci/pcie/err.c | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index c358e7a07f3f..12fd2ac95843 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -452,4 +452,8 @@ static inline int devm_of_pci_get_host_bridge_resources(struct device *dev, } #endif +#ifdef CONFIG_PCIEAER +void pci_aer_clear_fatal_status(struct pci_dev *dev); +#endif + #endif /* DRIVERS_PCI_H */ diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index a2e88386af28..5b4a84e3d360 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -374,6 +374,23 @@ int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev) } EXPORT_SYMBOL_GPL(pci_cleanup_aer_uncorrect_error_status); +void pci_aer_clear_fatal_status(struct pci_dev *dev) +{ + int pos; + u32 status, sev; + + pos = dev->aer_cap; + if (!pos) + return; + + /* Clear status bits for ERR_FATAL errors only */ + pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS, &status); + pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_SEVER, &sev); + status &= sev; + if (status) + pci_write_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS, status); +} + int pci_cleanup_aer_error_status_regs(struct pci_dev *dev) { int pos; diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c index f7ce0cb0b0b7..0539518f9861 100644 --- a/drivers/pci/pcie/err.c +++ b/drivers/pci/pcie/err.c @@ -316,7 +316,7 @@ void pcie_do_fatal_recovery(struct pci_dev *dev, u32 service) * do error recovery on all subordinates of the bridge instead * of the bridge and clear the error status of the bridge. */ - pci_cleanup_aer_uncorrect_error_status(dev); + pci_aer_clear_fatal_status(dev); } if (result == PCI_ERS_RESULT_RECOVERED) {