Bug 216470 - [Regression] xhci_hcd 0000:08:00.2: xHC error in resume, USBSTS 0x401, Reinit
Summary: [Regression] xhci_hcd 0000:08:00.2: xHC error in resume, USBSTS 0x401, Reinit
Status: RESOLVED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: USB (show other bugs)
Hardware: AMD Linux
: P1 low
Assignee: Default virtual assignee for Drivers/USB
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-10 12:40 UTC by Artem S. Tashkinov
Modified: 2022-09-14 14:43 UTC (History)
2 users (show)

See Also:
Kernel Version: 5.19.8
Subsystem:
Regression: Yes
Bisected commit-id:


Attachments

Description Artem S. Tashkinov 2022-09-10 12:40:36 UTC
I don't remember this error in kernel 5.18 or earlier kernels, so I consider this a regression. Maybe my memory is wrong.

This error/warning message is logged after suspend/resume.

I only have USB keyboard, mouse and onboard/built-in BT adapter connected but all of them are connected to USB2 ports and this driver AFAIK is responsible for USB3.

$ lspci

00:00.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Starship/Matisse Root Complex
00:00.2 IOMMU: Advanced Micro Devices, Inc. [AMD] Starship/Matisse IOMMU
00:01.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Starship/Matisse PCIe Dummy Host Bridge
00:01.2 PCI bridge: Advanced Micro Devices, Inc. [AMD] Starship/Matisse GPP Bridge
00:02.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Starship/Matisse PCIe Dummy Host Bridge
00:03.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Starship/Matisse PCIe Dummy Host Bridge
00:03.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Starship/Matisse GPP Bridge
00:04.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Starship/Matisse PCIe Dummy Host Bridge
00:05.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Starship/Matisse PCIe Dummy Host Bridge
00:07.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Starship/Matisse PCIe Dummy Host Bridge
00:07.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Starship/Matisse Internal PCIe GPP Bridge 0 to bus[E:B]
00:08.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Starship/Matisse PCIe Dummy Host Bridge
00:08.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Starship/Matisse Internal PCIe GPP Bridge 0 to bus[E:B]
00:14.0 SMBus: Advanced Micro Devices, Inc. [AMD] FCH SMBus Controller (rev 61)
00:14.3 ISA bridge: Advanced Micro Devices, Inc. [AMD] FCH LPC Bridge (rev 51)
00:18.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Matisse/Vermeer Data Fabric: Device 18h; Function 0
00:18.1 Host bridge: Advanced Micro Devices, Inc. [AMD] Matisse/Vermeer Data Fabric: Device 18h; Function 1
00:18.2 Host bridge: Advanced Micro Devices, Inc. [AMD] Matisse/Vermeer Data Fabric: Device 18h; Function 2
00:18.3 Host bridge: Advanced Micro Devices, Inc. [AMD] Matisse/Vermeer Data Fabric: Device 18h; Function 3
00:18.4 Host bridge: Advanced Micro Devices, Inc. [AMD] Matisse/Vermeer Data Fabric: Device 18h; Function 4
00:18.5 Host bridge: Advanced Micro Devices, Inc. [AMD] Matisse/Vermeer Data Fabric: Device 18h; Function 5
00:18.6 Host bridge: Advanced Micro Devices, Inc. [AMD] Matisse/Vermeer Data Fabric: Device 18h; Function 6
00:18.7 Host bridge: Advanced Micro Devices, Inc. [AMD] Matisse/Vermeer Data Fabric: Device 18h; Function 7
01:00.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Matisse Switch Upstream
02:01.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Matisse PCIe GPP Bridge
02:05.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Matisse PCIe GPP Bridge
02:08.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Matisse PCIe GPP Bridge
02:09.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Matisse PCIe GPP Bridge
02:0a.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Matisse PCIe GPP Bridge
03:00.0 Non-Volatile memory controller: Sandisk Corp Device 501e
04:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 26)
05:00.0 Non-Essential Instrumentation [1300]: Advanced Micro Devices, Inc. [AMD] Starship/Matisse Reserved SPP
05:00.1 USB controller: Advanced Micro Devices, Inc. [AMD] Matisse USB 3.0 Host Controller
05:00.3 USB controller: Advanced Micro Devices, Inc. [AMD] Matisse USB 3.0 Host Controller
06:00.0 SATA controller: Advanced Micro Devices, Inc. [AMD] FCH SATA Controller [AHCI mode] (rev 51)
07:00.0 SATA controller: Advanced Micro Devices, Inc. [AMD] FCH SATA Controller [AHCI mode] (rev 51)
08:00.0 VGA compatible controller: NVIDIA Corporation TU116 [GeForce GTX 1660 Ti] (rev a1)
08:00.1 Audio device: NVIDIA Corporation TU116 High Definition Audio Controller (rev a1)
08:00.2 USB controller: NVIDIA Corporation TU116 USB 3.1 Host Controller (rev a1)
08:00.3 Serial bus controller: NVIDIA Corporation TU116 USB Type-C UCSI Controller (rev a1)
09:00.0 Non-Essential Instrumentation [1300]: Advanced Micro Devices, Inc. [AMD] Starship/Matisse PCIe Dummy Function
0a:00.0 Non-Essential Instrumentation [1300]: Advanced Micro Devices, Inc. [AMD] Starship/Matisse Reserved SPP
0a:00.1 Encryption controller: Advanced Micro Devices, Inc. [AMD] Starship/Matisse Cryptographic Coprocessor PSPCPP
0a:00.3 USB controller: Advanced Micro Devices, Inc. [AMD] Matisse USB 3.0 Host Controller
0a:00.4 Audio device: Advanced Micro Devices, Inc. [AMD] Starship/Matisse HD Audio Controller

