From patchwork Mon May 9 18:23:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prarit Bhargava X-Patchwork-Id: 9048891 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 619E39F6FA for ; Mon, 9 May 2016 18:23:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5FAB52011E for ; Mon, 9 May 2016 18:23:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 50B2120142 for ; Mon, 9 May 2016 18:23:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751839AbcEISXV (ORCPT ); Mon, 9 May 2016 14:23:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37086 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751867AbcEISXT (ORCPT ); Mon, 9 May 2016 14:23:19 -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 0529C8E919; Mon, 9 May 2016 18:23:19 +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 u49INIe3030615; Mon, 9 May 2016 14:23:18 -0400 From: Prarit Bhargava To: linux-pci@vger.kernel.org Cc: Prarit Bhargava , Bjorn Helgaas , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Myron Stowe , x86@kernel.org Subject: [PATCH] x86/PCI: Fix Broadwell-EP Home Agent & PCU non-compliant BARs Date: Mon, 9 May 2016 14:23:15 -0400 Message-Id: <1462818195-6533-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]); Mon, 09 May 2016 18:23:19 +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=-9.0 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 commit b894157 ("x86/PCI: Mark Broadwell-EP Home Agent & PCU as having non-compliant BARs") marks Home Agent 0 & PCU has having non-compliant BARs. Before commit b894157, pci 0000:ff:12.0: BAR 2: failed to assign [mem size 0x00000040] pci 0000:ff:12.0: BAR 4: failed to assign [mem size 0x00000040] pci 0000:ff:12.4: BAR 2: failed to assign [mem size 0x00000040] pci 0000:ff:12.4: BAR 4: failed to assign [mem size 0x00000040] pci 0000:ff:12.0: BAR 1: failed to assign [mem size 0x00000010] pci 0000:ff:12.0: BAR 3: failed to assign [mem size 0x00000010] pci 0000:ff:12.0: BAR 5: failed to assign [mem size 0x00000010] pci 0000:ff:12.4: BAR 1: failed to assign [mem size 0x00000010] pci 0000:ff:12.4: BAR 3: failed to assign [mem size 0x00000010] pci 0000:ff:12.4: BAR 5: failed to assign [mem size 0x00000010] pci 0000:7f:12.0: BAR 2: failed to assign [mem size 0x00000040] pci 0000:7f:12.0: BAR 4: failed to assign [mem size 0x00000040] pci 0000:7f:12.4: BAR 2: failed to assign [mem size 0x00000040] pci 0000:7f:12.4: BAR 4: failed to assign [mem size 0x00000040] pci 0000:7f:12.0: BAR 1: failed to assign [mem size 0x00000010] pci 0000:7f:12.0: BAR 3: failed to assign [mem size 0x00000010] pci 0000:7f:12.0: BAR 5: failed to assign [mem size 0x00000010] pci 0000:7f:12.4: BAR 1: failed to assign [mem size 0x00000010] pci 0000:7f:12.4: BAR 3: failed to assign [mem size 0x00000010] pci 0000:7f:12.4: BAR 5: failed to assign [mem size 0x00000010] After commit b894157, there are still "failed to assign" messages, as well as new "failed to assign" messages for ff:12.0, ff:1e.3, 7f:12.0, and 7f:1e.3. pci 0000:ff:12.4: BAR 2: failed to assign [mem size 0x00000040] pci 0000:ff:12.4: BAR 4: failed to assign [mem size 0x00000040] pci 0000:ff:12.4: BAR 1: failed to assign [mem size 0x00000010] pci 0000:ff:12.4: BAR 3: failed to assign [mem size 0x00000010] pci 0000:ff:12.4: BAR 5: failed to assign [mem size 0x00000010] pci 0000:ff:12.0: 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.4: BAR 2: failed to assign [mem size 0x00000040] pci 0000:7f:12.4: BAR 4: failed to assign [mem size 0x00000040] pci 0000:7f:12.4: BAR 1: failed to assign [mem size 0x00000010] pci 0000:7f:12.4: BAR 3: failed to assign [mem size 0x00000010] pci 0000:7f:12.4: BAR 5: failed to assign [mem size 0x00000010] pci 0000:7f:12.0: BAR 6: failed to assign [mem size 0x00000001 pref] pci 0000:7f:1e.3: BAR 6: failed to assign [mem size 0x00000001 pref] There are two issues with commit b894157. The first is that there is another device, Home Agent 1 & PCU, that must also be quirked in the same way. \# lspci -n -s 7f:12.4 7f:12.4 0880: 8086:6f60 (rev 01) After applying the quirk patch, we end up with: 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] which drives us to the second issue. Since the PCI devices now have unnassigned resources (BARs), pcibios_assign_resources() call pci_assign_unassigned_root_bus_resources(). This results in the messages above. I have added a non_compliant_bars check in pbus_assign_resources_sorted() to avoid the unassigned device's resources from being added to the failed resources list for the bus. Successfully tested by me on a three vendor's Broadwell-EP systems which no longer show the above false errors messages. Cc: Bjorn Helgaas Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: Myron Stowe Cc: x86@kernel.org Fixes: b894157 ("x86/PCI: Mark Broadwell-EP Home Agent & PCU as having non-compliant BARs") Signed-off-by: Prarit Bhargava --- arch/x86/pci/fixup.c | 1 + drivers/pci/setup-bus.c | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c index b7de192..59a79e6 100644 --- a/arch/x86/pci/fixup.c +++ b/arch/x86/pci/fixup.c @@ -556,5 +556,6 @@ static void pci_bdwep_bar(struct pci_dev *dev) { dev->non_compliant_bars = 1; } +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6f60, pci_bdwep_bar); DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6fa0, pci_bdwep_bar); DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6fc0, pci_bdwep_bar); diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 55641a3..78b6b69 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -515,8 +515,10 @@ static void pbus_assign_resources_sorted(const struct pci_bus *bus, struct pci_dev *dev; LIST_HEAD(head); - list_for_each_entry(dev, &bus->devices, bus_list) - __dev_sort_resources(dev, &head); + list_for_each_entry(dev, &bus->devices, bus_list) { + if (!dev->non_compliant_bars) + __dev_sort_resources(dev, &head); + } __assign_resources_sorted(&head, realloc_head, fail_head); }