]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.9.52/pci-pciehp-report-power-fault-only-once-until-we-clear-it.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.9.52 / pci-pciehp-report-power-fault-only-once-until-we-clear-it.patch
1 From 7612b3b28c0b900dcbcdf5e9b9747cc20a1e2455 Mon Sep 17 00:00:00 2001
2 From: Keith Busch <keith.busch@intel.com>
3 Date: Tue, 1 Aug 2017 03:11:52 -0400
4 Subject: PCI: pciehp: Report power fault only once until we clear it
5
6 From: Keith Busch <keith.busch@intel.com>
7
8 commit 7612b3b28c0b900dcbcdf5e9b9747cc20a1e2455 upstream.
9
10 When a power fault occurs, the power controller sets Power Fault Detected
11 in the Slot Status register, and pciehp_isr() queues an INT_POWER_FAULT
12 event to handle it.
13
14 It also clears Power Fault Detected, but since nothing has yet changed to
15 correct the power fault, the power controller will likely set it again
16 immediately, which may cause an infinite loop when pcie_isr() rechecks
17 Slot Status.
18
19 Fix that by masking off Power Fault Detected from new events if the driver
20 hasn't seen the power fault clear from the previous handling attempt.
21
22 Fixes: fad214b0aa72 ("PCI: pciehp: Process all hotplug events before looking for new ones")
23 Signed-off-by: Keith Busch <keith.busch@intel.com>
24 [bhelgaas: changelog, pull test out and add comment]
25 Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
26 Cc: Mayurkumar Patel <mayurkumar.patel@intel.com>
27 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
28
29 ---
30 drivers/pci/hotplug/pciehp_hpc.c | 8 ++++++++
31 1 file changed, 8 insertions(+)
32
33 --- a/drivers/pci/hotplug/pciehp_hpc.c
34 +++ b/drivers/pci/hotplug/pciehp_hpc.c
35 @@ -586,6 +586,14 @@ static irqreturn_t pciehp_isr(int irq, v
36 events = status & (PCI_EXP_SLTSTA_ABP | PCI_EXP_SLTSTA_PFD |
37 PCI_EXP_SLTSTA_PDC | PCI_EXP_SLTSTA_CC |
38 PCI_EXP_SLTSTA_DLLSC);
39 +
40 + /*
41 + * If we've already reported a power fault, don't report it again
42 + * until we've done something to handle it.
43 + */
44 + if (ctrl->power_fault_detected)
45 + events &= ~PCI_EXP_SLTSTA_PFD;
46 +
47 if (!events)
48 return IRQ_NONE;
49