From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: 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,
Mario Limonciello <mario.limonciello@amd.com>
Subject: Re: [PATCH 2/2] xhci: pci: Put XHCI controllers into D3hot at shutdown
Date: Thu, 22 Aug 2024 18:28:33 +0300 [thread overview]
Message-ID: <060bf2de-d231-4ed6-b7cc-cda40bfd397a@linux.intel.com> (raw)
In-Reply-To: <20240712185418.937087-3-superm1@kernel.org>
On 12.7.2024 21.54, superm1@kernel.org wrote:
> From: Mario Limonciello <mario.limonciello@amd.com>
>
> A workaround was put in place for Haswell systems with spurious events
> to put XHCI controllers into D3hot at shutdown. This solution actually
> makes sense for all XHCI controllers though because XHCI controllers
> left in D0 by the OS may remain in D0 when the SoC goes into S5.
>
> Explicitly put all XHCI controllers into D3hot at shutdown and when
> module is unloaded.
>
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
> drivers/usb/host/xhci-pci.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
> index 4408d4caf66d2..dde5e4a210719 100644
> --- a/drivers/usb/host/xhci-pci.c
> +++ b/drivers/usb/host/xhci-pci.c
> @@ -667,9 +667,7 @@ static void xhci_pci_remove(struct pci_dev *dev)
> xhci->shared_hcd = NULL;
> }
>
> - /* Workaround for spurious wakeups at shutdown with HSW */
> - if (xhci->quirks & XHCI_SPURIOUS_WAKEUP)
> - pci_set_power_state(dev, PCI_D3hot);
> + pci_set_power_state(dev, PCI_D3hot);
>
> usb_hcd_pci_remove(dev);
Just noticed these have been the wrong way around for a while (impacting HSW).
We should first call usb_hcd_pci_remove() and then pci_set_power_state(D3),
otherwise we force a fully running xHC into D3.
Note, with this change we end up first calling
pci_disable_device(), then pci_set_power_state(D3)
> }
> @@ -882,9 +880,7 @@ static void xhci_pci_shutdown(struct usb_hcd *hcd)
> xhci_shutdown(hcd);
> xhci_cleanup_msix(xhci);
>
> - /* Yet another workaround for spurious wakeups at shutdown with HSW */
> - if (xhci->quirks & XHCI_SPURIOUS_WAKEUP)
> - pci_set_power_state(pdev, PCI_D3hot);
> + pci_set_power_state(pdev, PCI_D3hot);
Looks good
Note that we now end up first calling pci_set_power_state(D3) and then
pci_disable_device(). The other way around than the remove case above.
I don't know if it matters.
Thanks
Mathias
next prev parent reply other threads:[~2024-08-22 15:26 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
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 [this message]
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=060bf2de-d231-4ed6-b7cc-cda40bfd397a@linux.intel.com \
--to=mathias.nyman@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=kai.heng.feng@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=mathias.nyman@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.