Resizing a PCI device's BAR at runtime?

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

 



I have several devices which can resize their BARs at runtime (e.g. an
FPGA which, after being programmed, will add new BARs and/or resize one of
the existing BARs).

However, I have been unable to get the kernel to resize the resources
allocated to the device at run time. For example, this is a typical
situation:

System comes up, enumerates device. Device currently exposes only BAR0, at
some size (say 64k)
System programs device via BAR0.
Device changes its PCI configuration space header to indicate that BAR1 is
now valid, for a size of 128k
System code calls the kernel to rescan (e.g. pci_scan_slot()).

In this case the kernel will sometimes allocate resources for BAR1.

However, consider this case:


System comes up, enumerates device. Device currently exposes BAR0, at some
size (say 64k), and BAR1, at some other size (say 128k)
System programs device via BAR0.
Device changes its PCI configuration space header to indicate that BAR1 
now 256k
System code calls the kernel to rescan (e.g. pci_scan_slot()).

In this case I cannot get the kernel to resize the resources/sysfs
attributes/etc. of BAR1 to take the new size.

I've tried releasing the resources. If I shut the PCI device down, then my
driver gets turned off (not good).

Is there any way to tell the kernel "things have changed on the hardware,
rescan, but DON'T destroy the device driver - it knows how to deal with
this!"

I realize that in some situations it may not be possible to reallocate
resources (e.g. upstream bridges don't have the space) - assume for the
moment that's not a problem.


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