From patchwork Tue Sep 30 06:09:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Zhen-Hua" X-Patchwork-Id: 5000641 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0F4FE9F3D1 for ; Tue, 30 Sep 2014 06:10:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1DF8D2016C for ; Tue, 30 Sep 2014 06:10:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 30A9D2015E for ; Tue, 30 Sep 2014 06:10:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752223AbaI3GKa (ORCPT ); Tue, 30 Sep 2014 02:10:30 -0400 Received: from g4t3425.houston.hp.com ([15.201.208.53]:23798 "EHLO g4t3425.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751492AbaI3GKG (ORCPT ); Tue, 30 Sep 2014 02:10:06 -0400 Received: from g9t2301.houston.hp.com (g9t2301.houston.hp.com [16.216.185.78]) by g4t3425.houston.hp.com (Postfix) with ESMTP id 9BDF513E; Tue, 30 Sep 2014 06:10:05 +0000 (UTC) Received: from piepie.asiapacific.hpqcorp.net (unknown [16.187.246.188]) by g9t2301.houston.hp.com (Postfix) with ESMTP id DDE74A8; Tue, 30 Sep 2014 06:10:01 +0000 (UTC) From: "Li, Zhen-Hua" To: , Bjorn Helgaas , Cc: Jeff Kirsher , Jesse Brandeburg , Bruce Allan , Carolyn Wyborny , Don Skidmore , Greg Rose , Alex Duyck , John Ronciak , Mitch Williams , Linux NICS , , , "Li, Zhen-Hua" Subject: [PATCH 1/1] pci/quirks: fix a dmar fault for intel 82599 card Date: Tue, 30 Sep 2014 14:09:54 +0800 Message-Id: <1412057394-7186-1-git-send-email-zhen-hual@hp.com> X-Mailer: git-send-email 2.0.0-rc0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On a HP system with Intel Corporation 82599 ethernet adapter, when kernel crashed and the kdump kernel boots with intel_iommu=on, there may be some unexpected DMA requests on this adapter, which will cause DMA Remapping faults like: dmar: DRHD: handling fault status reg 102 dmar: DMAR:[DMA Read] Request device [41:00.0] fault addr fff81000 DMAR:[fault reason 01] Present bit in root entry is clear Analysis for this bug: The present bit is set in this function: static struct context_entry * device_to_context_entry( struct intel_iommu *iommu, u8 bus, u8 devfn) { ...... set_root_present(root); ...... } Calling tree: ixgbe_open ixgbe_setup_tx_resources intel_alloc_coherent __intel_map_single domain_context_mapping domain_context_mapping_one device_to_context_entry This means, the present bit in root entry will not be set until the device driver is loaded. But in the kdump kernel, some hardware device does not know the OS is the second kernel and the drivers should be loaded again, this causes there are some unexpected DMA requsts on this device when it has not been initialized, and then the DMA Remapping errors come. To fix this DMAR fault, we need to reset the bus that this device on. Reset the device itself does not work. There also was a discussion: https://lkml.org/lkml/2013/5/14/9 Signed-off-by: Li, Zhen-Hua --- drivers/pci/quirks.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 80c2d01..5198af3 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -25,6 +25,7 @@ #include #include #include /* isa_dma_bridge_buggy */ +#include #include "pci.h" /* @@ -3832,3 +3833,13 @@ void pci_dev_specific_enable_acs(struct pci_dev *dev) } } } + +#ifdef CONFIG_CRASH_DUMP +void quirk_reset_buggy_devices(struct pci_dev *dev) +{ + if (unlikely(is_kdump_kernel())) + pci_try_reset_bus(dev->bus); +} +DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_INTEL, 0x10f8, + PCI_CLASS_NETWORK_ETHERNET, 8, quirk_reset_buggy_devices); +#endif