diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2017-02-03 09:53:51 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2017-02-03 09:53:51 -0500 |
commit | d98e0929071e7ef63d35c1838b0ad0805ae366dd (patch) | |
tree | 6236bf3c424643e3b8b8904a879d4c695bcacfeb | |
parent | dfef358bd1beb4e7b5c94eca944be9cd23dfc752 (diff) |
Revert "PCI: pciehp: Add runtime PM support for PCIe hotplug ports"
This reverts commit 68db9bc814362e7f24371c27d12a4f34477d9356.
Yinghai reported that the following manual hotplug sequence:
# echo 0 > /sys/bus/pci/slots/8/power
# echo 1 > /sys/bus/pci/slots/8/power
worked in v4.9, but fails in v4.10-rc1, and that reverting 68db9bc81436
("PCI: pciehp: Add runtime PM support for PCIe hotplug ports") makes it
work again.
Fixes: 68db9bc81436 ("PCI: pciehp: Add runtime PM support for PCIe hotplug ports")
Link: https://lkml.kernel.org/r/CAE9FiQVCMCa7iVyuwp9z6VrY0cE7V_xghuXip28Ft52=8QmTWw@mail.gmail.com
Link: https://bugzilla.kernel.org/show_bug.cgi?id=193951
Reported-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r-- | drivers/pci/hotplug/pciehp_ctrl.c | 6 | ||||
-rw-r--r-- | drivers/pci/pci.c | 12 |
2 files changed, 6 insertions, 12 deletions
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index 10c9c0ba8ff2..ec0b4c11ccd9 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
32 | #include <linux/types.h> | 32 | #include <linux/types.h> |
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
34 | #include <linux/pm_runtime.h> | ||
35 | #include <linux/pci.h> | 34 | #include <linux/pci.h> |
36 | #include "../pci.h" | 35 | #include "../pci.h" |
37 | #include "pciehp.h" | 36 | #include "pciehp.h" |
@@ -99,7 +98,6 @@ static int board_added(struct slot *p_slot) | |||
99 | pciehp_green_led_blink(p_slot); | 98 | pciehp_green_led_blink(p_slot); |
100 | 99 | ||
101 | /* Check link training status */ | 100 | /* Check link training status */ |
102 | pm_runtime_get_sync(&ctrl->pcie->port->dev); | ||
103 | retval = pciehp_check_link_status(ctrl); | 101 | retval = pciehp_check_link_status(ctrl); |
104 | if (retval) { | 102 | if (retval) { |
105 | ctrl_err(ctrl, "Failed to check link status\n"); | 103 | ctrl_err(ctrl, "Failed to check link status\n"); |
@@ -120,14 +118,12 @@ static int board_added(struct slot *p_slot) | |||
120 | if (retval != -EEXIST) | 118 | if (retval != -EEXIST) |
121 | goto err_exit; | 119 | goto err_exit; |
122 | } | 120 | } |
123 | pm_runtime_put(&ctrl->pcie->port->dev); | ||
124 | 121 | ||
125 | pciehp_green_led_on(p_slot); | 122 | pciehp_green_led_on(p_slot); |
126 | pciehp_set_attention_status(p_slot, 0); | 123 | pciehp_set_attention_status(p_slot, 0); |
127 | return 0; | 124 | return 0; |
128 | 125 | ||
129 | err_exit: | 126 | err_exit: |
130 | pm_runtime_put(&ctrl->pcie->port->dev); | ||
131 | set_slot_off(ctrl, p_slot); | 127 | set_slot_off(ctrl, p_slot); |
132 | return retval; | 128 | return retval; |
133 | } | 129 | } |
@@ -141,9 +137,7 @@ static int remove_board(struct slot *p_slot) | |||
141 | int retval; | 137 | int retval; |
142 | struct controller *ctrl = p_slot->ctrl; | 138 | struct controller *ctrl = p_slot->ctrl; |
143 | 139 | ||
144 | pm_runtime_get_sync(&ctrl->pcie->port->dev); | ||
145 | retval = pciehp_unconfigure_device(p_slot); | 140 | retval = pciehp_unconfigure_device(p_slot); |
146 | pm_runtime_put(&ctrl->pcie->port->dev); | ||
147 | if (retval) | 141 | if (retval) |
148 | return retval; | 142 | return retval; |
149 | 143 | ||
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index a881c0d3d2e8..7904d02ffdb9 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -2241,10 +2241,13 @@ bool pci_bridge_d3_possible(struct pci_dev *bridge) | |||
2241 | return false; | 2241 | return false; |
2242 | 2242 | ||
2243 | /* | 2243 | /* |
2244 | * Hotplug ports handled by firmware in System Management Mode | 2244 | * Hotplug interrupts cannot be delivered if the link is down, |
2245 | * so parents of a hotplug port must stay awake. In addition, | ||
2246 | * hotplug ports handled by firmware in System Management Mode | ||
2245 | * may not be put into D3 by the OS (Thunderbolt on non-Macs). | 2247 | * may not be put into D3 by the OS (Thunderbolt on non-Macs). |
2248 | * For simplicity, disallow in general for now. | ||
2246 | */ | 2249 | */ |
2247 | if (bridge->is_hotplug_bridge && !pciehp_is_native(bridge)) | 2250 | if (bridge->is_hotplug_bridge) |
2248 | return false; | 2251 | return false; |
2249 | 2252 | ||
2250 | if (pci_bridge_d3_force) | 2253 | if (pci_bridge_d3_force) |
@@ -2276,10 +2279,7 @@ static int pci_dev_check_d3cold(struct pci_dev *dev, void *data) | |||
2276 | !pci_pme_capable(dev, PCI_D3cold)) || | 2279 | !pci_pme_capable(dev, PCI_D3cold)) || |
2277 | 2280 | ||
2278 | /* If it is a bridge it must be allowed to go to D3. */ | 2281 | /* If it is a bridge it must be allowed to go to D3. */ |
2279 | !pci_power_manageable(dev) || | 2282 | !pci_power_manageable(dev)) |
2280 | |||
2281 | /* Hotplug interrupts cannot be delivered if the link is down. */ | ||
2282 | dev->is_hotplug_bridge) | ||
2283 | 2283 | ||
2284 | *d3cold_ok = false; | 2284 | *d3cold_ok = false; |
2285 | 2285 | ||