On Sat, Dec 7, 2013 at 8:19 PM, Yinghai Lu <yinghai@xxxxxxxxxx> wrote: > On Sat, Dec 7, 2013 at 10:35 AM, Bjorn Helgaas <bhelgaas@xxxxxxxxxx> wrote: >> >> This doesn't sound like a chipset bug. It sounds like exactly what >> the spec describes: "Presence Detect State – This bit indicates the >> presence of an adapter in the slot, reflected by the logical “OR” of >> the Physical Layer in-band presence detect mechanism and, if present, >> any out-of-band presence detect mechanism defined for the slot’s >> corresponding form factor" (PCIe 3.0, sec 7.8.11). > > Not sure. the silicon does not report in-band correctly if we turn off > pcie link before turn the power of card. Yes, that's exactly what the spec says: "Note that the in-band presence detect mechanism requires that power be applied to an adapter for its presence to be detected." So pciehp has to be designed to take that into account. Presence detect is obviously important for things like ExpressCard where there's no attention button. I expect that pciehp will use presence detect to notice when a device is inserted and removed. But I assume your hotplug situation is slots with attention buttons, and I don't think presence detect is as important there. If you insert a card into an empty slot, nothing should happen until the attention button is pressed. We don't need presence detect there. If pciehp turns off a device to prepare for its physical removal, why do we care about presence detect after the power is turned off? I think all pciehp can say is "this slot is powered off, and I don't know whether there's still a card in it." I think pciehp is somewhat buggy here -- it looks like pciehp_enable_slot() looks at presence detect before turning on the power. I don't know why it does that, and it doesn't seem valid per the spec statement I quoted above. Bjorn -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html