aboutsummaryrefslogtreecommitdiff
path: root/core/pcie-slot.c
diff options
context:
space:
mode:
authorGavin Shan <gwshan@linux.vnet.ibm.com>2017-02-20 10:57:46 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-02-22 16:51:17 +1100
commitb03d75da4a7f1211e59166115ec66d1dd674fbad (patch)
tree312a827cebf26f32c3d4e76dec4c1f961a08d70a /core/pcie-slot.c
parent0f5e4b02909819420da3307fb20ef69927570b03 (diff)
downloadskiboot-b03d75da4a7f1211e59166115ec66d1dd674fbad.zip
skiboot-b03d75da4a7f1211e59166115ec66d1dd674fbad.tar.gz
skiboot-b03d75da4a7f1211e59166115ec66d1dd674fbad.tar.bz2
core/pci: More reliable way to update PCI slot power state
The power control bit (SLOT_CTL, offset: PCIe cap + 0x18) isn't reliable enough to reflect the PCI slot's power state. Instead, the power indication bits are more reliable comparatively. This leads to mismatch between the cached power state and PCI slot's presence state, resulting in the hotplug driver in kernel refuses to unplug the devices properly on the request. The issue was found on below NVMe card on "supermicro,p8dtu2u" machine. We don't have this issue on the integrated PLX 8718 switch. # lspci 0022:01:00.0 PCI bridge: PLX Technology, Inc. PEX 9733 33-lane, \ 9-port PCI Express Gen 3 (8.0 GT/s) Switch (rev aa) 0022:02:01.0 PCI bridge: PLX Technology, Inc. PEX 9733 33-lane, \ 9-port PCI Express Gen 3 (8.0 GT/s) Switch (rev aa) 0022:02:04.0 PCI bridge: PLX Technology, Inc. PEX 9733 33-lane, \ 9-port PCI Express Gen 3 (8.0 GT/s) Switch (rev aa) 0022:02:05.0 PCI bridge: PLX Technology, Inc. PEX 9733 33-lane, \ 9-port PCI Express Gen 3 (8.0 GT/s) Switch (rev aa) 0022:02:06.0 PCI bridge: PLX Technology, Inc. PEX 9733 33-lane, \ 9-port PCI Express Gen 3 (8.0 GT/s) Switch (rev aa) 0022:02:07.0 PCI bridge: PLX Technology, Inc. PEX 9733 33-lane, \ 9-port PCI Express Gen 3 (8.0 GT/s) Switch (rev aa) 0022:17:00.0 Non-Volatile memory controller: Device 19e5:0123 (rev 45) This updates the cached PCI slot's power state using the power indication bits instead of power control bit, to fix above issue. Cc: stable #5.4.0+ Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core/pcie-slot.c')
-rw-r--r--core/pcie-slot.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/pcie-slot.c b/core/pcie-slot.c
index 11354ed..eb8a02c 100644
--- a/core/pcie-slot.c
+++ b/core/pcie-slot.c
@@ -454,7 +454,7 @@ struct pci_slot *pcie_slot_create(struct phb *phb, struct pci_device *pd)
if (pd && ecap) {
pci_cfg_read16(phb, pd->bdfn,
ecap + PCICAP_EXP_SLOTCTL, &slot_ctl);
- if (slot_ctl & PCICAP_EXP_SLOTCTL_PWRCTLR)
+ if (((slot_ctl & PCICAP_EXP_SLOTCTL_PWRI) >> 8) == PCIE_INDIC_OFF)
slot->power_state = PCI_SLOT_POWER_OFF;
}
}