Re: Should a PCIe Link Down event set the PCI_DEV_DISCONNECTED bit?

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

 



On Thu, Jul 26, 2018 at 05:38:50PM -0500, Alex G. wrote:
> I was under the impression that a DLLSC or PDSC would trigger the
> PCI_DEV_DISCONNECTED bit to be set, blocking any further config access.

Only if the Presence Detect State bit in the Slot Status register is
not set.

I think the idea was that if the card is still in the slot, its driver can
be unbound orderly because the device is still accessible.  So there's no
need to set PCI_DEV_DISCONNECTED.

However if there is a already a new card in the slot, PCI_DEV_DISCONNECTED
will erroneously not be set.  Also, if card removal was triggered by the
link going down but the card is still in the slot, PCI_DEV_DISCONNECTED
will also erroneously not be set even though it's inaccessible.

The only situations when PCI_DEV_DISCONNECTED should not be set is if the
card is being removed by sysfs or by the user pressing the Attention Button.
Anything else is a surprise removal.  What we need to do is pass down a
flag to pciehp_unconfigure_device() to indicate whether one of those two
situations is at hand or not, and PCI_DEV_DISCONNECTED should be set
depending on that flag.

Are you testing Bjorn's pci/hotplug branch or something based on 4.18 or
earlier?  There is a major event handling rework queued on that branch,
so you may want to test with that.


> In the latter case, does it not make sense to have a separate bit to say
> "Don't touch this device"?

Hm, what would you need it for?

Thanks,

Lukas



[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