From patchwork Fri Jan 15 22:17:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Kleen X-Patchwork-Id: 8044781 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1E3D9BEEE5 for ; Fri, 15 Jan 2016 22:18:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4CF7A20381 for ; Fri, 15 Jan 2016 22:18:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6BA2920379 for ; Fri, 15 Jan 2016 22:18:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753395AbcAOWSJ (ORCPT ); Fri, 15 Jan 2016 17:18:09 -0500 Received: from mga04.intel.com ([192.55.52.120]:42943 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752334AbcAOWSI (ORCPT ); Fri, 15 Jan 2016 17:18:08 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP; 15 Jan 2016 14:18:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,302,1449561600"; d="scan'208";a="894124740" Received: from tassilo.jf.intel.com (HELO tassilo.localdomain) ([10.7.201.156]) by fmsmga002.fm.intel.com with ESMTP; 15 Jan 2016 14:18:06 -0800 Received: by tassilo.localdomain (Postfix, from userid 1000) id 97CD23028C0; Fri, 15 Jan 2016 14:18:06 -0800 (PST) From: Andi Kleen To: bhelgaas@google.com Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, Andi Kleen Subject: [PATCH] x86, pci: Add quirk for unsizeable Broadwell EP bar Date: Fri, 15 Jan 2016 14:17:59 -0800 Message-Id: <1452896279-22034-1-git-send-email-andi@firstfloor.org> X-Mailer: git-send-email 2.4.3 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.9 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 From: Andi Kleen The Home Agent and PCU PCI devices in Broadwell-EP have a BAR that returns a non zero value when read, but is still not sizeable (because it doesn't exist). This causes several [Firmware error] messages at boot. It does not cause any functional problems, as the devices really have no BARs. Add a PCI quirk to shut off the messages. Since the message is printed before the normal header fixup add EARLY fixups. This requires changing the PCI probe code to not override the resource flags unconditionally, so that the quirk can set flags. (I believe that's ok, they should be always zero before, but please double check) Also don't print the invalid BAR message for FIXED BARs. Signed-off-by: Andi Kleen --- arch/x86/pci/fixup.c | 12 ++++++++++++ drivers/pci/probe.c | 8 +++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c index e585655..86bbdd6 100644 --- a/arch/x86/pci/fixup.c +++ b/arch/x86/pci/fixup.c @@ -540,3 +540,15 @@ static void twinhead_reserve_killing_zone(struct pci_dev *dev) } } DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x27B9, twinhead_reserve_killing_zone); + +/* + * Intel Broadwell EP. Prevent reading/updating BAR on Home Agent and PCU devices + * which are not real BARs, but still return non-null. + * This prevents a harmless warning message at boot. + */ +static void pci_bdwep_ha_bar(struct pci_dev *dev) +{ + dev->resource[0].flags |= IORESOURCE_PCI_FIXED; +} +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6fa0, pci_bdwep_ha_bar); +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6fc0, pci_bdwep_ha_bar); diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index edb1984..f7926e8 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -214,7 +214,7 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, l = 0; if (type == pci_bar_unknown) { - res->flags = decode_bar(dev, l); + res->flags |= decode_bar(dev, l); res->flags |= IORESOURCE_SIZEALIGN; if (res->flags & IORESOURCE_IO) { l64 = l & PCI_BASE_ADDRESS_IO_MASK; @@ -251,8 +251,10 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, sz64 = pci_size(l64, sz64, mask64); if (!sz64) { - dev_info(&dev->dev, FW_BUG "reg 0x%x: invalid BAR (can't size)\n", - pos); + /* Don't print this message for a fixed BAR */ + if (!(res->flags & IORESOURCE_PCI_FIXED)) + dev_info(&dev->dev, FW_BUG "reg 0x%x: invalid BAR (can't size)\n", + pos); goto fail; }