Re: PCI Express Hot-plug

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

 



On Mar 12, 2011, at 21:17, Greg KH wrote:

> On Sat, Mar 12, 2011 at 07:53:55PM -0600, David Hagood wrote:
>> On Sat, 2011-03-12 at 09:33 -0800, Greg KH 
>>> Ok, what was wrong with my response?  Was it not sufficient?
>> 
>> You mean, other than not actually supplying any sort of a suggest as to
>> how to generate the needed events, or supplying any direction to find
>> out how to generate the events, or actually giving any sort of positive
>> information?
>> 
>> Other than that, nothing was wrong.
> 
> Great, another satisfied customer :)
> 
> Seriously, this is well described in the PCI Hotplug spec from the
> PCI-SIG as to the fact that you need to have an external controller to
> handle the addition and removal of the PCI devices and cause the PCI bus
> rescaning.  There is a ACPI PCI hotplug spec that describes this.
> 
> If you don't want to use ACPI (which I don't blame you), you could
> emulate the old Compaq PCI Hotplug controller which was documented quite
> well and was a very simple device.
> 
> As for rescanning the bus, again, look at the fakephp driver for a quick
> and dirty way of doing this.  You can use that driver for embedded
> systems if you know when you want to rescan the bus, and it shows how to
> remove a PCI device from the system in a safe way.
> 
> Does that help?  If not, please ask specific questions as to the issues
> you have run into in trying one of the above methods out.
> 
> thanks,
> 
> greg k-h
> --
> 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
Ok, here are my conclusions. For my case, the answer really lies in two PCI subsystem APIs:
pci_rescan_bus (which I actually invoke from userspace: echo 1 > /sys/bus/pci/rescan)
pci_remove_bus_device(struct pci_dev* myDev) http://lxr.free-electrons.com/ident?i=pci_remove_bus_device

1. Here's my test environment: I booted my FPGA board connected and powered, I held back the FPGA programming using a soldered on switch wich holds it in reset.
2. Once booted fully, "lspci" doesn't show my PCI device.
3. Flip the switch, the FPGA gets programmed in a few ms.
4. echo 1 > /sys/bus/pci/rescan
5. lspci now shows my device.
6. I load my driver module and everything works like a charm.

To reprogram, from userspace, I simply "echo 1 > /sys/bus/pci/drivers/[MYMODULENAME]/[my device's PCI bus address]/remove and it's as if the device got hot-unplugged.

The I repeat steps 2-6 from above.

Now that I know this information, I can quite simply package a userspace FPGA firmware loader/reloader.

I'm a happy camper! Thanks for the leads Greg!
Cheers!

Jean-Francois Dagenais
Software Architect - B.Sc.A


Experience the new veo phased array flaw detector at www.sonatestveo.com.


Sonatest AP
2900 chemin des Quatre-Bourgeois
Bureau 305
Quebec City Quebec G1V 1Y4

T| +1 (418) 683 6222 x106   F| +1 (418) 683 7032   M|    W| www.sonatest.com



This message (and any associated files) is intended only for the use of greg@xxxxxxxxx, david.hagood@xxxxxxxxx, linux-pci@xxxxxxxxxxxxxxx and may contain information that is confidential, subject to copyright or constitutes a trade secret. If you are not the above recipient(s) you are hereby notified that any dissemination, copying or distribution of this message, or files associated with this message, is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer. Any views or opinions presented are solely those of the author and do not necessarily represent those of the company.

Think green - help the environment by not printing this email.
--
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