From patchwork Wed Apr 16 22:56:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 4004321 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8DBCEBFF02 for ; Wed, 16 Apr 2014 22:56:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9733B202B4 for ; Wed, 16 Apr 2014 22:56:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7E193201C7 for ; Wed, 16 Apr 2014 22:56:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754988AbaDPW4H (ORCPT ); Wed, 16 Apr 2014 18:56:07 -0400 Received: from mail-ie0-f182.google.com ([209.85.223.182]:33332 "EHLO mail-ie0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751682AbaDPW4E (ORCPT ); Wed, 16 Apr 2014 18:56:04 -0400 Received: by mail-ie0-f182.google.com with SMTP id y20so11172928ier.41 for ; Wed, 16 Apr 2014 15:56:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=hEsdqW3LmRmmsiILEiuvBMOG9F/PB1j+tR6zS6961eI=; b=F43Ednindz1v1hr/4uMZIWj+IqT6Umd0++MLVS96U3aLfKKZOcPOKjudspNHb9LNSa HUu/hG6ylRbYxhpilMcm8HIy71B+SiGXzdCxhyyRqni2KegsSWKgckOxDK1LpfVbucT5 jO1neyrVQ3NnM8GzHtmIdCngoKHoDlAP9fuERjNOeM31EaYv4flU+D5l3aNyoXMJNHrZ FTzWlohKhSbYTiCuM1G9ugEDY7eTvkV14JKAH7cpJP+iA4RXT/wv88EBe0pjxooOd7Pa R3/N1g9FnTV5NWQ2qcS6ZG3WIRn26WWzeXjPAFufhLHyf8uJ3uBxLm3uK+8acQEq9L+G h1wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=hEsdqW3LmRmmsiILEiuvBMOG9F/PB1j+tR6zS6961eI=; b=fexmxGkubn248JoK+/5duhpU1muxClP35v5BxE5uMf+DgJc9WHgDH5wuGDRSKGe77o 2aHM+4VaNf70oJC3XEMeP1ywdS3fEaQu3SP+lC4gr+sFI8gAjZRFmcByA8TkeM9dGaP1 xwJzOJVLBOtZbF4x3OqzEJuKq1d+LFOPfbmGN3tNHtr0SN7iG2Qcm8k4zx9AJO61G0k6 9Ezt3fBe/rxsLB5AxST5mnZPHRSxrRTKbWJuGdUSEOtVLbqhnpYSn1r0iSA2tOf5DP9v 7Hk7wwFzq57JpHQsYmxLfx0rW4I7YKgNFeydK1PEzTHCHi/vR0emzWOtHNHKFUo2G2se OYxg== X-Gm-Message-State: ALoCoQmQgVJSTHs5d4nbh+b0fEEUrGYSwbEdAUExIvD47V1diiamFo0Kei82QFM3c9u5lQ2lnqrqGTbHbnLuxMUo6jJpvisps1lx41ddg0gokMcTjVs0tPs4+VdGKPhv4VZwcLt074MW7cr5+FfrVn0jgaoGsYUP9y3AWTMgGy4rxGrwPYcwFkHecW63eL8uNppLCUNHy1s2l11js/SHQ6YDVYZ8pbI2/Q== X-Received: by 10.42.173.68 with SMTP id q4mr6376745icz.41.1397688963261; Wed, 16 Apr 2014 15:56:03 -0700 (PDT) Received: from google.com ([172.16.50.112]) by mx.google.com with ESMTPSA id ng8sm1485832igb.6.2014.04.16.15.56.02 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 16 Apr 2014 15:56:02 -0700 (PDT) Date: Wed, 16 Apr 2014 16:56:00 -0600 From: Bjorn Helgaas To: Dave Jones , Borislav Petkov , "Rafael J. Wysocki" , "Zhang, Rui" , "Lu, Aaron" , lkml , "x86@kernel.org" , Linux PCI , ACPI Devel Maling List , Yinghai Lu , "H. Peter Anvin" , Stephane Eranian , "Yan, Zheng Z" Subject: Re: Info: mapping multiple BARs. Your kernel is fine. Message-ID: <20140416225600.GA23781@google.com> References: <20140224162400.GE16457@pd.tnic> <744357E9AAD1214791ACBA4B0B9092630121F201@SHSMSX101.ccr.corp.intel.com> <1558044.S1G2VU7srO@vostro.rjw.lan> <20140416190404.GA7070@pd.tnic> <20140416203138.GA17661@google.com> <20140416223122.GA2767@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20140416223122.GA2767@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 On Wed, Apr 16, 2014 at 06:31:22PM -0400, Dave Jones wrote: > On Wed, Apr 16, 2014 at 02:31:38PM -0600, Bjorn Helgaas wrote: > > On Wed, Apr 16, 2014 at 09:04:04PM +0200, Borislav Petkov wrote: > > > On Thu, Mar 20, 2014 at 02:48:30PM -0600, Bjorn Helgaas wrote: > > > > Right. Even if we had this long-term solution, we'd still have > > > > Stephane's current problem, because the PNP0C02 _CRS is still wrong. > > > > > > > > We do have a drivers/pnp/quirks.c where we could conceivably adjust > > > > the PNP resource if we found the matching PCI device and MCHBAR. That > > > > should solve Stephane's problem even with the current > > > > drivers/pnp/system.c. > > > > > > Guys, this still triggers in -rc1. Do we have a fix or something > > > testable at least? > > > > Hi Boris, > > > > Can you try the patch below? > > I'm seeing the exact same message on my thinkpad t430s. > When I try your patch, modesetting no longer works. When it tries > to change to the framebuffer I get a black screen and lockup. > If I boot with nomodeset it locks up when it gets to X. > It all scrolls by too fast to read, but it looks like there's still > a backtrace present. Ouch, sorry about that. I do see a bug in my patch (fixed below), but I don't see how that could cause what you're seeing. Maybe I could figure out something from this info (this can be from a kernel without my patch): - dmesg log - output of "find /sys/devices/pnp0 -name id -o -name resources | xargs grep ." - output of "sudo lspci -s00:00.0 -xxx" PNP: Work around Haswell BIOS defect in MCH area reporting From: Bjorn Helgaas Work around a Haswell BIOS defect that causes part of the MCH area to be unreported. MCHBAR is not an architected PCI BAR, so MCH space is usually reported as a PNP0C02 resource. The MCH space was 16KB prior to Haswell, but it is 32KB in Haswell. Some Haswell BIOSes still report a PNP0C02 resource that is only 16KB, which means the rest of the MCH space is consumed but unreported. This can cause resource map sanity check warnings or (theoretically) a device conflict if we assigned the unreported space to another device. The Intel perf event uncore driver tripped over this when it claimed the MCH region: resource map sanity check conflict: 0xfed10000 0xfed15fff 0xfed10000 0xfed13fff pnp 00:01 Info: mapping multiple BARs. Your kernel is fine. To prevent this, if we find a PNP0C02 resource that covers part of the MCH space, extend it to cover the entire space. Link: http://lkml.kernel.org/r/20140224162400.GE16457@pd.tnic Reported-by: Borislav Petkov Signed-off-by: Bjorn Helgaas --- drivers/pnp/quirks.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) -- 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 diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c index 258fef272ea7..8402088d4145 100644 --- a/drivers/pnp/quirks.c +++ b/drivers/pnp/quirks.c @@ -334,6 +334,60 @@ static void quirk_amd_mmconfig_area(struct pnp_dev *dev) } #endif +static void quirk_intel_haswell_mch(struct pnp_dev *dev) +{ + struct pci_dev *host; + u32 addr_lo, addr_hi; + struct pci_bus_region region; + struct resource mch; + struct pnp_resource *pnp_res; + struct resource *res; + + host = pci_get_device(PCI_VENDOR_ID_INTEL, 0x0c00, NULL); + if (!host) + return; + + /* + * MCHBAR is not an architected PCI BAR, so MCH space is usually + * reported as a PNP0C02 resource. The MCH space was 16KB prior to + * Haswell, but it is 32KB in Haswell. Some Haswell BIOSes still + * report a PNP0C02 resource that is only 16KB, which means the + * rest of the MCH space is consumed but unreported. + */ + + /* + * Read MCHBAR for Host Member Mapped Register Range Base + * https://www-ssl.intel.com/content/www/us/en/processors/core/4th-gen-core-family-desktop-vol-2-datasheet + * Sec 3.1.12. + */ + pci_read_config_dword(host, 0x48, &addr_lo); + region.start = addr_lo & ~0x7fff; + pci_read_config_dword(host, 0x4c, &addr_hi); + region.start |= (dma_addr_t) addr_hi << 32; + region.end = region.start + 32*1024 - 1 ; + + memset(&mch, 0, sizeof(mch)); + mch.flags = IORESOURCE_MEM; + pcibios_bus_to_resource(host->bus, &mch, ®ion); + + list_for_each_entry(pnp_res, &dev->resources, list) { + res = &pnp_res->res; + if (res->end < mch.start || res->start > mch.end) + continue; /* no overlap */ + if (res->start == mch.start && res->end == mch.end) + continue; /* exact match */ + + dev_info(&dev->dev, FW_BUG + "%pR covers only part of Intel Haswell MCH; extending to %pR\n", + res, &mch); + res->start = mch.start; + res->end = mch.end; + break; + } + + pci_dev_put(host); +} + /* * PnP Quirks * Cards or devices that need some tweaking due to incomplete resource info @@ -364,6 +418,7 @@ static struct pnp_fixup pnp_fixups[] = { #ifdef CONFIG_AMD_NB {"PNP0c01", quirk_amd_mmconfig_area}, #endif + {"PNP0c02", quirk_intel_haswell_mch}, {""} };