All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] xhci fixes for usb-linus
@ 2022-10-24 14:27 Mathias Nyman
  2022-10-24 14:27 ` [PATCH 1/4] usb: xhci: add XHCI_SPURIOUS_SUCCESS to ASM1042 despite being a V0.96 controller Mathias Nyman
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Mathias Nyman @ 2022-10-24 14:27 UTC (permalink / raw)
  To: gregkh; +Cc: linux-usb, Mathias Nyman

Hi Greg

Some xhci fixes for usb-linus, mostly tuning quirks, but also fixing
one linked list issue.

Thanks
Mathias

Jens Glathe (1):
  usb: xhci: add XHCI_SPURIOUS_SUCCESS to ASM1042 despite being a V0.96
    controller

Mario Limonciello (1):
  xhci-pci: Set runtime PM as default policy on all xHC 1.2 or later
    devices

Mathias Nyman (2):
  xhci: Add quirk to reset host back to default state at shutdown
  xhci: Remove device endpoints from bandwidth list when freeing the
    device

 drivers/usb/host/xhci-mem.c | 20 ++++++++++-------
 drivers/usb/host/xhci-pci.c | 44 +++++++++++++------------------------
 drivers/usb/host/xhci.c     | 10 +++++++--
 drivers/usb/host/xhci.h     |  1 +
 4 files changed, 36 insertions(+), 39 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/4] usb: xhci: add XHCI_SPURIOUS_SUCCESS to ASM1042 despite being a V0.96 controller
  2022-10-24 14:27 [PATCH 0/4] xhci fixes for usb-linus Mathias Nyman
@ 2022-10-24 14:27 ` Mathias Nyman
  2022-10-24 14:27 ` [PATCH 2/4] xhci: Add quirk to reset host back to default state at shutdown Mathias Nyman
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 13+ messages in thread
From: Mathias Nyman @ 2022-10-24 14:27 UTC (permalink / raw)
  To: gregkh; +Cc: linux-usb, Jens Glathe, stable, Mathias Nyman

From: Jens Glathe <jens.glathe@oldschoolsolutions.biz>

This appears to fix the error:
"xhci_hcd <address>; ERROR Transfer event TRB DMA ptr not part of
current TD ep_index 2 comp_code 13" that appear spuriously (or pretty
often) when using a r8152 USB3 ethernet adapter with integrated hub.

ASM1042 reports as a 0.96 controller, but appears to behave more like 1.0

Inspired by this email thread: https://markmail.org/thread/7vzqbe7t6du6qsw3

Cc: stable@vger.kernel.org
Signed-off-by: Jens Glathe <jens.glathe@oldschoolsolutions.biz>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
---
 drivers/usb/host/xhci-pci.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 40228a3d77a0..6dd3102749b7 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -306,8 +306,14 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 	}
 
 	if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
-		pdev->device == PCI_DEVICE_ID_ASMEDIA_1042_XHCI)
+		pdev->device == PCI_DEVICE_ID_ASMEDIA_1042_XHCI) {
+		/*
+		 * try to tame the ASMedia 1042 controller which reports 0.96
+		 * but appears to behave more like 1.0
+		 */
+		xhci->quirks |= XHCI_SPURIOUS_SUCCESS;
 		xhci->quirks |= XHCI_BROKEN_STREAMS;
+	}
 	if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
 		pdev->device == PCI_DEVICE_ID_ASMEDIA_1042A_XHCI) {
 		xhci->quirks |= XHCI_TRUST_TX_LENGTH;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/4] xhci: Add quirk to reset host back to default state at shutdown
  2022-10-24 14:27 [PATCH 0/4] xhci fixes for usb-linus Mathias Nyman
  2022-10-24 14:27 ` [PATCH 1/4] usb: xhci: add XHCI_SPURIOUS_SUCCESS to ASM1042 despite being a V0.96 controller Mathias Nyman
