diff mbox

4.3-rc3 BAR allocation problems on multiple machines

Message ID CAE9FiQXDCtL9nqQOVNspNc87=eY98NW=nrSZczbKVNYsPQuVJA@mail.gmail.com
State Not Applicable
Headers show

Commit Message

Yinghai Lu Oct. 14, 2015, 12:43 a.m. UTC
On Tue, Oct 13, 2015 at 1:39 PM, Meelis Roos <mroos@linux.ee> wrote:
>
> 0001:00:07.0 ISA bridge: ULi Electronics Inc. M1533/M1535/M1543 PCI to ISA Bridge [Aladdin IV/V/V+]
>         Control: I/O+ Mem+ BusMaster+ SpecCycle+ MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
>         Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
>         Latency: 0
>         Region 0: [virtual] I/O ports at 0000 [size=64K]
>         Region 1: Memory at <unassigned> (32-bit, non-prefetchable) [size=1M]
>         Region 2: Memory at <unassigned> (32-bit, non-prefetchable) [size=1M]
>         Region 3: [virtual] Memory at fffff80100000000 (32-bit, non-prefetchable)
>         Region 4: [virtual] Memory at fffff80100000000 (32-bit, non-prefetchable)
>         Region 5: [virtual] Memory at fffff80100000000 (32-bit, non-prefetchable)
>         [virtual] Expansion ROM at fffff80100000000 [disabled]
>         Capabilities: [a0] Power Management version 1
>                 Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
>                 Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
> 00: b9 10 33 15 0f 00 10 02 00 00 01 06 00 00 00 00
> 10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 30: 00 00 00 00 a0 00 00 00 00 00 00 00 00 00 00 00
> 40: 03 13 4b 80 83 09 00 47 00 00 06 00 00 00 eb 31
> 50: 00 00 00 20 90 02 20 03 66 03 00 00 00 00 00 08
> 60: 40 00 00 00 00 00 00 00 00 00 00 00 80 20 00 00
> 70: 00 00 0a 00 47 00 00 db 04 02 00 04 00 80 01 90
> 80: a5 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> a0: 01 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00
> b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Please check attached patch.

Thanks

Yinghai

Comments

Meelis Roos Oct. 14, 2015, 7:34 a.m. UTC | #1
> > 0001:00:07.0 ISA bridge: ULi Electronics Inc. M1533/M1535/M1543 PCI to ISA Bridge [Aladdin IV/V/V+]
> >         Control: I/O+ Mem+ BusMaster+ SpecCycle+ MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
> >         Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
> >         Latency: 0
> >         Region 0: [virtual] I/O ports at 0000 [size=64K]
> >         Region 1: Memory at <unassigned> (32-bit, non-prefetchable) [size=1M]
> >         Region 2: Memory at <unassigned> (32-bit, non-prefetchable) [size=1M]
> >         Region 3: [virtual] Memory at fffff80100000000 (32-bit, non-prefetchable)
> >         Region 4: [virtual] Memory at fffff80100000000 (32-bit, non-prefetchable)
> >         Region 5: [virtual] Memory at fffff80100000000 (32-bit, non-prefetchable)
> >         [virtual] Expansion ROM at fffff80100000000 [disabled]
> >         Capabilities: [a0] Power Management version 1
> >                 Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
> >                 Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
> > 00: b9 10 33 15 0f 00 10 02 00 00 01 06 00 00 00 00
> > 10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > 20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > 30: 00 00 00 00 a0 00 00 00 00 00 00 00 00 00 00 00
> > 40: 03 13 4b 80 83 09 00 47 00 00 06 00 00 00 eb 31
> > 50: 00 00 00 20 90 02 20 03 66 03 00 00 00 00 00 08
> > 60: 40 00 00 00 00 00 00 00 00 00 00 00 80 20 00 00
> > 70: 00 00 0a 00 47 00 00 db 04 02 00 04 00 80 01 90
> > 80: a5 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > 90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > a0: 01 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00
> > b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 
> Please check attached patch.

Thank you, it seems to work. First, the following lines are gone:
PCI: Claiming 0001:00:07.0: Resource 0: 000007fe01000000..000007fe0100ffff [101]
PCI: Claiming 0001:00:07.0: Resource 1: 000007ff00000000..000007ff000fffff [200]
PCI: Claiming 0001:00:07.0: Resource 2: 000007ff00000000..000007ff000fffff [200]

And then all following PCI: Claiming... lines succeed, with no address 
conflicts.

Now, how can I be sure that removing the ULi ISA bridge allocations does 
not break anything? It seems I did not have I2C enabled in kernel conf - 
I emabled it now, recompiled, got this but it seems to be for another 
PCI device so not related?
ali15x3_smbus 0001:00:06.0: ALI15X3_smb region uninitialized - upgrade BIOS or use force_addr=0xaddr
ali15x3_smbus 0001:00:06.0: ALI15X3 not detected, module not inserted.

Additionally, another driver (i2c-ali1535) claimed 0001:00:06.0 and was 
happy but did not find anything (but I do not know what it sahould find 
so I can see no problem at the moment).

