From patchwork Wed Oct 6 16:06:21 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 236281 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o96G6OQW008595 for ; Wed, 6 Oct 2010 16:06:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758758Ab0JFQGY (ORCPT ); Wed, 6 Oct 2010 12:06:24 -0400 Received: from g6t0186.atlanta.hp.com ([15.193.32.63]:10601 "EHLO g6t0186.atlanta.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758743Ab0JFQGX (ORCPT ); Wed, 6 Oct 2010 12:06:23 -0400 Received: from g5t0029.atlanta.hp.com (g5t0029.atlanta.hp.com [16.228.8.141]) by g6t0186.atlanta.hp.com (Postfix) with ESMTP id CA6582C624; Wed, 6 Oct 2010 16:06:22 +0000 (UTC) Received: from ldl (ldl.fc.hp.com [15.11.146.30]) by g5t0029.atlanta.hp.com (Postfix) with ESMTP id 7E51A2008F; Wed, 6 Oct 2010 16:06:22 +0000 (UTC) Received: from localhost (ldl.fc.hp.com [127.0.0.1]) by ldl (Postfix) with ESMTP id 4C100CF0016; Wed, 6 Oct 2010 10:06:22 -0600 (MDT) Received: from ldl ([127.0.0.1]) by localhost (ldl.fc.hp.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1IG7uU+u2-+I; Wed, 6 Oct 2010 10:06:22 -0600 (MDT) Received: from eh.fc.hp.com (eh.fc.hp.com [15.11.146.105]) by ldl (Postfix) with ESMTP id 353E8CF0008; Wed, 6 Oct 2010 10:06:22 -0600 (MDT) Received: from bob.kio (localhost [127.0.0.1]) by eh.fc.hp.com (Postfix) with ESMTP id E299426108; Wed, 6 Oct 2010 10:06:21 -0600 (MDT) Subject: [PATCH] x86/PCI: ignore "BARs" that overlap MMCONFIG regions To: Jesse Barnes From: Bjorn Helgaas Cc: Robert Richter , linux-pci@vger.kernel.org, x86@kernel.org, Borislav Petkov , Joerg Roedel , Yinghai Lu Date: Wed, 06 Oct 2010 10:06:21 -0600 Message-ID: <20101006160621.29529.63353.stgit@bob.kio> User-Agent: StGit/0.15 MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 06 Oct 2010 16:06:25 +0000 (UTC) diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c index 08eba69..6656144 100644 --- a/arch/x86/pci/fixup.c +++ b/arch/x86/pci/fixup.c @@ -493,3 +493,32 @@ static void __devinit pci_siemens_interrupt_controller(struct pci_dev *dev) } DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SIEMENS, 0x0015, pci_siemens_interrupt_controller); + +#ifdef CONFIG_PCI_MMCONFIG +/* + * Ignore any MMCONFIG BARs. These can't be reassigned because MMCONFIG code + * has already discovered them, and they often conflict with other devices. + */ +static void quirk_ignore_mmconfig_bar(struct pci_dev *dev) +{ + struct pci_mmcfg_region *cfg; + int i; + + list_for_each_entry(cfg, &pci_mmcfg_list, list) { + for (i = 0; i < 6; i++) { + struct resource *res = &dev->resource[i]; + + if (resource_type(res) == IORESOURCE_MEM && + res->start < cfg->res.end && + res->end > cfg->res.start) { + dev_info(&dev->dev, "BAR %d: %pR overlaps domain %04x [bus %02x-%02x] MMCONFIG region %pR; ignoring this BAR\n", + i, res, cfg->segment, cfg->start_bus, + cfg->end_bus, &cfg->res); + res->flags = 0; + res->start = 0; + } + } + } +} +DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, quirk_ignore_mmconfig_bar); +#endif