@ 2022-10-24 14:27 ` Mathias Nyman
  2022-10-26  6:40   ` Reka Norman
  2022-10-24 14:27 ` [PATCH 3/4] xhci-pci: Set runtime PM as default policy on all xHC 1.2 or later devices Mathias Nyman
  2022-10-24 14:27 ` [PATCH 4/4] xhci: Remove device endpoints from bandwidth list when freeing the device Mathias Nyman
  3 siblings, 1 reply; 13+ messages in thread
From: Mathias Nyman @ 2022-10-24 14:27 UTC (permalink / raw)
  To: gregkh; +Cc: linux-usb, Mathias Nyman, stable

From: Mathias Nyman <mathias.nyman@linux.intel.com>

Systems based on Alder Lake P see significant boot time delay if
boot firmware tries to control usb ports in unexpected link states.

This is seen with self-powered usb devices that survive in U3 link
suspended state over S5.

A more generic solution to power off ports at shutdown was attempted in
commit 83810f84ecf1 ("xhci: turn off port power in shutdown")
but it caused regression.

Add host specific XHCI_RESET_TO_DEFAULT quirk which will reset host and
ports back to default state in shutdown.

Cc: stable@vger.kernel.org
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
---
 drivers/usb/host/xhci-pci.c |  4 ++++
 drivers/usb/host/xhci.c     | 10 ++++++++--
 drivers/usb/host/xhci.h     |  1 +
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 6dd3102749b7..fbbd547ba12a 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -257,6 +257,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 	     pdev->device == PCI_DEVICE_ID_INTEL_DNV_XHCI))
 		xhci->quirks |= XHCI_MISSING_CAS;
 