I also applied the patch on Sun Blade 100 where i2c was working for me. 
It was still working with this ali quirk patch applied, and no BAR 
errors.

What about other arches - does this patch affect other arches where the 
firmware has configured some addresses for this ULi bridge?
Yinghai Lu Oct. 14, 2015, 9:45 p.m. UTC | #2
On Wed, Oct 14, 2015 at 12:34 AM, Meelis Roos <mroos@linux.ee> wrote:
>> > 0001:00:07.0 ISA bridge: ULi Electronics Inc. M1533/M1535/M1543 PCI to ISA Bridge [Aladdin IV/V/V+]
>> >         Control: I/O+ Mem+ BusMaster+ SpecCycle+ MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
>> >         Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
>> >         Latency: 0
>> >         Region 0: [virtual] I/O ports at 0000 [size=64K]
>> >         Region 1: Memory at <unassigned> (32-bit, non-prefetchable) [size=1M]
>> >         Region 2: Memory at <unassigned> (32-bit, non-prefetchable) [size=1M]
>> >         Region 3: [virtual] Memory at fffff80100000000 (32-bit, non-prefetchable)
>> >         Region 4: [virtual] Memory at fffff80100000000 (32-bit, non-prefetchable)
>> >         Region 5: [virtual] Memory at fffff80100000000 (32-bit, non-prefetchable)
>> >         [virtual] Expansion ROM at fffff80100000000 [disabled]
>> >         Capabilities: [a0] Power Management version 1
>> >                 Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
>> >                 Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
>> > 00: b9 10 33 15 0f 00 10 02 00 00 01 06 00 00 00 00
>> > 10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>> > 20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>> > 30: 00 00 00 00 a0 00 00 00 00 00 00 00 00 00 00 00
>> > 40: 03 13 4b 80 83 09 00 47 00 00 06 00 00 00 eb 31
>> > 50: 00 00 00 20 90 02 20 03 66 03 00 00 00 00 00 08
>> > 60: 40 00 00 00 00 00 00 00 00 00 00 00 80 20 00 00
>> > 70: 00 00 0a 00 47 00 00 db 04 02 00 04 00 80 01 90
>> > 80: a5 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>> > 90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>> > a0: 01 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00
>> > b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>> > c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>> > d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>> > e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>> > f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>>
>> Please check attached patch.
>
> Thank you, it seems to work. First, the following lines are gone:
> PCI: Claiming 0001:00:07.0: Resource 0: 000007fe01000000..000007fe0100ffff [101]
> PCI: Claiming 0001:00:07.0: Resource 1: 000007ff00000000..000007ff000fffff [200]
> PCI: Claiming 0001:00:07.0: Resource 2: 000007ff00000000..000007ff000fffff [200]
>
> And then all following PCI: Claiming... lines succeed, with no address
> conflicts.
>
> Now, how can I be sure that removing the ULi ISA bridge allocations does
> not break anything? It seems I did not have I2C enabled in kernel conf -
> I emabled it now, recompiled, got this but it seems to be for another
> PCI device so not related?
> ali15x3_smbus 0001:00:06.0: ALI15X3_smb region uninitialized - upgrade BIOS or use force_addr=0xaddr
> ali15x3_smbus 0001:00:06.0: ALI15X3 not detected, module not inserted.

code segment:
        /* Determine the address of the SMBus area */
        pci_read_config_word(ALI15X3_dev, SMBBA, &ali15x3_smba);
        ali15x3_smba &= (0xffff & ~(ALI15X3_SMB_IOSIZE - 1));
        if (ali15x3_smba == 0 && force_addr == 0) {
                dev_err(&ALI15X3_dev->dev, "ALI15X3_smb region uninitialized "
                        "- upgrade BIOS or use force_addr=0xaddr\n");
                return -ENODEV;
        }

SMBBA is 0x14

from lspci:

0001:00:06.0 Non-VGA unclassified device: ULi Electronics Inc. M7101
Power Management Controller [PMU]
        Control: I/O- Mem- BusMaster- SpecCycle- MemWINV- VGASnoop-
ParErr- Stepping- SERR- FastB2B- DisINTx-
        Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium
>TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Region 0: [virtual] I/O ports at <unassigned> [size=16]
        [virtual] Expansion ROM at fffff80100000000 [disabled]
00: b9 10 01 71 00 00 00 02 00 00 00 00 00 00 00 00
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

0x14 BAR has 0 really.

>
> Additionally, another driver (i2c-ali1535) claimed 0001:00:06.0 and was
> happy but did not find anything (but I do not know what it sahould find
> so I can see no problem at the moment).

it should complain too:

        /* Determine the address of the SMBus area */
        pci_read_config_word(dev, SMBBA, &ali1535_offset);
        dev_dbg(&dev->dev, "ALI1535_smb is at offset 0x%04x\n", ali1535_offset);
        ali1535_offset &= (0xffff & ~(ALI1535_SMB_IOSIZE - 1));
        if (ali1535_offset == 0) {
                dev_warn(&dev->dev,
                        "ALI1535_smb region uninitialized - upgrade BIOS?\n");
                retval = -ENODEV;
                goto exit;
        }


