]>
Commit | Line | Data |
---|---|---|
d33cec38 GKH |
1 | From 3943af9d01e94330d0cfac6fccdbc829aad50c92 Mon Sep 17 00:00:00 2001 |
2 | From: Sergey Miroshnichenko <s.miroshnichenko@yadro.com> | |
3 | Date: Tue, 12 Mar 2019 15:05:48 +0300 | |
4 | Subject: PCI: pciehp: Ignore Link State Changes after powering off a slot | |
5 | ||
6 | From: Sergey Miroshnichenko <s.miroshnichenko@yadro.com> | |
7 | ||
8 | commit 3943af9d01e94330d0cfac6fccdbc829aad50c92 upstream. | |
9 | ||
10 | During a safe hot remove, the OS powers off the slot, which may cause a | |
11 | Data Link Layer State Changed event. The slot has already been set to | |
12 | OFF_STATE, so that event results in re-enabling the device, making it | |
13 | impossible to safely remove it. | |
14 | ||
15 | Clear out the Presence Detect Changed and Data Link Layer State Changed | |
16 | events when the disabled slot has settled down. | |
17 | ||
18 | It is still possible to re-enable the device if it remains in the slot | |
19 | after pressing the Attention Button by pressing it again. | |
20 | ||
21 | Fixes the problem that Micah reported below: an NVMe drive power button may | |
22 | not actually turn off the drive. | |
23 | ||
24 | Link: https://bugzilla.kernel.org/show_bug.cgi?id=203237 | |
25 | Reported-by: Micah Parrish <micah.parrish@hpe.com> | |
26 | Tested-by: Micah Parrish <micah.parrish@hpe.com> | |
27 | Signed-off-by: Sergey Miroshnichenko <s.miroshnichenko@yadro.com> | |
28 | [bhelgaas: changelog, add bugzilla URL] | |
29 | Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> | |
30 | Reviewed-by: Lukas Wunner <lukas@wunner.de> | |
31 | Cc: stable@vger.kernel.org # v4.19+ | |
32 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
33 | ||
34 | --- | |
35 | drivers/pci/hotplug/pciehp_ctrl.c | 4 ++++ | |
36 | 1 file changed, 4 insertions(+) | |
37 | ||
38 | --- a/drivers/pci/hotplug/pciehp_ctrl.c | |
39 | +++ b/drivers/pci/hotplug/pciehp_ctrl.c | |
40 | @@ -117,6 +117,10 @@ static void remove_board(struct slot *p_ | |
41 | * removed from the slot/adapter. | |
42 | */ | |
43 | msleep(1000); | |
44 | + | |
45 | + /* Ignore link or presence changes caused by power off */ | |
46 | + atomic_and(~(PCI_EXP_SLTSTA_DLLSC | PCI_EXP_SLTSTA_PDC), | |
47 | + &ctrl->pending_events); | |
48 | } | |
49 | ||
50 | /* turn off Green LED */ |