From patchwork Wed May 11 10:52:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prarit Bhargava X-Patchwork-Id: 9067851 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AA1FD9F1C3 for ; Wed, 11 May 2016 10:52:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D7EC4201C0 for ; Wed, 11 May 2016 10:52:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E191E20155 for ; Wed, 11 May 2016 10:52:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751883AbcEKKwS (ORCPT ); Wed, 11 May 2016 06:52:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40062 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751338AbcEKKwR (ORCPT ); Wed, 11 May 2016 06:52:17 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CA7B261A0C; Wed, 11 May 2016 10:52:16 +0000 (UTC) Received: from praritdesktop.bos.redhat.com (prarit-guest.khw.lab.eng.bos.redhat.com [10.16.186.145]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u4BAqDbT025336; Wed, 11 May 2016 06:52:15 -0400 From: Prarit Bhargava To: linux-pci@vger.kernel.org Cc: Prarit Bhargava , Bjorn Helgaas , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org, Andi Kleen Subject: [PATCH 2/2] x86/PCI: Disable IO/MEM decoding for ROM BARs for devices with non-compliant BARs Date: Wed, 11 May 2016 06:52:10 -0400 Message-Id: <1462963930-18506-3-git-send-email-prarit@redhat.com> In-Reply-To: <1462963930-18506-1-git-send-email-prarit@redhat.com> References: <1462963930-18506-1-git-send-email-prarit@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 11 May 2016 10:52:16 +0000 (UTC) Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-8.3 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 After executing quirk patches for the Broadwell-EP Home Agents, the following errors are in the boot log: pci 0000:ff:12.0: BAR 6: failed to assign [mem size 0x00000001 pref] pci 0000:ff:12.4: BAR 6: failed to assign [mem size 0x00000001 pref] pci 0000:ff:1e.3: BAR 6: failed to assign [mem size 0x00000001 pref] pci 0000:7f:12.0: BAR 6: failed to assign [mem size 0x00000001 pref] pci 0000:7f:12.4: BAR 6: failed to assign [mem size 0x00000001 pref] pci 0000:7f:1e.3: BAR 6: failed to assign [mem size 0x00000001 pref] For the PCI ROM device's memory resource (BAR 6), pci_read_bases() initializes the value of res->flags. Later in the boot, pcibios_assign_resources() attempts to assign uninitialized resources, and calls pcibios_allocate_dev_rom_resource(). That function uses the res->flags field to determine if the rom resource has been initialized. The code then attempts to assign a resource to the rom BAR and the "failed to assign" messages are output to the log. This patch moves the non_compliant_bars check to pci_read_bases() so it covers all the BARs of a non-compliant device. Fixes: b84106b4e229 ("PCI: Disable IO/MEM decoding for devices with non-compliant BARs") Cc: Bjorn Helgaas Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: x86@kernel.org Cc: linux-kernel@vger.kernel.org Cc: Andi Kleen Signed-off-by: Prarit Bhargava --- drivers/pci/probe.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 8004f67c57ec..bf8405fb4ace 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -179,9 +179,6 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, u16 orig_cmd; struct pci_bus_region region, inverted_region; - if (dev->non_compliant_bars) - return 0; - mask = type ? PCI_ROM_ADDRESS_MASK : ~0; /* No printks while decoding is disabled! */ @@ -322,6 +319,9 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom) { unsigned int pos, reg; + if (dev->non_compliant_bars) + return; + for (pos = 0; pos < howmany; pos++) { struct resource *res = &dev->resource[pos]; reg = PCI_BASE_ADDRESS_0 + (pos << 2);