WSL2-Linux-Kernel/drivers/pci/hotplug
Lukas Wunner 1db58c6584 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:38:56 +01:00
..
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile
TODO PCI: ibmphp: Fix double unmap of io_mem 2021-09-02 12:02:50 -05:00
acpi_pcihp.c PCI: Fix kernel-doc errors 2021-03-11 17:37:20 -06:00
acpiphp.h PCI: acpiphp: Fix whitespace issue 2021-04-16 14:32:18 -05:00
acpiphp_core.c
acpiphp_glue.c ACPI / hotplug / PCI: Fix reference count leak in enable_slot() 2021-04-08 11:04:18 -05:00
acpiphp_ibm.c
cpci_hotplug.h PCI: cpcihp: Declare cpci_debug in header file 2021-07-01 15:32:45 -05:00
cpci_hotplug_core.c
cpci_hotplug_pci.c PCI: cpcihp: Declare cpci_debug in header file 2021-07-01 15:32:45 -05:00
cpcihp_generic.c
cpcihp_zt5550.c
cpcihp_zt5550.h
cpqphp.h
cpqphp_core.c PCI: Fix kernel-doc formatting 2021-07-06 10:37:46 -05:00
cpqphp_ctrl.c PCI: Fix kernel-doc formatting 2021-07-06 10:37:46 -05:00
cpqphp_nvram.c PCI: cpqphp: Use DEFINE_SPINLOCK() for int15_lock 2021-04-14 15:24:10 -05:00
cpqphp_nvram.h
cpqphp_pci.c
cpqphp_sysfs.c
ibmphp.h
ibmphp_core.c
ibmphp_ebda.c PCI: ibmphp: Fix double unmap of io_mem 2021-09-02 12:02:50 -05:00
ibmphp_hpc.c
ibmphp_pci.c PCI: ibmphp: Remove unneeded break 2020-11-20 11:17:55 -06:00
ibmphp_res.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
pci_hotplug_core.c PCI/sysfs: Use sysfs_emit() and sysfs_emit_at() in "show" functions 2021-06-03 22:14:47 -05:00
pciehp.h PCI: pciehp: Use down_read/write_nested(reset_lock) to fix lockdep errors 2022-01-27 11:05:13 +01:00
pciehp_core.c PCI: pciehp: Use down_read/write_nested(reset_lock) to fix lockdep errors 2022-01-27 11:05:13 +01:00
pciehp_ctrl.c pci-v5.10-changes 2020-10-22 12:41:00 -07:00
pciehp_hpc.c PCI: pciehp: Fix infinite loop in IRQ handler upon power fault 2022-02-05 12:38:56 +01:00
pciehp_pci.c
pnv_php.c PCI: Change the type of probe argument in reset functions 2021-08-18 17:32:42 -05:00
rpadlpar.h
rpadlpar_core.c PCI: rpadlpar: Use for_each_child_of_node() and for_each_node_by_name() 2020-09-17 16:22:36 -05:00
rpadlpar_sysfs.c PCI/sysfs: Use sysfs_emit() and sysfs_emit_at() in "show" functions 2021-06-03 22:14:47 -05:00
rpaphp.h
rpaphp_core.c PCI: Use of_node_name_eq() for node name comparisons 2020-04-24 18:02:17 -05:00
rpaphp_pci.c powerpc/eeh: Make early EEH init pseries specific 2020-03-25 12:09:39 +11:00
rpaphp_slot.c
s390_pci_hpc.c s390/pci: fix zpci_zdev_put() on reserve 2021-10-04 09:49:10 +02:00
shpchp.h PCI: shpchp: Make shpchp_unconfigure_device() void 2020-05-21 15:23:20 -05:00
shpchp_core.c
shpchp_ctrl.c pci-v5.10-changes 2020-10-22 12:41:00 -07:00
shpchp_hpc.c PCI: shpchp: Remove unused shpc_writeb() 2021-04-16 11:22:24 -05:00
shpchp_pci.c PCI: shpchp: Make shpchp_unconfigure_device() void 2020-05-21 15:23:20 -05:00
shpchp_sysfs.c PCI/sysfs: Use sysfs_emit() and sysfs_emit_at() in "show" functions 2021-06-03 22:14:47 -05:00