$ lsusb -vt
/:  Bus 08.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 10000M
    ID 1d6b:0003 Linux Foundation 3.0 root hub
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 5000M
        ID 2109:0813 VIA Labs, Inc. VL813 Hub
/:  Bus 07.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        ID 2109:2813 VIA Labs, Inc. VL813 Hub
    |__ Port 3: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
        ID 046d:c31d Logitech, Inc. Media Keyboard K200
    |__ Port 3: Dev 3, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
        ID 046d:c31d Logitech, Inc. Media Keyboard K200
    |__ Port 4: Dev 4, If 0, Class=Human Interface Device, Driver=usbhid, 12M
        ID 046d:c084 Logitech, Inc. G203 Gaming Mouse
    |__ Port 4: Dev 4, If 1, Class=Human Interface Device, Driver=usbhid, 12M
        ID 046d:c084 Logitech, Inc. G203 Gaming Mouse
/:  Bus 06.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 10000M
    ID 1d6b:0003 Linux Foundation 3.0 root hub
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 10000M
    ID 1d6b:0003 Linux Foundation 3.0 root hub
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
    |__ Port 5: Dev 2, If 0, Class=Wireless, Driver=btusb, 12M
        ID 8087:0025 Intel Corp. Wireless-AC 9260 Bluetooth Adapter
    |__ Port 5: Dev 2, If 1, Class=Wireless, Driver=btusb, 12M
        ID 8087:0025 Intel Corp. Wireless-AC 9260 Bluetooth Adapter
    |__ Port 6: Dev 3, If 0, Class=Vendor Specific Class, Driver=, 12M
        ID 0b05:18f3 ASUSTek Computer, Inc. 
    |__ Port 6: Dev 3, If 2, Class=Human Interface Device, Driver=usbhid, 12M
        ID 0b05:18f3 ASUSTek Computer, Inc. 
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 10000M
    ID 1d6b:0003 Linux Foundation 3.0 root hub
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
Comment 1 Artem S. Tashkinov 2022-09-10 12:44:34 UTC
CC'ing Mathias Nyman.
Comment 2 Artem S. Tashkinov 2022-09-10 12:49:48 UTC
Google says the error is relatively new:

https://www.google.com/search?q=%22xHC+error+in+resume%2C+USBSTS+0x401%22

Looks like this is indeed a regression because there are no results other than those starting at approximately April, 2022.
Comment 3 Mario Limonciello (AMD) 2022-09-12 20:12:01 UTC
It's a new message as of 5.17-rc6 or later.

https://github.com/torvalds/linux/commit/8b328f8002bcf29ef517ee4bf234e09aabec4d2e

The behavior however is not new; it's due to this quirk introduced a few years back for your model.

https://github.com/torvalds/linux/commit/a7d57abcc8a5bdeb53bbf8e87558e8e0a2c2a29d

I don't think we should be doing anything functionally here.  The only think that might make sense IMO is downgrading the message to INFO or not showing it instead of WARN when `xhci->broken_suspend` is set.

Something like this:

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 38649284ff88..a7ef675f00fd 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1183,7 +1183,8 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
        /* re-initialize the HC on Restore Error, or Host Controller Error */
        if (temp & (STS_SRE | STS_HCE)) {
                reinit_xhc = true;
-               xhci_warn(xhci, "xHC error in resume, USBSTS 0x%x, Reinit\n", temp);
+               if (!xhci->broken_suspend)
+                       xhci_warn(xhci, "xHC error in resume, USBSTS 0x%x, Reinit\n", temp);
        }

        if (reinit_xhc) {
Comment 4 Artem S. Tashkinov 2022-09-13 16:02:10 UTC
(In reply to Mario Limonciello (AMD) from comment #3)
> It's a new message as of 5.17-rc6 or later.
> 
> https://github.com/torvalds/linux/commit/
> 8b328f8002bcf29ef517ee4bf234e09aabec4d2e
> 
> The behavior however is not new; it's due to this quirk introduced a few
> years back for your model.
> 
> https://github.com/torvalds/linux/commit/
> a7d57abcc8a5bdeb53bbf8e87558e8e0a2c2a29d
> 
> I don't think we should be doing anything functionally here.  The only think
> that might make sense IMO is downgrading the message to INFO or not showing
> it instead of WARN when `xhci->broken_suspend` is set.
> 
> Something like this:
> 
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index 38649284ff88..a7ef675f00fd 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -1183,7 +1183,8 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
>         /* re-initialize the HC on Restore Error, or Host Controller Error */
>         if (temp & (STS_SRE | STS_HCE)) {
>                 reinit_xhc = true;
> -               xhci_warn(xhci, "xHC error in resume, USBSTS 0x%x,
> Reinit\n", temp);
> +               if (!xhci->broken_suspend)
> +                       xhci_warn(xhci, "xHC error in resume, USBSTS 0x%x,
> Reinit\n", temp);
>         }
> 
>         if (reinit_xhc) {

Both options look good to me; would be great _not_ to get this warning at `dmesg -t --level=alert,crit,err,warn`.

Thanks a lot!
Comment 5 Mario Limonciello (AMD) 2022-09-14 14:43:24 UTC
Here is the fix queued up.
https://lore.kernel.org/linux-usb/02ef1ae2-9dae-6f02-9951-1230939f06e2@linux.intel.com/T/#t

Note You need to log in before you can comment on or make changes to this bug.