+	if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
+	    pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI)
+		xhci->quirks |= XHCI_RESET_TO_DEFAULT;
+
 	if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
 	    (pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_2C_XHCI ||
 	     pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_4C_XHCI ||
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 5176765c4013..79d7931c048a 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -810,9 +810,15 @@ void xhci_shutdown(struct usb_hcd *hcd)
 
 	spin_lock_irq(&xhci->lock);
 	xhci_halt(xhci);
-	/* Workaround for spurious wakeups at shutdown with HSW */
-	if (xhci->quirks & XHCI_SPURIOUS_WAKEUP)
+
+	/*
+	 * Workaround for spurious wakeps at shutdown with HSW, and for boot
+	 * firmware delay in ADL-P PCH if port are left in U3 at shutdown
+	 */
+	if (xhci->quirks & XHCI_SPURIOUS_WAKEUP ||
+	    xhci->quirks & XHCI_RESET_TO_DEFAULT)
 		xhci_reset(xhci, XHCI_RESET_SHORT_USEC);
+
 	spin_unlock_irq(&xhci->lock);
 
 	xhci_cleanup_msix(xhci);
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index c0964fe8ac12..cc084d9505cd 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1897,6 +1897,7 @@ struct xhci_hcd {
 #define XHCI_BROKEN_D3COLD	BIT_ULL(41)
 #define XHCI_EP_CTX_BROKEN_DCS	BIT_ULL(42)
 #define XHCI_SUSPEND_RESUME_CLKS	BIT_ULL(43)
+#define XHCI_RESET_TO_DEFAULT	BIT_ULL(44)
 
 	unsigned int		num_active_eps;
 	unsigned int		limit_active_eps;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/4] xhci-pci: Set runtime PM as default policy on all xHC 1.2 or later devices
  2022-10-24 14:27 [PATCH 0/4] xhci fixes for usb-linus Mathias Nyman
  2022-10-24 14:27 ` [PATCH 1/4] usb: xhci: add XHCI_SPURIOUS_SUCCESS to ASM1042 despite being a V0.96 controller Mathias Nyman
  2022-10-24 14:27 ` [PATCH 2/4] xhci: Add quirk to reset host back to default state at shutdown Mathias Nyman
@ 2022-10-24 14:27 ` Mathias Nyman
  2022-10-24 14:27 ` [PATCH 4/4] xhci: Remove device endpoints from bandwidth list when freeing the device Mathias Nyman
  3 siblings, 0 replies; 13+ messages in thread
From: Mathias Nyman @ 2022-10-24 14:27 UTC (permalink / raw)
  To: gregkh
  Cc: linux-usb, Mario Limonciello, stable, Mathias Nyman, Mika Westerberg

From: Mario Limonciello <mario.limonciello@amd.com>

For optimal power consumption of USB4 routers the XHCI PCIe endpoint
used for tunneling must be in D3.  Historically this is accomplished
by a long list of PCIe IDs that correspond to these endpoints because
the xhci_hcd driver will not default to allowing runtime PM for all
devices.

As both AMD and Intel have released new products with new XHCI controllers
this list continues to grow. In reviewing the XHCI specification v1.2 on
page 607 there is already a requirement that the PCI power management
states D3hot and D3cold must be supported.

In the quirk list, use this to indicate that runtime PM should be allowed
on XHCI controllers. The following controllers are known to be xHC 1.2 and
dropped explicitly:
* AMD Yellow Carp
* Intel Alder Lake
* Intel Meteor Lake
* Intel Raptor Lake

[keep PCI ID for Alder Lake PCH for recently added quirk -Mathias]
Cc: stable@vger.kernel.org
Suggested-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://www.intel.com/content/dam/www/public/us/en/documents/technical-specifications/extensible-host-controler-interface-usb-xhci.pdf
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
---
 drivers/usb/host/xhci-pci.c | 32 ++++----------------------------
 1 file changed, 4 insertions(+), 28 deletions(-)

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index fbbd547ba12a..7bccbe50bab1 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -58,25 +58,13 @@
 #define PCI_DEVICE_ID_INTEL_CML_XHCI			0xa3af
 #define PCI_DEVICE_ID_INTEL_TIGER_LAKE_XHCI		0x9a13
 #define PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI		0x1138
-#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_XHCI		0x461e
-#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_N_XHCI		0x464e
-#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI	0x51ed
-#define PCI_DEVICE_ID_INTEL_RAPTOR_LAKE_XHCI		0xa71e
-#define PCI_DEVICE_ID_INTEL_METEOR_LAKE_XHCI		0x7ec0
+#define PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI		0x51ed
 
 #define PCI_DEVICE_ID_AMD_RENOIR_XHCI			0x1639
 #define PCI_DEVICE_ID_AMD_PROMONTORYA_4			0x43b9
 #define PCI_DEVICE_ID_AMD_PROMONTORYA_3			0x43ba
 #define PCI_DEVICE_ID_AMD_PROMONTORYA_2			0x43bb
 #define PCI_DEVICE_ID_AMD_PROMONTORYA_1			0x43bc
-#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_1		0x161a
-#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_2		0x161b
-#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_3		0x161d
-#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_4		0x161e
-#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_5		0x15d6
-#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_6		0x15d7
-#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_7		0x161c
-#define PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_8		0x161f
 
 #define PCI_DEVICE_ID_ASMEDIA_1042_XHCI			0x1042
 #define PCI_DEVICE_ID_ASMEDIA_1042A_XHCI		0x1142
@@ -272,12 +260,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 	     pdev->device == PCI_DEVICE_ID_INTEL_TITAN_RIDGE_DD_XHCI ||
 	     pdev->device == PCI_DEVICE_ID_INTEL_ICE_LAKE_XHCI ||
 	     pdev->device == PCI_DEVICE_ID_INTEL_TIGER_LAKE_XHCI ||
-	     pdev->device == PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI ||
-	     pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_XHCI ||
-	     pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_N_XHCI ||
-	     pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI ||
-	     pdev->device == PCI_DEVICE_ID_INTEL_RAPTOR_LAKE_XHCI ||
-	     pdev->device == PCI_DEVICE_ID_INTEL_METEOR_LAKE_XHCI))
+	     pdev->device == PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI))
 		xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW;
 
 	if (pdev->vendor == PCI_VENDOR_ID_ETRON &&
@@ -346,15 +329,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 	     pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_4))
 		xhci->quirks |= XHCI_NO_SOFT_RETRY;
 
