diff mbox

4.3-rc3 BAR allocation problems on multiple machines

Message ID CAE9FiQUVom8RaEMDFHSZer3inB_QuckqxS6Dgsid0JcSHUFEFw@mail.gmail.com
State Not Applicable
Headers show

Commit Message

Yinghai Lu Oct. 13, 2015, 6:21 a.m. UTC
On Mon, Oct 12, 2015 at 10:43 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> On Mon, Oct 12, 2015 at 10:06 PM, Meelis Roos <mroos@linux.ee> wrote:
>>> >> > sparc64 machines:
>>
>> Updated on V210 - the others were more recent. Now I get more BAR
>> warning there too:
>>
>> http://kodu.ut.ee/~mroos/dm/dm.v210+patches
>>
>
> interesting, mem and mem64 is overlapping.
>
> [   38.824625] /pci@1f,700000: TOMATILLO PCI Bus Module ver[4:0]
> [   38.824654] /pci@1f,700000: PCI IO [io
> 0x7f601000000-0x7f601ffffff] offset 7f601000000
> [   38.824680] /pci@1f,700000: PCI MEM [mem
> 0x7f700000000-0x7f7ffffffff] offset 7f700000000
> [   38.824704] /pci@1f,700000: PCI MEM64 [mem
> 0x7f700000000-0x7f7ffffffff] offset 7f700000000
> [   38.826310] PCI: Scanning PBM /pci@1f,700000
> [   38.826479] schizo f0069c00: PCI host bridge to bus 0000:00
> [   38.826506] pci_bus 0000:00: root bus resource [io
> 0x7f601000000-0x7f601ffffff] (bus address [0x0000-0xffffff])
> [   38.826536] pci_bus 0000:00: root bus resource [mem
> 0x7f700000000-0x7f7ffffffff] (bus address [0x00000000-0xffffffff])
> [   38.826565] pci_bus 0000:00: root bus resource [mem
> 0x7f700000000-0x7f7ffffffff] (bus address [0x00000000-0xffffffff])
>

For overlapping, please check attached patch that should fix the problem.

Thanks

Yinghai
diff mbox

Patch

Subject: [PATCH] sparc/PCI: check overlapping mmio64 with mmio for root bus

Found one system have overlapping between mmio64 and mmio:

/pci@1d,700000: TOMATILLO PCI Bus Module ver[4:0]
/pci@1d,700000: PCI IO [io  0x7c601000000-0x7c601ffffff] offset 7c601000000
/pci@1d,700000: PCI MEM [mem 0x7c700000000-0x7c7ffffffff] offset 7c700000000
/pci@1d,700000: PCI MEM64 [mem 0x7c700000000-0x7c7ffffffff] offset 7c700000000
PCI: Scanning PBM /pci@1d,700000
schizo f00859d4: PCI host bridge to bus 0003:00
pci_bus 0003:00: root bus resource [io  0x7c601000000-0x7c601ffffff] (bus address [0x0000-0xffffff])
pci_bus 0003:00: root bus resource [mem 0x7c700000000-0x7c7ffffffff] (bus address [0x00000000-0xffffffff])
pci_bus 0003:00: root bus resource [mem 0x7c700000000-0x7c7ffffffff] (bus address [0x00000000-0xffffffff])

so add checking for overlapping, and skip that mem64.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 arch/sparc/kernel/pci_common.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Index: linux-2.6/arch/sparc/kernel/pci_common.c
===================================================================
--- linux-2.6.orig/arch/sparc/kernel/pci_common.c
+++ linux-2.6/arch/sparc/kernel/pci_common.c
@@ -483,12 +483,17 @@  void pci_determine_mem_io_space(struct p
 			if (mem64_offset != pbm->mem_offset)
 				panic("mem offset %llx != mem64 offset %llx\n",
 					pbm->mem_offset, mem64_offset);
+			if (pbm->mem64_space.start <= pbm->mem_space.end)
+				pbm->mem64_space.start = pbm->mem_space.end + 1;
+			if (pbm->mem64_space.start > pbm->mem64_space.end)
+				pbm->mem64_space.flags = 0;
 		} else
 			pbm->mem_offset = mem64_offset;
+	}
 
+	if (pbm->mem64_space.flags)
 		printk("%s: PCI MEM64 %pR offset %llx\n",
 		       pbm->name, &pbm->mem64_space, pbm->mem_offset);
-	}
 
 	pbm->io_space.name = pbm->mem_space.name = pbm->name;
 	pbm->mem64_space.name = pbm->name;