From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.50 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796323530; b=5pZJkXsY/MH3qGySfKkiWGKv0n8s3RehMSx6jim1aqeRKSCQy5VsjOMqgNhLZdYj2hkW DsMUvhpHgUXQQ/50CMi9AnDK5XizeQIBDs393bswIcsGd5ahhqMhg3gUwGBU8k4XGpXG7 ou3DhYxdihrF9CNy1qGQhFfxd12d5Y79ry4ddBvM6o97HKjpeegCzRhUUOGxb1KFRBSEr yVzOkmVic9YuQ1dHtJGaOJHn5oNNL4vb8xXRxBchnqNEbFt4hjZJXz10xTq/nlJKemiaz oxIZCUHmex7IcV49b+t8Ztyc4mVIOrYWF8QZ++adjd4EFVvuUjF7kma6gzaml95dZEg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796323530; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=Hw65RcX/g6esuUNZMbKp0oOzz8YwnSA9Q/NaiO+nCDw=; b=hvFrXIUvts/7ZYml3HDpNPDMSSQgCKEYxxrEAo8IrafCBVhJv0BKU0bCfoQZ/KD62gYD dpMbDWZW3L2Hu1b52Ai3pNyn/wBois1opJ5yKaBWh0wePUne/n8J4PYNwRL29W+fMGWdd R8l1Yq+G0qQ5Rm/0Q2W2Tso8TAsyuKEK90GC1QtEf8943GYxcVEzz5XiV3qy+Nly66NAh npOG1CqZgxhmwX2Catl0+7RrQ3EvHawcUCFq6YEXM6Ce7e484cjfw+cz1xlpIAQlYeO3U RDX2myv/Ik+lFK/vPjxssf8SyulDZwpjIe/3Ro9sye5s7MIi3S0NVG2DI6Tui3WNhqA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=RpGk0dHe; arc=none smtp.remote-ip=209.85.128.50 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DEB60606A332 for ; Thu, 3 Dec 2026 18:45:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DEB60606A332 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=RpGk0dHe Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-4bb70074ab2so995645e9.0 for ; Thu, 03 Dec 2026 10:45:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796323528; x=1796928328; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Hw65RcX/g6esuUNZMbKp0oOzz8YwnSA9Q/NaiO+nCDw=; b=RpGk0dHeKp3JcN7QOATj63Cx2SgZEWQucV7pi0tn1G+SOnEf9Px3PW5lpbwM83puW7 MGCr7yjSdlw182UsjbaWQ8hAkm8qeG/+0vobft7wcdQKccerYXJk+42QYbCqL08wdRRl WE+sjOLr6+tgfW+JZKopVOqf+L2f9xmEkplC3NPgkfGeSo09lOXPiqK+JL2nJzpEINTx nZDrQEuJxVvkqPBBv0O/8ojZ1HRQVrzs/PGP84u7qFNkVoDBroP4LPz5YvX9UlKFlnbu RJwRyQkqGMBYu5CG7hRbQl1cu4Tk3/jPecOLmMlSIUxuJlt+gKUm4mtKfVJ9Gt0yDjHT 69Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796323528; x=1796928328; h=content-transfer-encoding:content-type:mime-version:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=Hw65RcX/g6esuUNZMbKp0oOzz8YwnSA9Q/NaiO+nCDw=; b=HLgTOLrmF97KIGJ53a79ns5B73cCt74WiXelF2gtZ7h4Vv5Ydo8qJF/aue5fE09a1S fVKSQkSJA31UVMv1kmgLyGa8LMLdyqppDlEtXwlEEJzbwdgqVC3K6t+1/d5fL+Y7MFPE dQs6KvfENCkj9q6bOHaDqj39ZDDBYfGaifr2BWW3Fri3dV6JimDC3gABWzkxmvhRi0WK 3vrCHW3RTgjcxqdrE/yIjvNIb2qn8a+W8we8jSXTeBuk9WZTMyk9/ctjTbJWAvEiV9HQ 4Hj8irXbev0cG9lBCIqnpgNFr9oGz6eFdKczBjjmwpnSGdhp1FK2aVbLoC1O2BMVonVa E5Ww== X-Forwarded-Encrypted: i=1; AL+hErFYCKtAdMxGNFAGIKUKXCsxvrPkYyKRL9uuF8Uqiz8kF5KQSGvAhKTHgDxxY8Pu986YjUx6WwMoEHQ=@vger.kernel.org X-Gm-Message-State: APuU4Z/C7bWKSLrini4zwmOHJsDH8T2d/HW44gOAip4tLT5fcivR008Q WgnPyulrDh6E8yZtJ/WiqCpmEF+/KdKjWR2TvCV9oaEc6TWQ6V8fDV9z X-Gm-Gg: AZFdTZdz1iHhNl+cilzxRZnVpEoJmooz9nvZHgvwyTh9YNv6u+HWavimBLl/3yoqJz9 jxg6AdkJeHWnuDFVyDjAWrYkLntUzW2XgpZ3E3gIAMvttzAUsMks3Ql8AUZfYg1GxcUjA+LOk0M 3jixERGP3HcyRdpdWz+Buj02pbgc7vuomtRfeuTNlTfplNyhGG62Sq5EIn96TuWK4J9RxEXoisD AkDCdTG0Cv59zeN+i514Trz1FEefhU6qGdgPmVrGbjYHC7YpWZoB8w+5YpeXDz/YtAAlO2DvalJ 8/iBzQiybyqvfNnjaknCDxDVh3QrpAvp3lj/41c0iM2a+vOBJKAuHqa8AJbT9WPRNTTZ/COWvwe rOlBPyyyp0tcjcdPshKgTKPEdYrLQBOXxU9y8Ii2xKOSsHSjasbiTopDKps3ComBZWllLhpGsCo JJqA/mAozs4YVw+5L0eA4hIVEQt6GSwnouK0w7rl9y2c9vcKKip6/GLgjTxo2Ek7oAKroUs6ySR Y8rcvCtLiEuZr21VXYgrh0jqlHrytYGVJNt8SAJoQKLuJW+CSPcqoWQ8jz3Tcr+sIkV31oYHUpU lRVdH9ZHjxzMdnXs60b9LJ5/LWPKE4v7xEYcFA== X-Received: by 2002:a05:600c:4e0d:b0:4a5:e6fd:65e5 with SMTP id 5b1f17b1804b1-4bb88922a67mr833197085e9.31.1796323527942; Thu, 03 Dec 2026 10:45:27 -0800 (PST) Received: from foxbook (bfj60.neoplus.adsl.tpnet.pl. [83.28.47.60]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbe00792dasm97711325e9.5.2026.12.03.10.45.27 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 03 Dec 2026 10:45:27 -0800 (PST) Date: Thu, 3 Dec 2026 19:45:30 +0100 From: Michal Pecio To: Mathias Nyman , Greg Kroah-Hartman , Paul Menzel , Wen Xiong Cc: linux-usb@vger.kernel.org, linux-pci@vger.kernel.org Subject: [RFC PATCH] usb: pci-quirks: Reset stubborn xHCI controllers Message-ID: <20261203194530.5d382b9e.michal.pecio@gmail.com> X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit TUSB7340 has been reported to get stuck and refuse to halt after kexec; at least in one case problems turned out to begin already in xhci_shutdown() routine before kexec. Issuing a PCI function reset to the chip was reported to restore operation. I obtained a PCIe card with TUSB7340 and found that problems are not limited to kexec - ordinary reboot also triggers halt error (seen over netconsole) if a busy device like keyboard (opened by the kernel's VT) or a network interface (brought up) is present. Some chips don't seem to appreciate halting mid-operation. The issue is also triggered by my BIOS if a keyboard is connected. The BIOS doesn't halt xHCI chips used for legacy USB support at all (USBSTS shows EINT | PCD), and when the booting kernel tries to halt a TUSB7340, the chip locks up as usual. All chips also get IOMMU faults on USB port connection if I patch quirk_usb_handoff_xhci() not to halt them after the handoff and blacklist xhci-hcd, but faulting addresses belong to a reserved area so that's OK, at least in my BIOS. Good luck. All things considered, it seems that when an xHCI chip is in the "running" state (power-on default is "halted") and it refuses to stop, it's better to take this seriously and give it a good kick. This allows my TUSB7340 to work even after being used by BIOS: pci 0000:08:00.0: xHCI HW did not halt within 32000 usec status = 0x18 pci 0000:08:00.0: Function reset, status 0 pci 0000:08:00.0: quirk_usb_early_handoff+0x0/0x680 took 138097 usecs xhci_hcd 0000:08:00.0: xHCI Host Controller Reported-by: Paul Menzel Link: https://lore.kernel.org/linux-usb/fb68e15d-b8f2-42ac-aa65-0d9fedcfcdbd@molgen.mpg.de/ Reported-by: Wen Xiong Link: https://lore.kernel.org/linux-usb/20261001222527.11742-1-wenxiong@linux.ibm.com/ Suggested-by: Wen Xiong Signed-off-by: Michal Pecio --- drivers/usb/host/pci-quirks.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 1dbfd697a582..ba30ac74ab30 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c @@ -1253,10 +1253,14 @@ static void quirk_usb_handoff_xhci(struct pci_dev *pdev) timeout = handshake(op_reg_base + XHCI_STS_OFFSET, XHCI_STS_HALT, 1, XHCI_MAX_HALT_USEC, 125); if (timeout) { + int ret; + val = readl(op_reg_base + XHCI_STS_OFFSET); dev_warn(&pdev->dev, "xHCI HW did not halt within %d usec status = 0x%x\n", XHCI_MAX_HALT_USEC, val); + ret = pci_reset_function(pdev); + dev_warn(&pdev->dev, "Function reset, status %d\n", ret); } iounmap: -- 2.48.1