This is a note to let you know that I've just added the patch titled xhci: Detect lpm incapable xHC USB3 roothub ports from ACPI tables to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: xhci-detect-lpm-incapable-xhc-usb3-roothub-ports-from-acpi-tables.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 74622f0a81d0c2bcfc39f9192b788124e8c7f0af Mon Sep 17 00:00:00 2001 From: Mathias Nyman <mathias.nyman@xxxxxxxxxxxxxxx> Date: Mon, 16 Jan 2023 16:22:16 +0200 Subject: xhci: Detect lpm incapable xHC USB3 roothub ports from ACPI tables From: Mathias Nyman <mathias.nyman@xxxxxxxxxxxxxxx> commit 74622f0a81d0c2bcfc39f9192b788124e8c7f0af upstream. USB3 ports on xHC hosts may have retimers that cause too long exit latency to work with native USB3 U1/U2 link power management states. For now only use usb_acpi_port_lpm_incapable() to evaluate if port lpm should be disabled while setting up the USB3 roothub. Other ways to identify lpm incapable ports can be added here later if ACPI _DSM does not exist. Limit this to Intel hosts for now, this is to my knowledge only an Intel issue. Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Mathias Nyman <mathias.nyman@xxxxxxxxxxxxxxx> Link: https://lore.kernel.org/r/20230116142216.1141605-8-mathias.nyman@xxxxxxxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/usb/host/xhci-pci.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -351,8 +351,38 @@ static void xhci_pme_acpi_rtd3_enable(st NULL); ACPI_FREE(obj); } + +static void xhci_find_lpm_incapable_ports(struct usb_hcd *hcd, struct usb_device *hdev) +{ + struct xhci_hcd *xhci = hcd_to_xhci(hcd); + struct xhci_hub *rhub = &xhci->usb3_rhub; + int ret; + int i; + + /* This is not the usb3 roothub we are looking for */ + if (hcd != rhub->hcd) + return; + + if (hdev->maxchild > rhub->num_ports) { + dev_err(&hdev->dev, "USB3 roothub port number mismatch\n"); + return; + } + + for (i = 0; i < hdev->maxchild; i++) { + ret = usb_acpi_port_lpm_incapable(hdev, i); + + dev_dbg(&hdev->dev, "port-%d disable U1/U2 _DSM: %d\n", i + 1, ret); + + if (ret >= 0) { + rhub->ports[i]->lpm_incapable = ret; + continue; + } + } +} + #else static void xhci_pme_acpi_rtd3_enable(struct pci_dev *dev) { } +static void xhci_find_lpm_incapable_ports(struct usb_hcd *hcd, struct usb_device *hdev) { } #endif /* CONFIG_ACPI */ /* called during probe() after chip reset completes */ @@ -388,6 +418,10 @@ static int xhci_pci_setup(struct usb_hcd static int xhci_pci_update_hub_device(struct usb_hcd *hcd, struct usb_device *hdev, struct usb_tt *tt, gfp_t mem_flags) { + /* Check if acpi claims some USB3 roothub ports are lpm incapable */ + if (!hdev->parent) + xhci_find_lpm_incapable_ports(hcd, hdev); + return xhci_update_hub_device(hcd, hdev, tt, mem_flags); } Patches currently in stable-queue which might be from mathias.nyman@xxxxxxxxxxxxxxx are queue-5.10/usb-acpi-add-helper-to-check-port-lpm-capability-using-acpi-_dsm.patch queue-5.10/xhci-fix-null-pointer-dereference-when-host-dies.patch queue-5.10/xhci-pci-set-the-dma-max_seg_size.patch queue-5.10/usb-xhci-check-endpoint-is-valid-before-dereferencing-it.patch queue-5.10/xhci-add-update_hub_device-override-for-pci-xhci-hosts.patch queue-5.10/xhci-detect-lpm-incapable-xhc-usb3-roothub-ports-from-acpi-tables.patch queue-5.10/xhci-add-a-flag-to-disable-usb3-lpm-on-a-xhci-root-port-level.patch