All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bhelgaas@google.com>
To: Borislav Petkov <bp@alien8.de>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	"Zhang, Rui" <rui.zhang@intel.com>,
	"Lu, Aaron" <aaron.lu@intel.com>,
	lkml <linux-kernel@vger.kernel.org>,
	"x86@kernel.org" <x86@kernel.org>,
	Linux PCI <linux-pci@vger.kernel.org>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	Yinghai Lu <yinghai@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>,
	Stephane Eranian <eranian@google.com>,
	"Yan, Zheng Z" <zheng.z.yan@intel.com>
Subject: Re: Info: mapping multiple BARs. Your kernel is fine.
Date: Wed, 16 Apr 2014 14:31:38 -0600	[thread overview]
Message-ID: <20140416203138.GA17661@google.com> (raw)
In-Reply-To: <20140416190404.GA7070@pd.tnic>

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?



PNP: Work around Haswell BIOS defect in MCH area reporting

From: Bjorn Helgaas <bhelgaas@google.com>

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 <bp@alien8.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pnp/quirks.c |   52 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c
index 258fef272ea7..023edf592371 100644
--- a/drivers/pnp/quirks.c
+++ b/drivers/pnp/quirks.c
@@ -334,6 +334,57 @@ 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 ;
+	pcibios_bus_to_resource(host->bus, &mch, &region);
+
+	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 +415,7 @@ static struct pnp_fixup pnp_fixups[] = {
 #ifdef CONFIG_AMD_NB
 	{"PNP0c01", quirk_amd_mmconfig_area},
 #endif
+	{"PNP0c02", quirk_intel_haswell_mch},
 	{""}
 };
 

  parent reply	other threads:[~2014-04-16 20:31 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-24 16:24 Info: mapping multiple BARs. Your kernel is fine Borislav Petkov
2014-02-24 16:24 ` Borislav Petkov
2014-02-24 20:19 ` Borislav Petkov
2014-02-24 20:19   ` Borislav Petkov
2014-02-25 15:48   ` H. Peter Anvin
2014-02-25 16:14     ` Stephane Eranian
2014-02-25 16:30       ` Borislav Petkov
2014-02-25 16:30         ` Borislav Petkov
2014-02-25 16:33         ` Stephane Eranian
2014-02-25 17:39           ` Borislav Petkov
2014-02-25 17:39             ` Borislav Petkov
2014-02-25 18:54             ` Stephane Eranian
2014-02-25 22:10               ` Borislav Petkov
2014-02-25 22:10                 ` Borislav Petkov
2014-02-26  6:56                 ` Stephane Eranian
2014-02-26  9:29                   ` Borislav Petkov
2014-02-26  9:29                     ` Borislav Petkov
2014-02-26  9:47                     ` Stephane Eranian
2014-02-26  9:59                       ` Borislav Petkov
2014-02-26  9:59                         ` Borislav Petkov
2014-02-27 10:12                         ` Stephane Eranian
2014-02-27 10:27                           ` Borislav Petkov
2014-02-27 10:27                             ` Borislav Petkov
2014-02-27 22:12                             ` Rafael J. Wysocki
2014-02-27 22:12                               ` Rafael J. Wysocki
2014-02-27 22:21                               ` Borislav Petkov
2014-02-27 22:21                                 ` Borislav Petkov
2014-03-05 21:03                                 ` Stephane Eranian
2014-03-05 21:03                                   ` Stephane Eranian
2014-02-27 10:30                           ` Peter Zijlstra
2014-02-27 10:30                             ` Peter Zijlstra
2014-02-27 10:32                             ` Stephane Eranian
2014-02-27 11:08                               ` Peter Zijlstra
2014-02-27 11:08                                 ` Peter Zijlstra
2014-02-27 12:20                                 ` Stephane Eranian
2014-02-26 13:57 ` Rafael J. Wysocki
2014-02-26 13:57   ` Rafael J. Wysocki
2014-02-26 13:50   ` Peter Zijlstra
2014-02-26 13:50     ` Peter Zijlstra
2014-02-26 13:52   ` Borislav Petkov
2014-02-26 13:52     ` Borislav Petkov
2014-03-15 14:15 ` Rafael J. Wysocki
2014-03-16 11:55   ` Borislav Petkov
2014-03-16 13:08     ` Stephane Eranian
2014-03-17  0:09       ` Rafael J. Wysocki
2014-03-17  0:23         ` Rafael J. Wysocki
2014-03-20  2:24   ` Aaron Lu
2014-03-20  2:29     ` Stephane Eranian
2014-03-20  3:03     ` Zhang, Rui
2014-03-20  3:03       ` Zhang, Rui
2014-03-20  3:03       ` Zhang, Rui
2014-03-20  3:34       ` Stephane Eranian
2014-03-20  7:53         ` Zhang, Rui
2014-03-20  7:53           ` Zhang, Rui
2014-03-20  7:53           ` Zhang, Rui
2014-03-20  8:16           ` Yan, Zheng
2014-03-20 13:43             ` Zhang Rui
2014-03-20 16:03             ` Stephane Eranian
2014-03-20 13:35           ` Zhang Rui
2014-03-20 13:35             ` Zhang Rui
2014-03-20 12:29       ` Rafael J. Wysocki
2014-03-20 16:45       ` Bjorn Helgaas
2014-03-20 20:55         ` Rafael J. Wysocki
2014-03-20 20:48           ` Bjorn Helgaas
2014-04-16 19:04             ` Borislav Petkov
2014-04-16 20:24               ` Zhang, Rui
2014-04-16 20:24                 ` Zhang, Rui
2014-04-16 20:24                 ` Zhang, Rui
2014-04-16 20:31               ` Bjorn Helgaas [this message]
2014-04-16 22:31                 ` Dave Jones
2014-04-16 22:56                   ` Bjorn Helgaas
2014-04-17  0:18                     ` Dave Jones
2014-04-17 10:45                     ` Borislav Petkov
2014-04-17 18:26                       ` Bjorn Helgaas
2014-04-17 19:48                         ` Borislav Petkov
2014-04-17 20:10                           ` Bjorn Helgaas
2014-04-17 19:52                         ` Dave Jones
2014-04-17 20:01                           ` Borislav Petkov
2014-04-17 20:03                             ` Dave Jones
2014-04-17 20:53                               ` Dave Jones
2014-04-17 21:01                                 ` Borislav Petkov
     [not found]                                   ` <20140417213027.GA22412@redhat.com>
2014-04-18 10:38                                     ` Borislav Petkov
2014-04-16 23:08                 ` Stephane Eranian
2014-04-16 23:11                   ` Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140416203138.GA17661@google.com \
    --to=bhelgaas@google.com \
    --cc=aaron.lu@intel.com \
    --cc=bp@alien8.de \
    --cc=eranian@google.com \
    --cc=hpa@zytor.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=rui.zhang@intel.com \
    --cc=x86@kernel.org \
    --cc=yinghai@kernel.org \
    --cc=zheng.z.yan@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.