On Tue, May 31, 2011 at 11:17:45PM -0700, Yinghai Lu wrote: > On 05/31/2011 06:10 PM, Ben Hutchings wrote: > > > > In this configuration it can be ignored completely, but I don't think > > there's any generic way to determine that. I am tempted to say -- the platform is buggy, since it is asking for more resources than are available. Maybe we should provide a kernel command line flag to ignore sriov resources? > .... > > [PATCH] PCI: Make assign resource to unassigned SRIOV BAR to be optional > > make them into add list, so it will make other resource could get resource > allocation at first. > > still try to make several try with them by adding them into fail list. Under what scenario will a retry ever succeed? > > Signed-off-by: Yinghai Lu <yinghai@xxxxxxxxxx> > > --- > drivers/pci/setup-bus.c | 28 ++++++++++++++++++++++++---- > 1 file changed, 24 insertions(+), 4 deletions(-) > > Index: linux-2.6/drivers/pci/setup-bus.c > =================================================================== > --- linux-2.6.orig/drivers/pci/setup-bus.c > +++ linux-2.6/drivers/pci/setup-bus.c > @@ -120,13 +120,16 @@ static inline void reset_resource(struct > * resources > * @head : head of the list tracking requests with allocated > * resources > + * @fail_head : head of the list tracking requests failed to allocate > + * resources > * > * Walk through each element of the add_head and try to procure > * additional resources for the element, provided the element > * is in the head list. > */ > static void adjust_resources_sorted(struct resource_list_x *add_head, > - struct resource_list *head) > + struct resource_list *head, > + struct resource_list_x *fail_head) > { > struct resource *res; > struct resource_list_x *list, *tmp, *prev; > @@ -153,9 +156,17 @@ static void adjust_resources_sorted(stru > idx = res - &list->dev->resource[0]; > add_size=list->add_size; > if (!resource_size(res) && add_size) { > - res->end = res->start + add_size - 1; > - if(pci_assign_resource(list->dev, idx)) > + res->end = res->start + add_size - 1; > + if(pci_assign_resource(list->dev, idx)) { > +#ifdef CONFIG_PCI_IOV > + /* add to failed list for next loop */ > + if (fail_head && idx >= PCI_IOV_RESOURCES && > + idx <= PCI_IOV_RESOURCE_END) > + add_to_failed_list(fail_head, list->dev, > + res); > +#endif do we need this? if we cannot allocate them, just ignore them. Anyway its a nice-to-have resource. > reset_resource(res); > + } > } else if (add_size) { > adjust_resource(res, res->start, > resource_size(res) + add_size); > @@ -212,7 +223,7 @@ static void __assign_resources_sorted(st > /* Try to satisfy any additional nice-to-have resource > requests */ > if (add_head) > - adjust_resources_sorted(add_head, head); > + adjust_resources_sorted(add_head, head, fail_head); > free_list(resource_list, head); > } > > @@ -662,6 +673,15 @@ static int pbus_size_mem(struct pci_bus > if (r->parent || (r->flags & mask) != type) > continue; > r_size = resource_size(r); > +#ifdef CONFIG_PCI_IOV > + /* put SRIOV requested res to good to have list */ ---> nice-to-have > + if (add_head && i >= PCI_IOV_RESOURCES && > + i <= PCI_IOV_RESOURCE_END) { > + r->end = r->start - 1; > + add_to_list(add_head, dev, r, r_size); > + r_size = 0; > + } > +#endif > /* For bridges size != alignment */ > align = pci_resource_alignment(dev, r); > order = __ffs(align) - 20; I will try this patch on my setup and report back. Thanks, RP -- 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