Re: Skipping IOV BARs in pci_enable_device()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 .../...

> > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> > index 4e84fd4..17b651e 100644
> > --- a/drivers/pci/pci.c
> > +++ b/drivers/pci/pci.c
> > @@ -1126,9 +1126,14 @@ static int __pci_enable_device_flags(struct pci_dev *dev,
> >   	if (atomic_add_return(1,&dev->enable_cnt)>  1)
> >   		return 0;		/* already enabled */
> >
> > -	for (i = 0; i<  DEVICE_COUNT_RESOURCE; i++)
> > +	for (i = 0; i<  DEVICE_COUNT_RESOURCE; i++) {
> > +#ifdef CONFIG_PCI_IOV
> > +		if (i>= PCI_IOV_RESOURCES&&  i<= PCI_IOV_RESOURCE_END)
> > +			continue;
> > +#endif
> >   		if (dev->resource[i].flags&  flags)
> >   			bars |= (1<<  i);
> > +	}
> >
> >   	err = do_pci_enable_device(dev, bars);
> >   	if (err<  0)
> >

 .../...

> You're talking about what is essentially (or should be) a runtime 
> decision, but the patch presents a compile-time decision...

No not really. The patch does a runtime decision but the constant
PCI_IOV_RESOURCES and PCI_IOV_RESOURCE_END aren't defined if
CONFIG_PCI_IOV isn't set (ie we never have an IOV BAR in the
list without that CONFIG_).

The runtime decision is to skip the BAR validity check for the IOV BARs
(which are always at the same index) in pci_enable_device, since a
failure to allocate/assign that BAR shouldn't prevent the device from
operating normally as long as you don't try to create VFs.

Cheers,
Ben.


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


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux