From: Mario Limonciello <mario.limonciello@amd.com>
To: Mathias Nyman <mathias.nyman@linux.intel.com>,
superm1@kernel.org, Mathias Nyman <mathias.nyman@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "open list:USB XHCI DRIVER" <linux-usb@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>,
Kai-Heng Feng <kai.heng.feng@canonical.com>,
mika.westerberg@linux.intel.com
Subject: Re: [PATCH 1/2] xhci: pci: If no ports have wakeup enabled then disable PCI device at S4
Date: Wed, 21 Aug 2024 15:59:58 -0500 [thread overview]
Message-ID: <3b9dfb8d-af1d-4f5d-9554-d256008ed9bc@amd.com> (raw)
In-Reply-To: <76daeba0-ac1a-4e05-8d25-3966526b464e@linux.intel.com>
On 8/21/2024 04:25, Mathias Nyman wrote:
> On 12.7.2024 21.54, superm1@kernel.org wrote:
>> From: Mario Limonciello <mario.limonciello@amd.com>
>>
>> If a port on an XHCI controller hasn't been marked for wakeup at S4, then
>> leaving it at D0 will needlessly consume power than necessary.
>>
>> Explicitly check ports configured for wakeup and if none are found then
>> put the controller into D3hot before hibernate.
>>
>> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
>> ---
>> drivers/usb/host/xhci-pci.c | 9 +++++++++
>> 1 file changed, 9 insertions(+)
>>
>> diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
>> index 05881153883ec..4408d4caf66d2 100644
>> --- a/drivers/usb/host/xhci-pci.c
>> +++ b/drivers/usb/host/xhci-pci.c
>> @@ -823,6 +823,7 @@ static int xhci_pci_poweroff_late(struct usb_hcd
>> *hcd, bool do_wakeup)
>> struct usb_device *udev;
>> u32 portsc;
>> int i;
>> + bool wakeup = false;
>> /*
>> * Systems with XHCI_RESET_TO_DEFAULT quirk have boot firmware that
>> @@ -860,6 +861,14 @@ static int xhci_pci_poweroff_late(struct usb_hcd
>> *hcd, bool do_wakeup)
>> port->rhub->hcd->self.busnum, port->hcd_portnum + 1);
>> portsc = xhci_port_state_to_neutral(portsc);
>> writel(portsc | PORT_PE, port->addr);
>> + wakeup = true;
>> + }
>> +
>> + if (!wakeup) {
>> + struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
>> +
>> + xhci_shutdown(hcd);
>> + pci_set_power_state(pdev, PCI_D3hot);
>
> Not sure we should force D3 here.
> I think usb core will set the PCI D state in the next .poweroff_noirq
> stage,
>
> for s4:
> .poweroff = hcd_pci_suspend,
> .poweroff_late = hcd_pci_poweroff_late,
> .poweroff_noirq = hcd_pci_suspend_noirq,
>
> hcd_pci_suspend_noirq()
> pci_prepare_to_sleep();
> target_state = pci_target_state(dev, wakeup)
> pci_set_power_state(dev, target_state)
>
> Maybe the target_state isn't D3 for some reason? (missing ACPI entries?)
>
Thanks for looking.
Even a lack of ACPI entries *should* still lead to D3hot if wakeup is
turned off with that flow.
I'll add some more debugging for the various callbacks and see what I
can come up with to explain it.
Can you please also review the other patch in the series?
Thanks!
next prev parent reply other threads:[~2024-08-21 20:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-12 18:54 [PATCH 0/2] Put XHCI controllers into D3 at S4/S5 superm1
2024-07-12 18:54 ` [PATCH 1/2] xhci: pci: If no ports have wakeup enabled then disable PCI device at S4 superm1
2024-08-21 9:25 ` Mathias Nyman
2024-08-21 20:59 ` Mario Limonciello [this message]
2024-07-12 18:54 ` [PATCH 2/2] xhci: pci: Put XHCI controllers into D3hot at shutdown superm1
2024-08-22 15:28 ` Mathias Nyman
2024-08-27 6:32 ` Peter Chen
2024-08-27 18:44 ` Mario Limonciello
2024-08-28 7:13 ` Peter Chen
2024-08-28 14:02 ` Mathias Nyman
2024-08-28 14:09 ` Alan Stern
2024-08-20 2:06 ` [PATCH 0/2] Put XHCI controllers into D3 at S4/S5 Mario Limonciello
2024-08-22 7:15 ` Kai-Heng Feng
2024-08-22 19:21 ` Mario Limonciello
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=3b9dfb8d-af1d-4f5d-9554-d256008ed9bc@amd.com \
--to=mario.limonciello@amd.com \
--cc=gregkh@linuxfoundation.org \
--cc=kai.heng.feng@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=mathias.nyman@linux.intel.com \
--cc=mika.westerberg@linux.intel.com \
--cc=superm1@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
Powered by JetHome