From: Lukas Wunner <lukas@wunner.de>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
"Rafael J . Wysocki" <rafael@kernel.org>,
linux-acpi@vger.kernel.org
Subject: Re: Potential issue with pci_prepare_to_sleep if there's no platform support for D3cold transition
Date: Tue, 22 Apr 2025 08:27:52 +0200 [thread overview]
Message-ID: <aAc26NTVcXy1BCxU@wunner.de> (raw)
In-Reply-To: <62de9027-e4cd-4192-90e8-64f4c4a8fe4b@gmail.com>
[cc += Rafael, linux-acpi]
On Mon, Apr 21, 2025 at 10:05:59PM +0200, Heiner Kallweit wrote:
> If there's no platform support for transition to D3cold, then
> pci_set_power_state(dev, D3cold) still returns 0, even though
> power state is transitioned to D3hot only. We called
> pci_enable_wake(dev, D3cold, wakeup) before, therefore PME for
> D3hot may not be enabled. Is this a bug?
>
> Background:
> In __pci_set_power_state we have the following:
>
> error = pci_set_low_power_state(dev, PCI_D3hot, locked);
> if (pci_platform_power_transition(dev, PCI_D3cold))
> return error;
>
> The acpi_pci_set_power_state() stub returns -ENODEV.
> Therefore, if error=0, __pci_set_power_state() will
> return 0 if pci_platform_power_transition() fails.
pci_prepare_to_sleep() calls pci_target_state() right at the top.
If wakeup is supported and enabled, pci_target_state() is supposed
to find the deepest power state supporting wakeup. If D3cold doesn't
support wakeup, D3hot or a shallower state is returned.
Hence I don't quite understand how the scenario you're describing
could occur in practice. Are you seeing actual issues and have tracked
them down to incorrect handling in pci_prepare_to_sleep()?
Thanks,
Lukas
next prev parent reply other threads:[~2025-04-22 6:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-21 20:05 Potential issue with pci_prepare_to_sleep if there's no platform support for D3cold transition Heiner Kallweit
2025-04-22 6:27 ` Lukas Wunner [this message]
2025-04-22 11:43 ` Rafael J. Wysocki
2025-04-23 9:32 ` Heiner Kallweit
2025-04-23 9:45 ` Heiner Kallweit
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=aAc26NTVcXy1BCxU@wunner.de \
--to=lukas@wunner.de \
--cc=bhelgaas@google.com \
--cc=hkallweit1@gmail.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=rafael@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).