Re: [PATCH RFC v4 09/21] PCI: Mark immovable BARs with PCI_FIXED

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

 



On 3/27/19 8:03 PM, David Laight wrote:
> From: Bjorn Helgaas
>> Sent: 26 March 2019 20:29
>>
>> On Mon, Mar 11, 2019 at 04:31:10PM +0300, Sergey Miroshnichenko wrote:
>>> If a PCIe device driver doesn't yet have support for movable BARs,
>>> mark device's BARs with IORESOURCE_PCI_FIXED.
>>
>> I'm hesitant about using IORESOURCE_PCI_FIXED for this purpose.  That
>> was originally added to describe resources that can not be changed
>> because they're hardwired in the device, e.g., legacy resources and
>> Enhanced Allocation resources.
>>
>> In general, I think the bits in res->flags should tell us things about
>> the hardware.  This particular use would be something about the
>> *driver*, and I think we should figure that out by looking at
>> dev->driver.
> 
> There will also be drivers that don't support BARs being moved,
> but may be in a state (ie not actually open) where they can go
> through a remove-rescan sequence to allow the BAR be moved.
> 
> This might even be true if the open count is non-zero.
> 
> 	David
> 
> -
> Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
> Registration No: 1397386 (Wales)
> 

This approach with IORESOURCE_PCI_FIXED was used because struct resource doesn't have a
pointer to its device (and so to its driver). But now, after you have mentioned that, I
can see that in every place I use the FIXED flag to mark the immovable resources - also
has the according struct pci_dev *dev nearby.

So, replacing every

    if (r->flags & IORESOURCE_PCI_FIXED)

with

    if (!dev->driver->rescan_prepare)

or something like

    if (pci_dev_movable_bars_capable(dev))

will reduce this huge patchset a little, and also makes irrelevant the case I've
completely forgotten about - IORESOURCE_PCI_FIXED must be unset on removing (rmmod) the
"immovable" driver.

Thanks a lot! I'll rework the changes in this way and resend it as v5.

Serge



[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