Skip to content

Commit 9d7db4d

Browse files
Feng Tangbjorn-helgaas
authored andcommitted
PCI/portdrv: Only disable pciehp interrupts early when needed
Firmware developers reported that Linux issues two PCIe hotplug commands in very short intervals on an ARM server, which doesn't comply with the PCIe spec. According to PCIe r6.1, sec 6.7.3.2, if the Command Completed event is supported, software must wait for a command to complete or wait at least 1 second before sending a new command. In the failure case, the first PCIe hotplug command is from get_port_device_capability(), which sends a command to disable PCIe hotplug interrupts without waiting for its completion, and the second command comes from pcie_enable_notification() of pciehp driver, which enables hotplug interrupts again. Fix this by only disabling the hotplug interrupts when the pciehp driver is not enabled. Link: https://lore.kernel.org/r/[email protected] Fixes: 2bd50dd ("PCI: PCIe: Disable PCIe port services during port initialization") Suggested-by: Lukas Wunner <[email protected]> Signed-off-by: Feng Tang <[email protected]> [bhelgaas: commit log] Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Lukas Wunner <[email protected]> Reviewed-by: Kuppuswamy Sathyanarayanan <[email protected]>
1 parent cc973ef commit 9d7db4d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/pci/pcie/portdrv.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,12 @@ static int get_port_device_capability(struct pci_dev *dev)
228228

229229
/*
230230
* Disable hot-plug interrupts in case they have been enabled
231-
* by the BIOS and the hot-plug service driver is not loaded.
231+
* by the BIOS and the hot-plug service driver won't be loaded
232+
* to handle them.
232233
*/
233-
pcie_capability_clear_word(dev, PCI_EXP_SLTCTL,
234-
PCI_EXP_SLTCTL_CCIE | PCI_EXP_SLTCTL_HPIE);
234+
if (!IS_ENABLED(CONFIG_HOTPLUG_PCI_PCIE))
235+
pcie_capability_clear_word(dev, PCI_EXP_SLTCTL,
236+
PCI_EXP_SLTCTL_CCIE | PCI_EXP_SLTCTL_HPIE);
235237
}
236238

237239
#ifdef CONFIG_PCIEAER

0 commit comments

Comments
 (0)