diff options
author | Gavin Shan <gwshan@linux.vnet.ibm.com> | 2017-02-20 10:57:48 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-02-22 16:51:18 +1100 |
commit | 73420cce2c6964a6db8e46962c876163a9caa371 (patch) | |
tree | 2cdef2023482340e6d05c7dd08330a86b17aaa2f | |
parent | 9e3c7ee4086fc9123134209aebcecd0c1f95e2ca (diff) | |
download | skiboot-73420cce2c6964a6db8e46962c876163a9caa371.zip skiboot-73420cce2c6964a6db8e46962c876163a9caa371.tar.gz skiboot-73420cce2c6964a6db8e46962c876163a9caa371.tar.bz2 |
core/pci: Enforce polling PCIe link in hot-add path
In surprise hot-add path, the power state isn't changed on hardware.
Instead, we set the cached power state (@slot->power_state) and
return OPAL_SUCCESS. The upper layer starts the PCI probing immediately
when receiving OPAL_SUCCESS. However, the PCIe link behind the PCI
slot is likely down. Nothing will be probed from the PCI slot even
we do have PCI adpater connected to the slot.
This fixes the issue by returning OPAL_ASYNC_COMPLETION to force
upper layer to poll the PCIe link before probing the PCI devices
behind the slot in surprise and managed hot-add paths.
Cc: stable # 5.4.0+
Fixes: 51931bad325 ("core/pci: Claim surprise hotplug capability")
Reported-by: Hank Chang <hankmax0000@gmail.com>
Signed-off-by: Gavin Shan <gwhsan@linux.vnet.ibm.com>
Tested-by: Willie Liauw <williel@supermicro.com.tw>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | core/pcie-slot.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/pcie-slot.c b/core/pcie-slot.c index defb66a..de2d5a5 100644 --- a/core/pcie-slot.c +++ b/core/pcie-slot.c @@ -218,9 +218,23 @@ static int64_t pcie_slot_set_power_state_ext(struct pci_slot *slot, uint8_t val, /* The power supply to the slot should be always on when surprise * hotplug is claimed. For this case, update with the requested * power state and bail immediately. + * + * The PCIe link is likely down if we're powering on the slot upon + * the detected presence. Nothing behind the slot will be probed if + * we do it immediately even we do have PCI devices connected to the + * slot. For this case, we force upper layer to wait for the PCIe + * link to be up before probing the PCI devices behind the slot. It's + * only concerned in surprise hotplug path. In managed hot-add path, + * the PCIe link should have been ready before we power on the slot. + * However, it's not harmful to do so in managed hot-add path. */ if (surprise_check && slot->surprise_pluggable) { slot->power_state = val; + if (val == PCI_SLOT_POWER_ON) { + pci_slot_set_state(slot, PCI_SLOT_STATE_SPOWER_DONE); + return OPAL_ASYNC_COMPLETION; + } + return OPAL_SUCCESS; } |