From patchwork Wed May 22 06:38:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 2600281 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id ACF1F40077 for ; Wed, 22 May 2013 06:40:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755488Ab3EVGjM (ORCPT ); Wed, 22 May 2013 02:39:12 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:28390 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755442Ab3EVGjK (ORCPT ); Wed, 22 May 2013 02:39:10 -0400 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r4M6d2kT018430 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 22 May 2013 06:39:03 GMT Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r4M6d3Qu020513 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Wed, 22 May 2013 06:39:04 GMT Received: from abhmt105.oracle.com (abhmt105.oracle.com [141.146.116.57]) by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r4M6d3dA020509; Wed, 22 May 2013 06:39:03 GMT Received: from linux-siqj.site (/75.36.251.200) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 21 May 2013 23:39:03 -0700 From: Yinghai Lu To: Bjorn Helgaas , Benjamin Herrenschmidt , Gavin Shan Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Yinghai Lu Subject: [PATCH v4 6/8] PCI: Skip IORESOURCE_MMIO allocation for root bus without MMIO range Date: Tue, 21 May 2013 23:38:46 -0700 Message-Id: <1369204728-11165-7-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1369204728-11165-1-git-send-email-yinghai@kernel.org> References: <1369204728-11165-1-git-send-email-yinghai@kernel.org> X-Source-IP: acsinet21.oracle.com [141.146.126.237] Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org For x86 8 sockets or 32 sockets system that will have one root bus per socket, They may have some root buses do not have mmio non-pref range. We should not fall into retry in this case, as root bus does not mmio non-pref range. We check if the root bus has mmio-nonpref range, and set bus_res_type_mask, and pass it to assign_resources and don't add mmio-nonpref res to failed list for root bus that does not have mmio-nonpref range. So even BIOS set wrong value to pci devices and bridges will still get cleared. Signed-off-by: Yinghai Lu --- drivers/pci/setup-bus.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux-2.6/drivers/pci/setup-bus.c =================================================================== --- linux-2.6.orig/drivers/pci/setup-bus.c +++ linux-2.6/drivers/pci/setup-bus.c @@ -299,9 +299,17 @@ static void assign_requested_resources_s bool is_ioport_res_without_bus_support = (!(bus_res_type_mask & IORESOURCE_IO)) && (res->flags & IORESOURCE_IO); + /* + * if the failed res is mmio, but bus does + * not have io port support, don't add it + */ + bool is_mmio_nonpref_res_without_bus_support = + (!(bus_res_type_mask & IORESOURCE_MEM)) && + ((res->flags & (IORESOURCE_MEM | IORESOURCE_PREFETCH)) == IORESOURCE_MEM); if (!is_rom_res_not_enabled && - !is_ioport_res_without_bus_support) + !is_ioport_res_without_bus_support && + !is_mmio_nonpref_res_without_bus_support) add_to_list(fail_head, dev_res->dev, res, 0 /* dont care */, @@ -1416,12 +1424,24 @@ static unsigned long pci_bus_res_type_ma int i; struct resource *r; unsigned long mask = 0; - unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM | - IORESOURCE_PREFETCH; - pci_bus_for_each_resource(bus, r, i) - if (r) - mask |= r->flags & type_mask; + pci_bus_for_each_resource(bus, r, i) { + if (!r) + continue; + + if (r->flags & IORESOURCE_IO) { + mask |= IORESOURCE_IO; + continue; + } + if (r->flags & IORESOURCE_PREFETCH) { + mask |= IORESOURCE_PREFETCH; + continue; + } + if ((r->flags & (IORESOURCE_MEM | IORESOURCE_PREFETCH)) == IORESOURCE_MEM) { + mask |= IORESOURCE_MEM; /* nonpref only */ + continue; + } + } return mask; }