>
> I also applied the patch on Sun Blade 100 where i2c was working for me.
> It was still working with this ali quirk patch applied, and no BAR
> errors.

Good.

assume v210 does use those for i2c.

>
> What about other arches - does this patch affect other arches where the
> firmware has configured some addresses for this ULi bridge?

According to data sheet, those BAR on 00:07.0 are all 0, and read only.
Not sure how are those to to use them.

Thanks

Yinghai
--
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 mbox

Patch

Subject: [PATCH] PCI: Ignore BAR for ALi M1533 PCI-ISA bridge

Meelis reported strange conflicts on sparc v210:
pci 0001:00:07.0: can't claim BAR 2 [mem 0x7ff00000000-0x7ff000fffff]: address conflict with 0001:00:07.0 [mem 0x7ff00000000-0x7ff000fffff]
pci 0001:00:06.0: can't claim BAR 0 [io 0x7fe01000000-0x7fe0100000f]: address conflict with 0001:00:07.0 [io 0x7fe01000000-0x7fe0100ffff]
pci 0001:00:0d.0: can't claim BAR 0 [io 0x7fe01000900-0x7fe01000907]: address conflict with 0001:00:07.0 [io 0x7fe01000000-0x7fe0100ffff]
pci 0001:00:0d.0: can't claim BAR 1 [io 0x7fe01000918-0x7fe0100091f]: address conflict with 0001:00:07.0 [io 0x7fe01000000-0x7fe0100ffff]
pci 0001:00:0d.0: can't claim BAR 2 [io 0x7fe01000910-0x7fe01000917]: address conflict with 0001:00:07.0 [io 0x7fe01000000-0x7fe0100ffff]
pci 0001:00:0d.0: can't claim BAR 3 [io 0x7fe01000908-0x7fe0100090f]: address conflict with 0001:00:07.0 [io 0x7fe01000000-0x7fe0100ffff]
pci 0001:00:0d.0: can't claim BAR 4 [io 0x7fe01000920-0x7fe0100092f]: address conflict with 0001:00:07.0 [io 0x7fe01000000-0x7fe0100ffff]
PCI: /pci@1e,600000 can't claim Video RAM area [mem 0x7ff000a0000-0x7ff000bffff]: address conflict with 0001:00:07.0 [mem 0x7ff00000000-0x7ff000fffff]
PCI: /pci@1e,600000 can't claim System ROM [mem 0x7ff000f0000-0x7ff000fffff]: address conflict with 0001:00:07.0 [mem 0x7ff00000000-0x7ff000fffff]
PCI: /pci@1e,600000 can't claim Video ROM [mem 0x7ff000c0000-0x7ff000c7fff]: address conflict with 0001:00:07.0 [mem 0x7ff00000000-0x7ff000fffff]

we have
pci_bus 0001:00: root bus resource [io  0x7fe01000000-0x7fe01ffffff] (bus address [0x0000-0xffffff])
pci_bus 0001:00: root bus resource [mem 0x7ff00000000-0x7ffffffffff] (bus address [0x00000000-0xffffffff])

so pci bus address in the bars for 0001:00:07.0 has all 0s.

0001:00:07.0 ISA bridge: ULi Electronics Inc. M1533/M1535/M1543 PCI to ISA Bridge [Aladdin IV/V/V+]
        Region 0: [virtual] I/O ports at 0000 [size=64K]
        Region 1: Memory at <unassigned> (32-bit, non-prefetchable) [size=1M]
        Region 2: Memory at <unassigned> (32-bit, non-prefetchable) [size=1M]
00: b9 10 33 15 0f 00 10 02 00 00 01 06 00 00 00 00
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
30: 00 00 00 00 a0 00 00 00 00 00 00 00 00 00 00 00

According to http://www.versalogic.com/Support/Downloads/pdf/ali1543.pdf
page 28: The indices before 40h are read-only.
and we have all 0 from 0x10-0x2f, according to lspci.

So clean flags, and ignore them all the way include
claim and sizing and alloc etc.

Reported-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 drivers/pci/quirks.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

Index: linux-2.6/drivers/pci/quirks.c
===================================================================
--- linux-2.6.orig/drivers/pci/quirks.c
+++ linux-2.6/drivers/pci/quirks.c
@@ -470,6 +470,21 @@  static void quirk_amd_nl_class(struct pc
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB,
 		quirk_amd_nl_class);
 
+
+/*
+ * ALi m1533 pci to isa bridge does not have BAR according to datasheet,
+ * clear the flags, so we will try to claim them or reallocate res.
+ */
+static void quirk_ali1533(struct pci_dev *dev)
+{
+	int i;
+
+	for (i = 0; i < PCI_ROM_RESOURCE; i++)
+		dev->resource[i].flags = 0;
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533,
+			 quirk_ali1533);
+
 static void piix4_io_quirk(struct pci_dev *dev, const char *name, unsigned int port, unsigned int enable)
 {
 	u32 devres;