-	if (pdev->vendor == PCI_VENDOR_ID_AMD &&
-	    (pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_1 ||
-	    pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_2 ||
-	    pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_3 ||
-	    pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_4 ||
-	    pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_5 ||
-	    pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_6 ||
-	    pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_7 ||
-	    pdev->device == PCI_DEVICE_ID_AMD_YELLOW_CARP_XHCI_8))
+	/* xHC spec requires PCI devices to support D3hot and D3cold */
+	if (xhci->hci_version >= 0x120)
 		xhci->quirks |= XHCI_DEFAULT_PM_RUNTIME_ALLOW;
 
 	if (xhci->quirks & XHCI_RESET_ON_RESUME)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/4] xhci: Remove device endpoints from bandwidth list when freeing the device
  2022-10-24 14:27 [PATCH 0/4] xhci fixes for usb-linus Mathias Nyman
                   ` (2 preceding siblings ...)
  2022-10-24 14:27 ` [PATCH 3/4] xhci-pci: Set runtime PM as default policy on all xHC 1.2 or later devices Mathias Nyman
@ 2022-10-24 14:27 ` Mathias Nyman
  3 siblings, 0 replies; 13+ messages in thread
From: Mathias Nyman @ 2022-10-24 14:27 UTC (permalink / raw)
  To: gregkh; +Cc: linux-usb, Mathias Nyman, stable, Marek Marczykowski-Górecki

From: Mathias Nyman <mathias.nyman@linux.intel.com>

Endpoints are normally deleted from the bandwidth list when they are
dropped, before the virt device is freed.

If xHC host is dying or being removed then the endpoints aren't dropped
cleanly due to functions returning early to avoid interacting with a
non-accessible host controller.

So check and delete endpoints that are still on the bandwidth list when
freeing the virt device.

Solves a list_del corruption kernel crash when unbinding xhci-pci,
caused by xhci_mem_cleanup() when it later tried to delete already freed
endpoints from the bandwidth list.

This only affects hosts that use software bandwidth checking, which
currenty is only the xHC in intel Panther Point PCH (Ivy Bridge)

Cc: stable@vger.kernel.org
Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
---
 drivers/usb/host/xhci-mem.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 9e56aa28efcd..81ca2bc1f0be 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -889,15 +889,19 @@ void xhci_free_virt_device(struct xhci_hcd *xhci, int slot_id)
 		if (dev->eps[i].stream_info)
 			xhci_free_stream_info(xhci,
 					dev->eps[i].stream_info);
-		/* Endpoints on the TT/root port lists should have been removed
-		 * when usb_disable_device() was called for the device.
-		 * We can't drop them anyway, because the udev might have gone
-		 * away by this point, and we can't tell what speed it was.
+		/*
+		 * Endpoints are normally deleted from the bandwidth list when
+		 * endpoints are dropped, before device is freed.
+		 * If host is dying or being removed then endpoints aren't
+		 * dropped cleanly, so delete the endpoint from list here.
+		 * Only applicable for hosts with software bandwidth checking.
 		 */
-		if (!list_empty(&dev->eps[i].bw_endpoint_list))
-			xhci_warn(xhci, "Slot %u endpoint %u "
-					"not removed from BW list!\n",
-					slot_id, i);
+
+		if (!list_empty(&dev->eps[i].bw_endpoint_list)) {
+			list_del_init(&dev->eps[i].bw_endpoint_list);
+			xhci_dbg(xhci, "Slot %u endpoint %u not removed from BW list!\n",
+				 slot_id, i);
+		}
 	}
 	/* If this is a hub, free the TT(s) from the TT list */
 	xhci_free_tt_info(xhci, dev, slot_id);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/4] xhci: Add quirk to reset host back to default state at shutdown
  2022-10-24 14:27 ` [PATCH 2/4] xhci: Add quirk to reset host back to default state at shutdown Mathias Nyman
