[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231213182656.6165-3-mario.limonciello@amd.com>
Date: Wed, 13 Dec 2023 12:26:56 -0600
From: Mario Limonciello <mario.limonciello@....com>
To: Bjorn Helgaas <bhelgaas@...gle.com>,
"Rafael J . Wysocki" <rjw@...ysocki.net>
CC: <linux-pci@...r.kernel.org>, <linux-acpi@...r.kernel.org>,
<linux-kernel@...r.kernel.org>,
Mario Limonciello <mario.limonciello@....com>,
<mpearson-lenovo@...ebb.ca>
Subject: [PATCH 2/2] PCI/portdrv: Place PCIe port hierarchy into D3cold at shutdown
When a system is being powered off it's important that PCIe ports
have been put into D3cold as there is no other software to turn
off the devices at S5.
If PCIe ports are left in D0 then any GPIOs toggled by the ACPI
power resources may be left enabled and devices may consume excess
power.
Cc: mpearson-lenovo@...ebb.ca
Signed-off-by: Mario Limonciello <mario.limonciello@....com>
---
drivers/pci/pcie/portdrv.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/pci/pcie/portdrv.c b/drivers/pci/pcie/portdrv.c
index 14a4b89a3b83..08238680c481 100644
--- a/drivers/pci/pcie/portdrv.c
+++ b/drivers/pci/pcie/portdrv.c
@@ -734,9 +734,14 @@ static void pcie_portdrv_remove(struct pci_dev *dev)
static void pcie_portdrv_shutdown(struct pci_dev *dev)
{
if (pci_bridge_d3_possible(dev)) {
- pm_runtime_forbid(&dev->dev);
- pm_runtime_get_noresume(&dev->dev);
- pm_runtime_dont_use_autosuspend(&dev->dev);
+ /* whole hierarchy goes into a low power state for S5 */
+ if (system_state == SYSTEM_POWER_OFF) {
+ pci_set_power_state(dev, PCI_D3cold);
+ } else {
+ pm_runtime_forbid(&dev->dev);
+ pm_runtime_get_noresume(&dev->dev);
+ pm_runtime_dont_use_autosuspend(&dev->dev);
+ }
}
pcie_port_device_remove(dev);
--
2.34.1
Powered by blists - more mailing lists