Re: [bug] mapping multiple BARs

From: Jiri Olsa
Date: Thu Mar 24 2016 - 09:37:12 EST


On Thu, Mar 24, 2016 at 11:15:06AM +0100, Borislav Petkov wrote:
> On Thu, Mar 24, 2016 at 10:44:41AM +0100, Jiri Olsa wrote:
> > hi,
> > I'm hitting following lines in dmesg:
> > resource sanity check: requesting [mem 0xfed10000-0xfed15fff], which spans more than reserved [mem 0xfed10000-0xfed13fff]
> > caller snb_uncore_imc_init_box+0x7c/0xa0 mapping multiple BARs
> >
> > I'm on IvyBridge model 58
> > vendor_id : GenuineIntel
> > cpu family : 6
> > model : 58
> > model name : Intel(R) Core(TM) i7-3720QM CPU @ 2.60GHz
> > stepping : 9
> > microcode : 0x1c
> >
> > I've read following threads:
> > http://marc.info/?w=2&r=1&s=mapping+multiple+BARs&q=t
> >
> > and it seems this is supposed to be already fixed by:
> > cb171f7abb9a PNP: Work around BIOS defects in Intel MCH area reporting
>
> And as we talked on IRC, it looked like the quirk gets applied on my
> machine and not on yours. I.e., I see:
>
> [ 0.669351] pnp 00:01: [Firmware Bug]: PNP resource [mem 0xfed10000-0xfed13fff] covers only part of 0000:00:00.0 Intel MCH; extending to [mem 0xfed10000-0xfed17fff]
>
> and you don't.
>
> Can you add some debug printks to quirk_intel_mch() to find out why?

seems like this function did not find any quirk
(patch for the output attached)

[root@intel-chiefriver-04 ~]# dmesg | grep quirk_intel_mch
quirk_intel_mch dev WDT0
quirk_intel_mch region start ffff880244617778, end fed10000
quirk_intel_mch mch start fed10000, end fed17fff
quirk_intel_mch res start 6a4, end 6a4
quirk_intel_mch res start 6a0, end 6a0
quirk_intel_mch dev LDRC
quirk_intel_mch region start ffff880244617378, end fed10000
quirk_intel_mch mch start fed10000, end fed17fff
quirk_intel_mch res start 2e, end 2f
quirk_intel_mch res start 4e, end 4f
quirk_intel_mch res start 61, end 61
quirk_intel_mch res start 63, end 63
quirk_intel_mch res start 65, end 65
quirk_intel_mch res start 67, end 67
quirk_intel_mch res start 70, end 70
quirk_intel_mch res start 80, end 80
quirk_intel_mch res start 92, end 92
quirk_intel_mch res start b2, end b3
quirk_intel_mch res start 680, end 69f
quirk_intel_mch res start 1004, end 1013
quirk_intel_mch res start ffff, end ffff
quirk_intel_mch res start ffff, end ffff
quirk_intel_mch res start 400, end 453
quirk_intel_mch res start 458, end 47f
quirk_intel_mch res start 500, end 57f
quirk_intel_mch res start 164e, end 164f
quirk_intel_mch dev CWDT
quirk_intel_mch region start ffff8802446b8b78, end fed10000
quirk_intel_mch mch start fed10000, end fed17fff
quirk_intel_mch res start 454, end 457
quirk_intel_mch dev PDRC
quirk_intel_mch region start ffff8802446bcb78, end fed10000
quirk_intel_mch mch start fed10000, end fed17fff
quirk_intel_mch res start fed1c000, end fed1ffff
quirk_intel_mch res start fed10000, end fed17fff
quirk_intel_mch res start fed18000, end fed18fff
quirk_intel_mch res start fed19000, end fed19fff
quirk_intel_mch res start f8000000, end fbffffff
quirk_intel_mch res start fed20000, end fed3ffff
quirk_intel_mch res start fed90000, end fed93fff
quirk_intel_mch res start fed45000, end fed8ffff
quirk_intel_mch res start ff000000, end ffffffff
quirk_intel_mch res start fee00000, end feefffff
quirk_intel_mch res start b15b0000, end b15b0fff


but AFAICS the following dmesg output:

resource sanity check: requesting [mem 0xfed10000-0xfed15fff], which spans more than reserved [mem 0xfed10000-0xfed13fff]
caller snb_uncore_imc_init_box+0x7c/0xa0 mapping multiple BARs

is related to checking of iomem_resource, which I haven't
found connected to the pnp_dev resources from the quirk code


thanks,
jirka


---
diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c
index d28e3ab..964ba12 100644
--- a/drivers/pnp/quirks.c
+++ b/drivers/pnp/quirks.c
@@ -397,13 +397,22 @@ static void quirk_intel_mch(struct pnp_dev *dev)
mch.flags = IORESOURCE_MEM;
pcibios_bus_to_resource(host->bus, &mch, &region);

+printk("quirk_intel_mch dev %s\n", dev->name);
+printk("quirk_intel_mch region start %llx, end %llx\n", dev->name, region.start, region.end);
+printk("quirk_intel_mch mch start %llx, end %llx\n", mch.start, mch.end);
+
list_for_each_entry(pnp_res, &dev->resources, list) {
res = &pnp_res->res;
+
+printk("quirk_intel_mch res start %llx, end %llx\n", res->start, res->end);
+
if (res->end < mch.start || res->start > mch.end)
continue; /* no overlap */
if (res->start == mch.start && res->end == mch.end)
continue; /* exact match */

+printk("quirk_intel_mch GOT IT\n");
+
dev_info(&dev->dev, FW_BUG "PNP resource %pR covers only part of %s Intel MCH; extending to %pR\n",
res, pci_name(host), &mch);
res->start = mch.start;