On Tue, Dec 8, 2009 at 11:22 PM, Erez Shitrit <erezsh@xxxxxxxxxxxxxx> wrote: > Hi Scott, > > We are working on InfiniBand device that supports SR-IOV. > and lately (from version 2.6.32 ) we faced a problem: > When the driver tried to enable SR-IOV it failed to allocate resources > for the 2 BARS the device needs. > The situation is when there are 2 BARS (64 bits), the first asks for > little amount of memory and the second asks for much larger amount of > memory. > In the code I saw (drivers/pci/iov.c) that the order of the allocation > starts from the first BAR to the last. > > The code: > for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) { > res = iov->res + i; > if (!res->flags) > continue; > rc = pci_assign_resource(dev, i + PCI_IOV_RESOURCES); > > This process failed for the second BAR (The big one). (in the log: "not > enough MMIO resources for SR-IOV") > > I think (IMHO) it because the allocation of the first BAR (the little) > one was from the allocated slot of the big one (the allocation from the > sriov_init function) and when the kernel tries to allocate the slot for > he second BAR (the big one) in the place of the little one it failed > (there is not enough memory there). > > when I changed the code to start the allocation from the last to the > first: > (for i = PCI_SRIOV_NUM_BARS; i >= 0; i--) > > It works fine. > > Is it a bug? > which tree? can not find related code. that range should be handled be pci_assign_unassigned_resources(), and already include sort etc.. can you try pci-next tree? YH -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html