Skip to contentSkip to conversation

usb: host: add XHCI_CDNS_HOST flag

PATCH In review Peter Chen 3 participants 10 messages Oct 22, 2020 – Oct 30, 2020

Subsystems (2)
lore
Share & tools
lore

Peter Chen

author
#0 lore raw

PATCH 1/2 usb: host: add XHCI_CDNS_HOST flag

The Cadence xHCI host has the same issue with Intel's, it is triggered by reboot stress test.

Cc Pawel Laszczak <[email protected]>
Cc Roger Quadros <[email protected]>
---
 drivers/usb/host/xhci.c | 2 +-
 drivers/usb/host/xhci.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/usb/host/xhci.c +1 -1
index 482fe8c5e3b4..fc72a03dc27f 100644
@@ -193,7 +193,7 @@ int xhci_reset(struct xhci_hcd *xhci)
 	 * Without this delay, the subsequent HC register access,
 	 * may result in a system hang very rarely.
 	 */
-	if (xhci->quirks & XHCI_INTEL_HOST)
+	if (xhci->quirks & (XHCI_INTEL_HOST | XHCI_CDNS_HOST))
 		udelay(1000);
 
 	ret = xhci_handshake(&xhci->op_regs->command,
drivers/usb/host/xhci.h +1 -0
index 8be88379c0fb..4b7275c73ea5 100644
@@ -1877,6 +1877,7 @@ struct xhci_hcd {
 #define XHCI_SNPS_BROKEN_SUSPEND    BIT_ULL(35)
 #define XHCI_RENESAS_FW_QUIRK	BIT_ULL(36)
 #define XHCI_SKIP_PHY_INIT	BIT_ULL(37)
+#define XHCI_CDNS_HOST		BIT_ULL(38)
 
 	unsigned int		num_active_eps;
 	unsigned int		limit_active_eps;
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 2/2 usb: host: xhci-plat: forbid runtime pm conditionally

Some users may want to enable runtime pm by default, using the quirk to judge it.

---
 drivers/usb/host/xhci-plat.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-plat.c +2 -1
index aa2d35f98200..effb4f0586ae 100644
@@ -351,7 +351,8 @@ static int xhci_plat_probe(struct platform_device *pdev)
 	 * Prevent runtime pm from being on as default, users should enable
 	 * runtime pm using power/control in sysfs.
 	 */
-	pm_runtime_forbid(&pdev->dev);
+	if (!(xhci->quirks & XHCI_DEFAULT_PM_RUNTIME_ALLOW))
+		pm_runtime_forbid(&pdev->dev);
 
 	return 0;
 
Signature · 1 line
2.17.1
#2 lore raw
In reply to Peter Chen

Hi Peter,

Quoted 1 line · Peter Chen

The Cadence xHCI host has the same issue with Intel's,

s/with/as

Quoted 1 line

it is triggered by reboot stress test.

Can you please provide some more details about the test so I can try at my end. Thanks.

cheers,
-roger

Quoted 35 lines
Cc Pawel Laszczak <[email protected]>
Cc Roger Quadros <[email protected]>
---
  drivers/usb/host/xhci.c | 2 +-
  drivers/usb/host/xhci.h | 1 +
  2 files changed, 2 insertions(+), 1 deletion(-)
drivers/usb/host/xhci.c +1 -1
index 482fe8c5e3b4..fc72a03dc27f 100644
@@ -193,7 +193,7 @@ int xhci_reset(struct xhci_hcd *xhci)
  	 * Without this delay, the subsequent HC register access,
  	 * may result in a system hang very rarely.
  	 */
-	if (xhci->quirks & XHCI_INTEL_HOST)
+	if (xhci->quirks & (XHCI_INTEL_HOST | XHCI_CDNS_HOST))
  		udelay(1000);
 
  	ret = xhci_handshake(&xhci->op_regs->command,
drivers/usb/host/xhci.h +1 -0
index 8be88379c0fb..4b7275c73ea5 100644
@@ -1877,6 +1877,7 @@ struct xhci_hcd {
  #define XHCI_SNPS_BROKEN_SUSPEND    BIT_ULL(35)
  #define XHCI_RENESAS_FW_QUIRK	BIT_ULL(36)
  #define XHCI_SKIP_PHY_INIT	BIT_ULL(37)
+#define XHCI_CDNS_HOST		BIT_ULL(38)
 
  	unsigned int		num_active_eps;
  	unsigned int		limit_active_eps;
Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
author
#3 lore raw
Quoted 12 lines · Peter Chen
Quoted 1 line

The Cadence xHCI host has the same issue with Intel's,

s/with/as

Quoted 1 line

it is triggered by reboot stress test.

Can you please provide some more details about the test so I can try at my end. Thanks.

Connect USB3 Drive at port, and reboot system over night.

Peter

#4 lore raw
In reply to Peter Chen
Quoted 30 lines · Peter Chen

The Cadence xHCI host has the same issue with Intel's, it is triggered by reboot stress test.

Cc Pawel Laszczak <[email protected]>
Cc Roger Quadros <[email protected]>
---
 drivers/usb/host/xhci.c | 2 +-
 drivers/usb/host/xhci.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/usb/host/xhci.c +1 -1
index 482fe8c5e3b4..fc72a03dc27f 100644
@@ -193,7 +193,7 @@ int xhci_reset(struct xhci_hcd *xhci)
 	 * Without this delay, the subsequent HC register access,
 	 * may result in a system hang very rarely.
 	 */
-	if (xhci->quirks & XHCI_INTEL_HOST)
+	if (xhci->quirks & (XHCI_INTEL_HOST | XHCI_CDNS_HOST))
 		udelay(1000);
 
 	ret = xhci_handshake(&xhci->op_regs->command,
drivers/usb/host/xhci.h +0 -0
index 8be88379c0fb..4b7275c73ea5 100644

drivers/usb/host/xhci.h struct xhci_hcd { · line 1883

Quoted 7 lines
drivers/usb/host/xhci.h +1 -0
@@ -1877,6 +1877,7 @@ struct xhci_hcd {
 #define XHCI_SNPS_BROKEN_SUSPEND    BIT_ULL(35)
 #define XHCI_RENESAS_FW_QUIRK	BIT_ULL(36)
 #define XHCI_SKIP_PHY_INIT	BIT_ULL(37)
+#define XHCI_CDNS_HOST		BIT_ULL(38)
 
 	unsigned int		num_active_eps;
 	unsigned int		limit_active_eps;

Is the XHCI_CDNS_HOST quirk bit set in some other patchseries?

-Mathias

author
#5 lore raw
Quoted 32 lines
Quoted 32 lines
Cc Pawel Laszczak <[email protected]>
Cc Roger Quadros <[email protected]>
---
 drivers/usb/host/xhci.c | 2 +-
 drivers/usb/host/xhci.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/usb/host/xhci.c index renamed from drivers/usb/host/xhci.c +0 -0

482fe8c5e3b4..fc72a03dc27f 100644

drivers/usb/host/xhci.c +1 -1
@@ -193,7 +193,7 @@ int xhci_reset(struct xhci_hcd *xhci)
 	 * Without this delay, the subsequent HC register access,
 	 * may result in a system hang very rarely.
 	 */
-	if (xhci->quirks & XHCI_INTEL_HOST)
+	if (xhci->quirks & (XHCI_INTEL_HOST | XHCI_CDNS_HOST))
 		udelay(1000);
 
 	ret = xhci_handshake(&xhci->op_regs->command,
drivers/usb/host/xhci.h index renamed from drivers/usb/host/xhci.h +0 -0

8be88379c0fb..4b7275c73ea5 100644

drivers/usb/host/xhci.h +1 -0
@@ -1877,6 +1877,7 @@ struct xhci_hcd {
 #define XHCI_SNPS_BROKEN_SUSPEND    BIT_ULL(35)
 #define XHCI_RENESAS_FW_QUIRK	BIT_ULL(36)
 #define XHCI_SKIP_PHY_INIT	BIT_ULL(37)
+#define XHCI_CDNS_HOST		BIT_ULL(38)
 
Quoted 6 lines

drivers/usb/host/xhci.h struct xhci_hcd { · line 1883

Quoted 3 lines
drivers/usb/host/xhci.h +0 -0
 	unsigned int		num_active_eps;
 	unsigned int		limit_active_eps;

Is the XHCI_CDNS_HOST quirk bit set in some other patchseries?

Currently, no, only at the function of xhci_reset in this commit.

Peter

#6 lore raw
Quoted 32 lines · Peter Chen
Quoted 32 lines
Quoted 32 lines
Cc Pawel Laszczak <[email protected]>
Cc Roger Quadros <[email protected]>
---
 drivers/usb/host/xhci.c | 2 +-
 drivers/usb/host/xhci.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/usb/host/xhci.c index renamed from drivers/usb/host/xhci.c +0 -0

482fe8c5e3b4..fc72a03dc27f 100644

drivers/usb/host/xhci.c +1 -1
@@ -193,7 +193,7 @@ int xhci_reset(struct xhci_hcd *xhci)
 	 * Without this delay, the subsequent HC register access,
 	 * may result in a system hang very rarely.
 	 */
-	if (xhci->quirks & XHCI_INTEL_HOST)
+	if (xhci->quirks & (XHCI_INTEL_HOST | XHCI_CDNS_HOST))
 		udelay(1000);
 
 	ret = xhci_handshake(&xhci->op_regs->command,
drivers/usb/host/xhci.h index renamed from drivers/usb/host/xhci.h +0 -0

8be88379c0fb..4b7275c73ea5 100644

drivers/usb/host/xhci.h +1 -0
@@ -1877,6 +1877,7 @@ struct xhci_hcd {
 #define XHCI_SNPS_BROKEN_SUSPEND    BIT_ULL(35)
 #define XHCI_RENESAS_FW_QUIRK	BIT_ULL(36)
 #define XHCI_SKIP_PHY_INIT	BIT_ULL(37)
+#define XHCI_CDNS_HOST		BIT_ULL(38)
 
Quoted 8 lines
Quoted 6 lines

drivers/usb/host/xhci.h struct xhci_hcd { · line 1883

Quoted 3 lines
drivers/usb/host/xhci.h +0 -0
 	unsigned int		num_active_eps;
 	unsigned int		limit_active_eps;

Is the XHCI_CDNS_HOST quirk bit set in some other patchseries?

Currently, no, only at the function of xhci_reset in this commit.

I can only see it being checked, not set. Am I missing something?

-Mathias

author
#7 lore raw
Quoted 40 lines · Mathias Nyman
Quoted 39 lines · Peter Chen
Quoted 38 lines
Quoted 28 lines
Cc Pawel Laszczak <[email protected]>
Cc Roger Quadros <[email protected]>
---
 drivers/usb/host/xhci.c | 2 +-
 drivers/usb/host/xhci.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/usb/host/xhci.c index renamed from drivers/usb/host/xhci.c +0 -0

482fe8c5e3b4..fc72a03dc27f 100644

drivers/usb/host/xhci.c +1 -1
@@ -193,7 +193,7 @@ int xhci_reset(struct xhci_hcd *xhci)
 	 * Without this delay, the subsequent HC register access,
 	 * may result in a system hang very rarely.
 	 */
-	if (xhci->quirks & XHCI_INTEL_HOST)
+	if (xhci->quirks & (XHCI_INTEL_HOST | XHCI_CDNS_HOST))
 		udelay(1000);
 
 	ret = xhci_handshake(&xhci->op_regs->command,
drivers/usb/host/xhci.h index renamed from drivers/usb/host/xhci.h +0 -0

8be88379c0fb..4b7275c73ea5 100644

drivers/usb/host/xhci.h struct xhci_hcd { · line 1883

Quoted 7 lines
drivers/usb/host/xhci.h +1 -0
@@ -1877,6 +1877,7 @@ struct xhci_hcd {
 #define XHCI_SNPS_BROKEN_SUSPEND    BIT_ULL(35)
 #define XHCI_RENESAS_FW_QUIRK	BIT_ULL(36)
 #define XHCI_SKIP_PHY_INIT	BIT_ULL(37)
+#define XHCI_CDNS_HOST		BIT_ULL(38)
 
 	unsigned int		num_active_eps;
 	unsigned int		limit_active_eps;

Is the XHCI_CDNS_HOST quirk bit set in some other patchseries?

Quoted 6 lines
Quoted 1 line

Currently, no, only at the function of xhci_reset in this commit.

I can only see it being checked, not set. Am I missing something?

-Mathias

Oh, there is a missing patch for cdns3 host change, the code is located at drivers/usb/cdns3/host.c. I will merge them together, and send v2.

Signature · 2 lines
Thanks,
Peter Chen
author
#8 lore raw
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 8 lines

drivers/usb/host/xhci.h struct xhci_hcd { · line 1883

Quoted 5 lines
drivers/usb/host/xhci.h +0 -0
 	unsigned int		num_active_eps;
 	unsigned int		limit_active_eps;

Is the XHCI_CDNS_HOST quirk bit set in some other patchseries?

Currently, no, only at the function of xhci_reset in this commit.

Quoted 8 lines
Quoted 4 lines

I can only see it being checked, not set. Am I missing something?

-Mathias

Oh, there is a missing patch for cdns3 host change, the code is located at drivers/usb/cdns3/host.c. I will merge them together, and send v2.

Mathias, adding XHCI_CDNS_HOST quirk at cdns3 part depends on some reviewing patches [1], these patches add the struct xhci_plat_priv with other quirks first. Would you help queue these cdns3 host patches after reviewing? Or what's the suggestion to handle this dependency? Thanks.

[1] https://patchwork.kernel.org/project/linux-usb/patch/[email protected]/

Peter

author
#9 lore raw
Quoted 6 lines
Quoted 5 lines

Oh, there is a missing patch for cdns3 host change, the code is located at drivers/usb/cdns3/host.c. I will merge them together, and send v2.

Quoted 9 lines

Mathias, adding XHCI_CDNS_HOST quirk at cdns3 part depends on some reviewing patches [1], these patches add the struct xhci_plat_priv with other quirks first. Would you help queue these cdns3 host patches after reviewing? Or what's the suggestion to handle this dependency? Thanks.

[1]
https://patchwork.kernel.org/project/linux-usb/patch/20201022013930.2166-1
[email protected]/

I think we may not need this patch at upstream kernel, I run the test overnight, and could not reproduce hang issue. @Roger Quadros, did you meet hang at the reboot stress test?

Peter