From patchwork Wed Apr 19 00:31:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 9686739 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 06B9D6037E for ; Wed, 19 Apr 2017 00:32:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBFC72621B for ; Wed, 19 Apr 2017 00:32:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF552283E2; Wed, 19 Apr 2017 00:32:50 +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=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 9F00C2621B for ; Wed, 19 Apr 2017 00:32:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757817AbdDSAcf (ORCPT ); Tue, 18 Apr 2017 20:32:35 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:18564 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758585AbdDSAcd (ORCPT ); Tue, 18 Apr 2017 20:32:33 -0400 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v3J0WRie000387 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 19 Apr 2017 00:32:28 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.13.8/8.14.4) with ESMTP id v3J0WRU1000349 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 19 Apr 2017 00:32:27 GMT Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v3J0WQ6o015067; Wed, 19 Apr 2017 00:32:26 GMT Received: from dhcp-santaclara17-1fl-west-10-132-126-118.usdhcp.oraclecorp.com.com (/10.132.126.118) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 18 Apr 2017 17:32:26 -0700 From: Yinghai Lu To: Bjorn Helgaas Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Yinghai Lu Subject: [PATCH v2] PCI: disable SERR for kdump kernel Date: Tue, 18 Apr 2017 17:31:30 -0700 Message-Id: <20170419003130.5302-1-yinghai@kernel.org> X-Mailer: git-send-email 2.9.3 X-Source-IP: aserv0021.oracle.com [141.146.126.233] 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 Found one system with infiniband with SRIOV enabled, kdump kernel SRIOV BAR probing trigger one pci fatal error. That assert error pin, and host get reset by BMC. We can just ignore that error to let kernel go on and kdump to create vmcore. -v2: add debug print out Signed-off-by: Yinghai Lu --- drivers/pci/probe.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) Index: linux-2.6/drivers/pci/probe.c =================================================================== --- linux-2.6.orig/drivers/pci/probe.c +++ linux-2.6/drivers/pci/probe.c @@ -17,6 +17,8 @@ #include #include #include +#include + #include "pci.h" #define CARDBUS_LATENCY_TIMER 176 /* secondary latency timer */ @@ -1515,6 +1517,24 @@ static void pci_msi_setup_pci_dev(struct pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_ENABLE, 0); } +static void pci_disable_serr(struct pci_dev *dev) +{ + u16 pci_cmd, pci_bctl; + + pci_read_config_word(dev, PCI_COMMAND, &pci_cmd); + pci_cmd &= ~PCI_COMMAND_SERR; + pci_write_config_word(dev, PCI_COMMAND, pci_cmd); + dev_printk(KERN_DEBUG, &dev->dev, "SERR cleared\n"); + + /* Program bridge control value */ + if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { + pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &pci_bctl); + pci_bctl &= ~PCI_BRIDGE_CTL_SERR; + pci_write_config_word(dev, PCI_BRIDGE_CONTROL, pci_bctl); + dev_printk(KERN_DEBUG, &dev->dev, "BRIDGE SERR cleared\n"); + } +} + /** * pci_setup_device - fill in class and map information of a device * @dev: the device structure to fill @@ -1572,6 +1592,9 @@ int pci_setup_device(struct pci_dev *dev /* device class may be changed after fixup */ class = dev->class >> 8; + if (is_kdump_kernel()) + pci_disable_serr(dev); + if (dev->non_compliant_bars) { pci_read_config_word(dev, PCI_COMMAND, &cmd); if (cmd & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {