From patchwork Thu Aug 25 23:26:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Derrick X-Patchwork-Id: 662971 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3sL0mY2XBTz9sBg for ; Fri, 26 Aug 2016 09:31:09 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757311AbcHYXbD (ORCPT ); Thu, 25 Aug 2016 19:31:03 -0400 Received: from mga11.intel.com ([192.55.52.93]:60245 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756471AbcHYXbA (ORCPT ); Thu, 25 Aug 2016 19:31:00 -0400 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP; 25 Aug 2016 16:27:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,578,1464678000"; d="scan'208";a="161060665" Received: from nsgse-neoncity01.lm.intel.com (HELO nsgse-neoncity01.localdomain) ([10.232.118.5]) by fmsmga004.fm.intel.com with ESMTP; 25 Aug 2016 16:27:55 -0700 From: Jon Derrick To: helgaas@kernel.org Cc: Jon Derrick , keith.busch@intel.com, linux-pci@vger.kernel.org Subject: [PATCH 1/2] pci/aer: Add bus flag to skip source id matching Date: Thu, 25 Aug 2016 17:26:10 -0600 Message-Id: <1472167571-11123-1-git-send-email-jonathan.derrick@intel.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Allow root port buses to choose to skip source id matching when finding the faulting device. Certain root port devices may return an incorrect source id and recommend to scan child device registers for aer notifications. Signed-off-by: Jon Derrick --- drivers/pci/pcie/aer/aerdrv_core.c | 7 +++++-- include/linux/pci.h | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c index 521e39c..3a0d839 100644 --- a/drivers/pci/pcie/aer/aerdrv_core.c +++ b/drivers/pci/pcie/aer/aerdrv_core.c @@ -132,7 +132,9 @@ static bool is_error_source(struct pci_dev *dev, struct aer_err_info *e_info) * When bus id is equal to 0, it might be a bad id * reported by root port. */ - if (!nosourceid && (PCI_BUS_NUM(e_info->id) != 0)) { + if (!nosourceid && + (PCI_BUS_NUM(e_info->id) != 0) && + !(dev->bus->bus_flags & PCI_BUS_FLAGS_NO_AERSID)) { /* Device ID match? */ if (e_info->id == ((dev->bus->number << 8) | dev->devfn)) return true; @@ -147,7 +149,8 @@ static bool is_error_source(struct pci_dev *dev, struct aer_err_info *e_info) * 1) nosourceid==y; * 2) bus id is equal to 0. Some ports might lose the bus * id of error source id; - * 3) There are multiple errors and prior id comparing fails; + * 3) bus flag PCI_BUS_FLAGS_NO_AERSID is set + * 4) There are multiple errors and prior id comparing fails; * We check AER status registers to find possible reporter. */ if (atomic_read(&dev->enable_cnt) == 0) diff --git a/include/linux/pci.h b/include/linux/pci.h index b7d3aa2..5c08137 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -183,8 +183,9 @@ enum pci_irq_reroute_variant { typedef unsigned short __bitwise pci_bus_flags_t; enum pci_bus_flags { - PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t) 1, - PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2, + PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t) 1, + PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2, + PCI_BUS_FLAGS_NO_AERSID = (__force pci_bus_flags_t) 4, }; /* These values come from the PCI Express Spec */