@ 2022-10-26  6:40   ` Reka Norman
  2022-10-26  7:00     ` Greg KH
  0 siblings, 1 reply; 13+ messages in thread
From: Reka Norman @ 2022-10-26  6:40 UTC (permalink / raw)
  To: Mathias Nyman; +Cc: gregkh, linux-usb, Mathias Nyman, stable

On Wed, Oct 26, 2022 at 5:01 PM Mathias Nyman <mathias.nyman@intel.com> wrote:
>
> From: Mathias Nyman <mathias.nyman@linux.intel.com>
>
> Systems based on Alder Lake P see significant boot time delay if
> boot firmware tries to control usb ports in unexpected link states.
>
> This is seen with self-powered usb devices that survive in U3 link
> suspended state over S5.
>
> A more generic solution to power off ports at shutdown was attempted in
> commit 83810f84ecf1 ("xhci: turn off port power in shutdown")
> but it caused regression.
>
> Add host specific XHCI_RESET_TO_DEFAULT quirk which will reset host and
> ports back to default state in shutdown.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
> ---
>  drivers/usb/host/xhci-pci.c |  4 ++++
>  drivers/usb/host/xhci.c     | 10 ++++++++--
>  drivers/usb/host/xhci.h     |  1 +
>  3 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
> index 6dd3102749b7..fbbd547ba12a 100644
> --- a/drivers/usb/host/xhci-pci.c
> +++ b/drivers/usb/host/xhci-pci.c
> @@ -257,6 +257,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
>              pdev->device == PCI_DEVICE_ID_INTEL_DNV_XHCI))
>                 xhci->quirks |= XHCI_MISSING_CAS;
>
> +       if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
> +           pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI)

We need this quirk for ADL-N too (device ID 0x54ed). Would you mind
updating the patch? Or I can send a separate patch if you prefer.

