Skip to content

Commit c7410ef

Browse files
thomastaioracleBrian Maly
authored andcommitted
PCI: pciehp: Add quirk to handle spurious DLLSC on a x4x4 SSD
When an Intel P5608 SSD is bifurcated into x4x4 mode, and the upstream ports both support hotplugging on each respective x4 device, a slot management system for the SSD requires both x4 slots to have power removed via sysfs (echo 0 > slot/N/power), from the OS before it can safely turn-off physical power for the whole x8 device. The implications are that slot status will display powered off and link inactive statuses for the x4 devices where the devices are actually powered until both ports have powered off. The issue with the SSD manifests when power is removed from the first-half and then the second-half. During the first-half removal, slot status shows the slot as powered-down and link-inactive, while internal power and link remain active while waiting for the second-half to have power removed. When power is then removed from the second-half, the first-half starts shutdown sequence and will trigger a DLLSC event. This is misinterpreted as an enabling event and causes the first-half to be re-enabled. The spurious enable can be resolved by ignoring link status change events when no link is active when in the off state. This patch adds a quirk for specific P5608 SSDs which have been tested for compatibility. Signed-off-by: Jon Derrick <[email protected]> Signed-off-by: James Puthukattukaran <[email protected]> Orabug: 34358323 Signed-off-by: Thomas Tai <[email protected]> Reviewed-by: John Donnelly <[email protected]> Reviewed-by: Jack Vogel <[email protected]> Reviewed-by: Henry Willard <[email protected]> Signed-off-by: Brian Maly <[email protected]>
1 parent d5cb4db commit c7410ef

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

drivers/pci/hotplug/pciehp_ctrl.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ void pciehp_handle_disable_request(struct controller *ctrl)
225225
void pciehp_handle_presence_or_link_change(struct controller *ctrl, u32 events)
226226
{
227227
int present, link_active;
228+
struct pci_dev *pdev = ctrl->pcie->port;
228229

229230
/*
230231
* If the slot is on and presence or link has changed, turn it off.
@@ -265,6 +266,13 @@ void pciehp_handle_presence_or_link_change(struct controller *ctrl, u32 events)
265266
cancel_delayed_work(&ctrl->button_work);
266267
/* fall through */
267268
case OFF_STATE:
269+
/* Look at comment for quirk_shared_slot function */
270+
if (pdev->shared_pcc_and_link_slot &&
271+
(events & PCI_EXP_SLTSTA_DLLSC) && !link_active) {
272+
mutex_unlock(&ctrl->state_lock);
273+
pdev->shared_pcc_and_link_slot = false;
274+
break;
275+
}
268276
ctrl->state = POWERON_STATE;
269277
mutex_unlock(&ctrl->state_lock);
270278
if (present)

drivers/pci/quirks.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6037,3 +6037,37 @@ static void quirk_cavium_xcp0_bar_fixup(struct pci_dev *dev)
60376037
}
60386038
}
60396039
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CAVIUM, 0xa067, quirk_cavium_xcp0_bar_fixup);
6040+
6041+
#ifdef CONFIG_HOTPLUG_PCI_PCIE
6042+
/*
6043+
* This is an Intel NVMe SSD which sits in a x8 pciehp slot but is bifurcated
6044+
* as a x4x4 and manifests as two slots with respect to PCIe hot plug register
6045+
* states. However, the hotplug controller treats these slots as a single x8
6046+
* slot for link and power. Either one of the two slots can be powered down
6047+
* separately and the slot status will show negative power and link states, but
6048+
* internal power and link will be active until the last of the two slots is
6049+
* powered down. When the last of the two x4 slots is turned off, power and
6050+
* link will be turned off for the x8 slot by the HP controller. This
6051+
* configuration causes some interesting behavior in bringup sequence
6052+
*
6053+
* When the second slot is powered off to remove the card, this will cause the
6054+
* link to go down for both x4 slots. So, the x4 that is already powered down
6055+
* earlier will see a DLLSC event and attempt to bring itself up (card present,
6056+
* link change event, link state is down). Special handling is required in
6057+
* pciehp_handle_presence_or_link_change to prevent this unintended bring up
6058+
*/
6059+
static void quirk_shared_pcc_and_link_slot(struct pci_dev *pdev)
6060+
{
6061+
struct pci_dev *parent = pci_upstream_bridge(pdev);
6062+
6063+
if (parent && pdev->subsystem_vendor == 0x108e) {
6064+
switch (pdev->subsystem_device) {
6065+
/* P5608 */
6066+
case 0x487d:
6067+
case 0x488d:
6068+
parent->shared_pcc_and_link_slot = 1;
6069+
}
6070+
}
6071+
}
6072+
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0b60, quirk_shared_pcc_and_link_slot);
6073+
#endif /* CONFIG_HOTPLUG_PCI_PCIE */

include/linux/pci.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,9 @@ struct pci_dev {
329329
u8 msi_cap; /* MSI capability offset */
330330
u8 msix_cap; /* MSI-X capability offset */
331331
u8 pcie_mpss:3; /* PCIe Max Payload Size Supported */
332+
#ifdef CONFIG_HOTPLUG_PCI_PCIE
333+
UEK_KABI_FILL_HOLE(u8 shared_pcc_and_link_slot:1) /* two "slots" sharing link/power */
334+
#endif
332335
u8 rom_base_reg; /* Config register controlling ROM */
333336
u8 pin; /* Interrupt pin this device uses */
334337
u16 pcie_flags_reg; /* Cached PCIe Capabilities Register */

0 commit comments

Comments
 (0)