Re: Hot add a PCIe device driver upon hotplug event

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

 



On Thu, Jan 22, 2015 at 8:35 AM, Paulo Fortuna Carvalho
<pricardofc@xxxxxxxxx> wrote:
> Hello Bjorn,
> I can add and remove an ATCA card with a PCIExpress endpoint.
> UDEV device manager runs hotplug scripts ok and device files are created and
> removed from system accdordingly.
> Im trying now to run a script that on remove kills running applications
> using a certain device before it is removed from system.
> To do so I implement in my .rules file an entry regarding "remove" that
> calls a script to perform that task.
> My problem is that before script runs the device node is no longer there and
> my system crashes.
> Do you have any idea on how can run my script stopping the applciations
> before device remove procedure occurs?

If I understand correctly, you want to run a script while your device
is still in the system, *before* it is removed.  I'm not familiar with
the ATCA hotplug slot details.  What event would trigger the script to
run?  Is there an attention button used to request card removal?  Is
there a sysfs or similar software interface to request removal?

> 2015-01-12 16:58 GMT+00:00 Bjorn Helgaas <bhelgaas@xxxxxxxxxx>:
>>
>> On Mon, Jan 12, 2015 at 5:42 AM, Paulo Fortuna Carvalho
>> <pricardofc@xxxxxxxxx> wrote:
>> > Hello,
>> > I want to automatically load/unload a PCIe device driver when a card
>> > is inserted/removed from the system. I can see in the system logger
>> > with dmesg that the interrupt event is captured and acknowledged by
>> > the pciehp hotplug service driver.
>> > What I want to do next is that the operating system load/unload the
>> > corresponding PCIe device driver for that card.
>>
>> When pciehp receives the interrupt, it should enumerate the device,
>> and you should see a line in dmesg similar to this (of course, it will
>> have different bus/device/function and different vendor/device IDs):
>>
>>   pci 0000:00:16.0: [8086:9c3a] type 00 class 0x078000
>>
>> The PCI core should then add the device using device_add(), and part
>> of that is to emit a uevent, which can be read by user-space.
>> Generally udev would handle the event and load the appropriate driver.
>> I don't know the details of how the user-space side works.
>>
>> Bjorn
>
>
--
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