> +               xhci->quirks |= XHCI_RESET_TO_DEFAULT;
> +
>         if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
>             (pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_2C_XHCI ||
>              pdev->device == PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_4C_XHCI ||
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index 5176765c4013..79d7931c048a 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -810,9 +810,15 @@ void xhci_shutdown(struct usb_hcd *hcd)
>
>         spin_lock_irq(&xhci->lock);
>         xhci_halt(xhci);
> -       /* Workaround for spurious wakeups at shutdown with HSW */
> -       if (xhci->quirks & XHCI_SPURIOUS_WAKEUP)
> +
> +       /*
> +        * Workaround for spurious wakeps at shutdown with HSW, and for boot
> +        * firmware delay in ADL-P PCH if port are left in U3 at shutdown
> +        */
> +       if (xhci->quirks & XHCI_SPURIOUS_WAKEUP ||
> +           xhci->quirks & XHCI_RESET_TO_DEFAULT)
>                 xhci_reset(xhci, XHCI_RESET_SHORT_USEC);
> +
>         spin_unlock_irq(&xhci->lock);
>
>         xhci_cleanup_msix(xhci);
> diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
> index c0964fe8ac12..cc084d9505cd 100644
> --- a/drivers/usb/host/xhci.h
> +++ b/drivers/usb/host/xhci.h
> @@ -1897,6 +1897,7 @@ struct xhci_hcd {
>  #define XHCI_BROKEN_D3COLD     BIT_ULL(41)
>  #define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(42)
>  #define XHCI_SUSPEND_RESUME_CLKS       BIT_ULL(43)
> +#define XHCI_RESET_TO_DEFAULT  BIT_ULL(44)
>
>         unsigned int            num_active_eps;
>         unsigned int            limit_active_eps;
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/4] xhci: Add quirk to reset host back to default state at shutdown
  2022-10-26  6:40   ` Reka Norman
@ 2022-10-26  7:00     ` Greg KH
  2022-10-27  5:42       ` Reka Norman
  0 siblings, 1 reply; 13+ messages in thread
From: Greg KH @ 2022-10-26  7:00 UTC (permalink / raw)
  To: Reka Norman; +Cc: Mathias Nyman, linux-usb, Mathias Nyman, stable

On Wed, Oct 26, 2022 at 05:40:10PM +1100, Reka Norman wrote:
> On Wed, Oct 26, 2022 at 5:01 PM Mathias Nyman <mathias.nyman@intel.com> wrote:
> >
> > From: Mathias Nyman <mathias.nyman@linux.intel.com>
> >
> > Systems based on Alder Lake P see significant boot time delay if
> > boot firmware tries to control usb ports in unexpected link states.
> >
> > This is seen with self-powered usb devices that survive in U3 link
> > suspended state over S5.
> >
> > A more generic solution to power off ports at shutdown was attempted in
> > commit 83810f84ecf1 ("xhci: turn off port power in shutdown")
> > but it caused regression.
> >
> > Add host specific XHCI_RESET_TO_DEFAULT quirk which will reset host and
> > ports back to default state in shutdown.
> >
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
> > ---
> >  drivers/usb/host/xhci-pci.c |  4 ++++
> >  drivers/usb/host/xhci.c     | 10 ++++++++--
> >  drivers/usb/host/xhci.h     |  1 +
> >  3 files changed, 13 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
> > index 6dd3102749b7..fbbd547ba12a 100644
> > --- a/drivers/usb/host/xhci-pci.c
> > +++ b/drivers/usb/host/xhci-pci.c
> > @@ -257,6 +257,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
> >              pdev->device == PCI_DEVICE_ID_INTEL_DNV_XHCI))
> >                 xhci->quirks |= XHCI_MISSING_CAS;
> >
> > +       if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
> > +           pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI)
> 
> We need this quirk for ADL-N too (device ID 0x54ed). Would you mind
> updating the patch? Or I can send a separate patch if you prefer.

A separate patch is required, please submit it.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/4] xhci: Add quirk to reset host back to default state at shutdown
  2022-10-26  7:00     ` Greg KH
@ 2022-10-27  5:42       ` Reka Norman
  0 siblings, 0 replies; 13+ messages in thread
From: Reka Norman @ 2022-10-27  5:42 UTC (permalink / raw)
  To: Greg KH; +Cc: Reka Norman, Mathias Nyman, linux-usb, Mathias Nyman, stable

On Wed, Oct 26, 2022 at 5:59 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Wed, Oct 26, 2022 at 05:40:10PM +1100, Reka Norman wrote:
> > On Wed, Oct 26, 2022 at 5:01 PM Mathias Nyman <mathias.nyman@intel.com> wrote:
> > >
> > > From: Mathias Nyman <mathias.nyman@linux.intel.com>
> > >
> > > Systems based on Alder Lake P see significant boot time delay if
> > > boot firmware tries to control usb ports in unexpected link states.
> > >
> > > This is seen with self-powered usb devices that survive in U3 link
> > > suspended state over S5.
> > >
> > > A more generic solution to power off ports at shutdown was attempted in
> > > commit 83810f84ecf1 ("xhci: turn off port power in shutdown")
> > > but it caused regression.
> > >
> > > Add host specific XHCI_RESET_TO_DEFAULT quirk which will reset host and
> > > ports back to default state in shutdown.
> > >
> > > Cc: stable@vger.kernel.org
> > > Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
> > > ---
> > >  drivers/usb/host/xhci-pci.c |  4 ++++
> > >  drivers/usb/host/xhci.c     | 10 ++++++++--
> > >  drivers/usb/host/xhci.h     |  1 +
> > >  3 files changed, 13 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
> > > index 6dd3102749b7..fbbd547ba12a 100644
> > > --- a/drivers/usb/host/xhci-pci.c
> > > +++ b/drivers/usb/host/xhci-pci.c
> > > @@ -257,6 +257,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
> > >              pdev->device == PCI_DEVICE_ID_INTEL_DNV_XHCI))
> > >                 xhci->quirks |= XHCI_MISSING_CAS;
> > >
> > > +       if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
> > > +           pdev->device == PCI_DEVICE_ID_INTEL_ALDER_LAKE_PCH_XHCI)
> >
> > We need this quirk for ADL-N too (device ID 0x54ed). Would you mind
> > updating the patch? Or I can send a separate patch if you prefer.
>
> A separate patch is required, please submit it.

Done, thanks.
https://lore.kernel.org/linux-usb/20221027053407.421783-1-rekanorman@chromium.org

>
> thanks,
>
> greg k-h

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 0/4] xhci fixes for usb-linus
@ 2024-01-25 15:27 Mathias Nyman
  0 siblings, 0 replies; 13+ messages in thread
From: Mathias Nyman @ 2024-01-25 15:27 UTC (permalink / raw)
  To: gregkh; +Cc: linux-usb, Mathias Nyman

Hi Greg

This series fixes gaps discovered in isochronous transfer error
handling, and a couple small issues in the newly added secondary
interrupter code (6.8-rc1).

Thanks
-Mathias

Mathias Nyman (3):
  xhci: fix possible null pointer dereference at secondary interrupter
    removal
  xhci: fix off by one check when adding a secondary interrupter.
  xhci: process isoc TD properly when there was a transaction error mid
    TD.

Michal Pecio (1):
  xhci: handle isoc Babble and Buffer Overrun events properly

 drivers/usb/host/xhci-mem.c  | 14 +++----
 drivers/usb/host/xhci-ring.c | 80 +++++++++++++++++++++++++++++-------
 drivers/usb/host/xhci.h      |  1 +
 3 files changed, 73 insertions(+), 22 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 0/4] xhci fixes for usb-linus
@ 2023-09-15 14:31 Mathias Nyman
  0 siblings, 0 replies; 13+ messages in thread
From: Mathias Nyman @ 2023-09-15 14:31 UTC (permalink / raw)
  To: gregkh; +Cc: linux-usb, Mathias Nyman

Hi Greg

A few small xhci fixes for 6.6

Use correct dev in dma bounce buffer mapping, fix event handling
issues, and track suspended ports correctly in software

Thanks
Mathias

Lukas Wunner (2):
  xhci: Clear EHB bit only at end of interrupt handler
  xhci: Preserve RsvdP bits in ERSTBA register correctly

Mathias Nyman (1):
  xhci: track port suspend state correctly in unsuccessful resume cases

Wesley Cheng (1):
  usb: xhci: xhci-ring: Use sysdev for mapping bounce buffer

 drivers/usb/host/xhci-hub.c  | 19 ++++++++++---------
 drivers/usb/host/xhci-mem.c  |  4 ++--
 drivers/usb/host/xhci-ring.c | 16 +++++++++-------
 drivers/usb/host/xhci.h      |  2 +-
 4 files changed, 22 insertions(+), 19 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 0/4] xhci fixes for usb-linus
@ 2022-06-23 11:19 Mathias Nyman
  0 siblings, 0 replies; 13+ messages in thread
From: Mathias Nyman @ 2022-06-23 11:19 UTC (permalink / raw)
  To: gregkh; +Cc: linux-usb, Mathias Nyman

Hi Greg

A few xhci fixes for 5.19
Adding a couple PCI IDs, turning off port power in shutdown, and delay
xHC interrupt generation until host is running.

Thanks
Mathias

Hongyu Xie (1):
  xhci: Keep interrupt disabled in initialization until host is running.

Mathias Nyman (1):
  xhci: turn off port power in shutdown

Tanveer Alam (1):
  xhci-pci: Allow host runtime PM as default for Intel Raptor Lake xHCI

Utkarsh Patel (1):
  xhci-pci: Allow host runtime PM as default for Intel Meteor Lake xHCI

 drivers/usb/host/xhci-hub.c |  2 +-
 drivers/usb/host/xhci-pci.c |  6 ++++-
 drivers/usb/host/xhci.c     | 50 ++++++++++++++++++++++++++-----------
 drivers/usb/host/xhci.h     |  2 ++
 4 files changed, 43 insertions(+), 17 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 0/4] xhci fixes for usb-linus
@ 2021-03-11 11:53 Mathias Nyman
  0 siblings, 0 replies; 13+ messages in thread
From: Mathias Nyman @ 2021-03-11 11:53 UTC (permalink / raw)
  To: gregkh; +Cc: linux-usb, Mathias Nyman

Hi Greg

Fix a couple power management related xHCI issues, and a couple
vendor specific workarounds.

-Mathias

Forest Crossman (1):
  usb: xhci: Fix ASMedia ASM1042A and ASM3242 DMA addressing

Mathias Nyman (2):
  xhci: Improve detection of device initiated wake signal.
  xhci: Fix repeated xhci wake after suspend due to uncleared internal
    wake state

Stanislaw Gruszka (1):
  usb: xhci: do not perform Soft Retry for some xHCI hosts

 drivers/usb/host/xhci-pci.c  | 13 +++++-
 drivers/usb/host/xhci-ring.c |  3 +-
 drivers/usb/host/xhci.c      | 78 ++++++++++++++++++++----------------
 drivers/usb/host/xhci.h      |  1 +
 4 files changed, 57 insertions(+), 38 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 0/4] xhci fixes for usb-linus
@ 2020-02-10 13:45 Mathias Nyman
  0 siblings, 0 replies; 13+ messages in thread
From: Mathias Nyman @ 2020-02-10 13:45 UTC (permalink / raw)
  To: gregkh; +Cc: linux-usb, Mathias Nyman

Hi Greg

A few xhci fixes resolving an issue entering runtime suspend PCI D3 for
some Intel hosts, fixing a memory leak, and forcing max packet size to
valid values allowing some older FS devices to function with xhci.

-Mathias

Mathias Nyman (4):
  xhci: Force Maximum Packet size for Full-speed bulk devices to valid
    range.
  xhci: Fix memory leak when caching protocol extended capability PSI
    tables
  xhci: fix runtime pm enabling for quirky Intel hosts
  xhci: apply XHCI_PME_STUCK_QUIRK to Intel Comet Lake platforms

 drivers/usb/host/xhci-hub.c | 25 ++++++++-----
 drivers/usb/host/xhci-mem.c | 70 ++++++++++++++++++++++++-------------
 drivers/usb/host/xhci-pci.c | 10 +++---
 drivers/usb/host/xhci.h     | 14 ++++++--
 4 files changed, 79 insertions(+), 40 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-01-25 15:26 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-24 14:27 [PATCH 0/4] xhci fixes for usb-linus Mathias Nyman
2022-10-24 14:27 ` [PATCH 1/4] usb: xhci: add XHCI_SPURIOUS_SUCCESS to ASM1042 despite being a V0.96 controller Mathias Nyman
2022-10-24 14:27 ` [PATCH 2/4] xhci: Add quirk to reset host back to default state at shutdown Mathias Nyman
2022-10-26  6:40   ` Reka Norman
2022-10-26  7:00     ` Greg KH
2022-10-27  5:42       ` Reka Norman
2022-10-24 14:27 ` [PATCH 3/4] xhci-pci: Set runtime PM as default policy on all xHC 1.2 or later devices Mathias Nyman
2022-10-24 14:27 ` [PATCH 4/4] xhci: Remove device endpoints from bandwidth list when freeing the device Mathias Nyman
  -- strict thread matches above, loose matches on Subject: below --
2024-01-25 15:27 [PATCH 0/4] xhci fixes for usb-linus Mathias Nyman
2023-09-15 14:31 Mathias Nyman
2022-06-23 11:19 Mathias Nyman
2021-03-11 11:53 Mathias Nyman
2020-02-10 13:45 Mathias Nyman

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.