From: Mario Limonciello <mario.limonciello@amd.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
"Rafael J . Wysocki" <rjw@rjwysocki.net>,
linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org, mpearson-lenovo@squebb.ca
Subject: Re: [PATCH 2/2] PCI/portdrv: Place PCIe port hierarchy into D3cold at shutdown
Date: Wed, 13 Dec 2023 12:42:04 -0600 [thread overview]
Message-ID: <766d621c-695d-4ae7-87cf-690cb8d066df@amd.com> (raw)
In-Reply-To: <CAJZ5v0gDjwEpx-WNSY0=qchoSGxizsD3XM7Bgq=i0xufBm=Cag@mail.gmail.com>
On 12/13/2023 12:38, Rafael J. Wysocki wrote:
> On Wed, Dec 13, 2023 at 7:27 PM Mario Limonciello
> <mario.limonciello@amd.com> wrote:
>>
>> 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.
>
> Isn't that a platform firmware issue?
>
> It is the responsibility of the platform firmware to properly put the
> platform into S5, including power removal from devices that are not
> armed for power-on.
The specific issues that triggered this series were tied to the PCIe
ports for dGPUs. There is a GPIO that is toggled by _ON or _OFF.
Windows calls _OFF as part of S5..
>
>> Cc: mpearson-lenovo@squebb.ca
>> Signed-off-by: Mario Limonciello <mario.limonciello@amd.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);
>> + }
>> }
>
> Wouldn't it be better to remove power from the port after running the
> code below?
>
Yes; I think you're right. I'll do some more testing with this.
>> pcie_port_device_remove(dev);
>> --
next prev parent reply other threads:[~2023-12-13 18:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-13 18:26 [PATCH 0/2] Improvements to system power consumption at S5 Mario Limonciello
2023-12-13 18:26 ` [PATCH 1/2] PCI: Avoid runtime resuming devices if system is shutting down Mario Limonciello
2023-12-13 18:31 ` Rafael J. Wysocki
2023-12-13 18:33 ` Mario Limonciello
2023-12-13 18:39 ` Rafael J. Wysocki
2023-12-13 18:26 ` [PATCH 2/2] PCI/portdrv: Place PCIe port hierarchy into D3cold at shutdown Mario Limonciello
2023-12-13 18:38 ` Rafael J. Wysocki
2023-12-13 18:42 ` Mario Limonciello [this message]
2023-12-13 18:46 ` Rafael J. Wysocki
2023-12-14 3:46 ` Kai-Heng Feng
2023-12-14 9:00 ` Rafael J. Wysocki
2023-12-14 16:44 ` Mario Limonciello
2023-12-18 3:41 ` Kai-Heng Feng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=766d621c-695d-4ae7-87cf-690cb8d066df@amd.com \
--to=mario.limonciello@amd.com \
--cc=bhelgaas@google.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mpearson-lenovo@squebb.ca \
--cc=rafael@kernel.org \
--cc=rjw@rjwysocki.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox