Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp649795imm; Fri, 22 Jun 2018 02:59:15 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLoHGeZPIs9ZpNoIhojHGXaxrVqxaG0lz3R4oBDpyN4eud4QUdsSM4Fg16JNzgyuFYo0ghj X-Received: by 2002:a62:1358:: with SMTP id b85-v6mr1013022pfj.238.1529661555442; Fri, 22 Jun 2018 02:59:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529661555; cv=none; d=google.com; s=arc-20160816; b=AYbTl6t2eKD0yWc7KAXLMh1TvOkbmmMXLU96mhidOVtqXdDqnjTFSsl1+lvO5JgMvD be4A7rJxTd7A5WqYBTB4MGHqQrDHJUXmDxfp8E3s6Hi4ZslnCWytLXbqHBqUHbWE1D9g SqSvKjbMRNDpj7X9Nx7Tyhihe4aXzdEt+LUMouuePbkCo3fIeRWK8XTs2WIGtvKBxaGl 6FAMReOv2wkeW4ZGqyItqT/Ve8ZZZGkgv9M61DwlXgNJSSW0K7KlecR/vSUFD6qY17M/ 3paxQjDJ7fOQ9e3/Sf7sX7Oi2LXkXGH0AZIONbPPZSNd+J8vYZ6Kr6RHRrqQxFHTrGJ3 tRHw== 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=EOirS3Dv0/xvQMcEj7qhPlTpHrT55Y/F7MbVSRvDfx4=; b=PqugNiRr96+vSLKYOFSZOTpxks3KePpMudCWIDTaBrdivmDFHqGwV5r74pwlijElav 7KtUXPZCbqoQipBXce7aXD1TEUBgGsG4372IqqvUtzP0JXmOfUeDe9TxffbIO9oNS0fj 5XmhofSTVp7f0zRJ12GvlIWVLxsaOAZaEiSPuPgVE+W/t8wushReGjLwbfHHxpFEDs+M c9Wuf1E8dP6zHoAkg/YsOPV3NXAW5rzNeQqOOHAVQkkWOFssZpTYFLUpYM/FrRS+37B9 6e7c+18COKTvc4yh2O2U48KIORIk94XWiXcEYz+bLyaCHpK843HbqoXbq4CT4TJK2UX7 7Xmw== 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 v26-v6si5356540pge.323.2018.06.22.02.59.01; Fri, 22 Jun 2018 02:59:15 -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 S933312AbeFVJ6Z (ORCPT + 99 others); Fri, 22 Jun 2018 05:58:25 -0400 Received: from alexa-out-sd-02.qualcomm.com ([199.106.114.39]:39596 "EHLO alexa-out-sd-02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751369AbeFVJ6V (ORCPT ); Fri, 22 Jun 2018 05:58:21 -0400 X-IronPort-AV: E=Sophos;i="5.51,256,1526367600"; d="scan'208";a="5079194" Received: from unknown (HELO ironmsg02-sd.qualcomm.com) ([10.53.140.142]) by alexa-out-sd-02.qualcomm.com with ESMTP; 22 Jun 2018 02:58:20 -0700 Received: from westreach.qualcomm.com ([10.228.196.125]) by ironmsg02-sd.qualcomm.com with ESMTP; 22 Jun 2018 02:58:18 -0700 Received: by westreach.qualcomm.com (Postfix, from userid 467151) id 317C41F30; Fri, 22 Jun 2018 05:58:18 -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 4/6] PCI/AER: Clear device error status bits during ERR_FATAL and ERR_NONFATAL Date: Fri, 22 Jun 2018 05:58:12 -0400 Message-Id: <1529661494-20936-5-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 In both ERR_FATAL and ERR_NONFATA cases the device error status bits needs to be cleared. Signed-off-by: Oza Pawandeep diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index e9c115d..d2d6868 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -357,6 +357,17 @@ int pci_disable_pcie_error_reporting(struct pci_dev *dev) } EXPORT_SYMBOL_GPL(pci_disable_pcie_error_reporting); +int pci_cleanup_aer_error_device_status(struct pci_dev *dev) +{ + u16 reg16; + + /* Clean up Root device status */ + pcie_capability_read_word(dev, PCI_EXP_DEVSTA, ®16); + pcie_capability_write_word(dev, PCI_EXP_DEVSTA, reg16); + + return 0; +} + int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev) { int pos; @@ -1344,11 +1355,8 @@ static pci_ers_result_t aer_root_reset(struct pci_dev *dev) */ static void aer_error_resume(struct pci_dev *dev) { - u16 reg16; - /* Clean up Root device status */ - pcie_capability_read_word(dev, PCI_EXP_DEVSTA, ®16); - pcie_capability_write_word(dev, PCI_EXP_DEVSTA, reg16); + pci_cleanup_aer_error_device_status(dev); /* Clean AER Root Error Status */ pci_cleanup_aer_uncorrect_error_status(dev); diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c index 404bb69..410c35c 100644 --- a/drivers/pci/pcie/err.c +++ b/drivers/pci/pcie/err.c @@ -252,6 +252,7 @@ static pci_ers_result_t broadcast_error_message(struct pci_dev *dev, dev->error_state = state; pci_walk_bus(dev->subordinate, cb, &result_data); if (cb == report_resume) { + pci_cleanup_aer_error_device_status(dev); pci_cleanup_aer_uncorrect_error_status(dev); dev->error_state = pci_channel_io_normal; } @@ -312,6 +313,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_error_device_status(dev); pci_cleanup_aer_uncorrect_error_status(dev); } diff --git a/include/linux/aer.h b/include/linux/aer.h index 514bffa..165a147 100644 --- a/include/linux/aer.h +++ b/include/linux/aer.h @@ -44,6 +44,7 @@ struct aer_capability_regs { /* PCIe port driver needs this function to enable AER */ int pci_enable_pcie_error_reporting(struct pci_dev *dev); int pci_disable_pcie_error_reporting(struct pci_dev *dev); +int pci_cleanup_aer_error_device_status(struct pci_dev *dev); int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev); int pci_cleanup_aer_error_status_regs(struct pci_dev *dev); #else @@ -55,6 +56,10 @@ static inline int pci_disable_pcie_error_reporting(struct pci_dev *dev) { return -EINVAL; } +static inline int pci_cleanup_aer_error_device_status(struct pci_dev *dev) +{ + return -EINVAL; +} static inline int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev) { return -EINVAL; -- 2.7.4