linux-stable/drivers/pci
Lukas Wunner 464da38ba8 PCI: pciehp: Fix infinite loop in IRQ handler upon power fault
commit 23584c1ed3 upstream.

The Power Fault Detected bit in the Slot Status register differs from
all other hotplug events in that it is sticky:  It can only be cleared
after turning off slot power.  Per PCIe r5.0, sec. 6.7.1.8:

  If a power controller detects a main power fault on the hot-plug slot,
  it must automatically set its internal main power fault latch [...].
  The main power fault latch is cleared when software turns off power to
  the hot-plug slot.

The stickiness used to cause interrupt storms and infinite loops which
were fixed in 2009 by commits 5651c48cfa ("PCI pciehp: fix power fault
interrupt storm problem") and 99f0169c17 ("PCI: pciehp: enable
software notification on empty slots").

Unfortunately in 2020 the infinite loop issue was inadvertently
reintroduced by commit 8edf5332c3 ("PCI: pciehp: Fix MSI interrupt
race"):  The hardirq handler pciehp_isr() clears the PFD bit until
pciehp's power_fault_detected flag is set.  That happens in the IRQ
thread pciehp_ist(), which never learns of the event because the hardirq
handler is stuck in an infinite loop.  Fix by setting the
power_fault_detected flag already in the hardirq handler.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=214989
Link: https://lore.kernel.org/linux-pci/DM8PR11MB5702255A6A92F735D90A4446868B9@DM8PR11MB5702.namprd11.prod.outlook.com
Fixes: 8edf5332c3 ("PCI: pciehp: Fix MSI interrupt race")
Link: https://lore.kernel.org/r/66eaeef31d4997ceea357ad93259f290ededecfd.1637187226.git.lukas@wunner.de
Reported-by: Joseph Bao <joseph.bao@intel.com>
Tested-by: Joseph Bao <joseph.bao@intel.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: stable@vger.kernel.org # v4.19+
Cc: Stuart Hayes <stuart.w.hayes@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-05 12:35:36 +01:00
..
controller PCI: pci-bridge-emul: Correctly set PCIe capabilities 2022-01-27 09:19:50 +01:00
endpoint PCI: endpoint: Fix missing destroy_workqueue() 2021-05-19 10:08:25 +02:00
hotplug PCI: pciehp: Fix infinite loop in IRQ handler upon power fault 2022-02-05 12:35:36 +01:00
pcie PCI/portdrv: Enable Bandwidth Notification only if port supports it 2021-09-22 12:26:22 +02:00
switch
Kconfig
Makefile
access.c
ats.c
bus.c
ecam.c PCI/ACPI: Add Ampere Altra SOC MCFG quirk 2021-09-26 14:07:05 +02:00
host-bridge.c
iov.c PCI/IOV: Mark VFs as not implementing PCI_COMMAND_MEMORY 2020-10-29 09:57:54 +01:00
irq.c
mmap.c
msi.c PCI/MSI: Fix pci_irq_vector()/pci_irq_get_affinity() 2022-01-27 09:19:38 +01:00
of.c
p2pdma.c PCI/P2PDMA: Avoid pci_get_slot(), which may sleep 2021-07-20 16:10:47 +02:00
pci-acpi.c PM: ACPI: PCI: Drop acpi_pm_set_bridge_wakeup() 2020-12-30 11:51:32 +01:00
pci-bridge-emul.c PCI: pci-bridge-emul: Set PCI_STATUS_CAP_LIST for PCIe device 2022-01-27 09:19:50 +01:00
pci-bridge-emul.h PCI: pci-bridge-emul: Add PCIe Root Capabilities Register 2021-09-26 14:07:04 +02:00
pci-driver.c
pci-label.c PCI/sysfs: Fix dsm_label_utf16s_to_utf8s() buffer overrun 2021-07-20 16:10:49 +02:00
pci-mid.c
pci-pf-stub.c
pci-stub.c
pci-sysfs.c
pci.c PCI: Fix pci_dev_str_match_path() alloc while atomic bug 2021-09-22 12:26:44 +02:00
pci.h PCI: thunder: Fix compile testing 2021-05-22 11:38:28 +02:00
probe.c PCI: Fix pci_host_bridge struct device release/free handling 2021-10-06 15:42:38 +02:00
proc.c
quirks.c PCI: Add function 1 DMA alias quirk for Marvell 88SE9125 SATA controller 2022-01-27 09:19:28 +01:00
remove.c PCI: Fix pci_host_bridge struct device release/free handling 2021-10-06 15:42:38 +02:00
rom.c PCI: Use ioremap(), not phys_to_virt() for platform ROM 2020-10-01 13:17:51 +02:00
search.c
setup-bus.c
setup-irq.c
setup-res.c PCI: Decline to resize resources if boot config must be preserved 2021-03-04 10:26:10 +01:00
slot.c PCI: Fix pci_slot_release() NULL pointer dereference 2020-12-30 11:51:47 +01:00
syscall.c PCI: Return ~0 data on pciconfig_read() CAP_SYS_ADMIN failure 2021-09-22 12:26:22 +02:00
vc.c
vpd.c PCI: Allow VPD access for QLogic ISP2722 2021-05-14 09:44:12 +02:00
xen-pcifront.c