lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240901162425.5103-1-00107082@163.com>
Date: Mon,  2 Sep 2024 00:24:25 +0800
From: David Wang <00107082@....com>
To: mathias.nyman@...el.com,
	gregkh@...uxfoundation.org
Cc: linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	David Wang <00107082@....com>
Subject: [PATCH] usb: xhci: wait for controller ready when resume with reinit_xhc

When resume system with reinit_xhc true, PM would report kernel
warning about device parent:

 >usb 3-1.1: reset high-speed USB device number 4 using xhci_hcd
 >..
 >ep_81: PM: parent 3-1.1:1.1 should not be sleeping

Move the code waiting for controller ready out, and make it
carry out work no matter reinit_xhc is true or false.
The error is ignored when reinit_xhc is true.

Signed-off-by: David Wang <00107082@....com>
---
 drivers/usb/host/xhci.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index efdf4c228b8c..8aeb1b34cdbf 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1032,13 +1032,15 @@ int xhci_resume(struct xhci_hcd *xhci, pm_message_t msg)
 	if (hibernated || xhci->quirks & XHCI_RESET_ON_RESUME || xhci->broken_suspend)
 		reinit_xhc = true;
 
+	/*
+	 * Some controllers might lose power during suspend, so wait
+	 * for controller not ready bit to clear, just as in xHC init.
+	 * Ignore retval if reinit_xhc is true, since the device would
+	 * be reinited.
+	 */
+	retval = xhci_handshake(&xhci->op_regs->status,
+				STS_CNR, 0, 10 * 1000 * 1000);
 	if (!reinit_xhc) {
-		/*
-		 * Some controllers might lose power during suspend, so wait
-		 * for controller not ready bit to clear, just as in xHC init.
-		 */
-		retval = xhci_handshake(&xhci->op_regs->status,
-					STS_CNR, 0, 10 * 1000 * 1000);
 		if (retval) {
 			xhci_warn(xhci, "Controller not ready at resume %d\n",
 				  retval);
-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