All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] usb: host: add XHCI_CDNS_HOST flag
@ 2020-10-22  3:01 Peter Chen
  2020-10-22  3:01 ` [PATCH 2/2] usb: host: xhci-plat: forbid runtime pm conditionally Peter Chen
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Peter Chen @ 2020-10-22  3:01 UTC (permalink / raw)
  To: mathias.nyman
  Cc: linux-usb, gregkh, linux-imx, jun.li, Peter Chen, Pawel Laszczak,
	Roger Quadros

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

Cc: Pawel Laszczak <pawell@cadence.com>
Cc: Roger Quadros <rogerq@ti.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
 drivers/usb/host/xhci.c | 2 +-
 drivers/usb/host/xhci.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 482fe8c5e3b4..fc72a03dc27f 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -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,
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 8be88379c0fb..4b7275c73ea5 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -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;
-- 
2.17.1


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

* [PATCH 2/2] usb: host: xhci-plat: forbid runtime pm conditionally
  2020-10-22  3:01 [PATCH 1/2] usb: host: add XHCI_CDNS_HOST flag Peter Chen
@ 2020-10-22  3:01 ` Peter Chen
  2020-10-22  6:48 ` [PATCH 1/2] usb: host: add XHCI_CDNS_HOST flag Roger Quadros
  2020-10-26 15:02 ` Mathias Nyman
  2 siblings, 0 replies; 10+ messages in thread
From: Peter Chen @ 2020-10-22  3:01 UTC (permalink / raw)
  To: mathias.nyman; +Cc: linux-usb, gregkh, linux-imx, jun.li, Peter Chen

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

Reviewed-by: Jun Li <jun.li@nxp.com>
Reviewed-by: Ran Wang <ran.wang_1@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
 drivers/usb/host/xhci-plat.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index aa2d35f98200..effb4f0586ae 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -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;
 
-- 
2.17.1


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

* Re: [PATCH 1/2] usb: host: add XHCI_CDNS_HOST flag
  2020-10-22  3:01 [PATCH 1/2] usb: host: add XHCI_CDNS_HOST flag Peter Chen
  2020-10-22  3:01 ` [PATCH 2/2] usb: host: xhci-plat: forbid runtime pm conditionally Peter Chen
@ 2020-10-22  6:48 ` Roger Quadros
  2020-10-22  7:17   ` Peter Chen
  2020-10-26 15:02 ` Mathias Nyman
  2 siblings, 1 reply; 10+ messages in thread
From: Roger Quadros @ 2020-10-22  6:48 UTC (permalink / raw)
  To: Peter Chen, mathias.nyman
  Cc: linux-usb, gregkh, linux-imx, jun.li, Pawel Laszczak

Hi Peter,

On 22/10/2020 06:01, Peter Chen wrote:
> The Cadence xHCI host has the same issue with Intel's,

s/with/as

> 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
> 
> Cc: Pawel Laszczak <pawell@cadence.com>
> Cc: Roger Quadros <rogerq@ti.com>
> Signed-off-by: Peter Chen <peter.chen@nxp.com>
> ---
>   drivers/usb/host/xhci.c | 2 +-
>   drivers/usb/host/xhci.h | 1 +
>   2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index 482fe8c5e3b4..fc72a03dc27f 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -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,
> diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
> index 8be88379c0fb..4b7275c73ea5 100644
> --- a/drivers/usb/host/xhci.h
> +++ b/drivers/usb/host/xhci.h
> @@ -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;
> 

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* RE: [PATCH 1/2] usb: host: add XHCI_CDNS_HOST flag
  2020-10-22  6:48 ` [PATCH 1/2] usb: host: add XHCI_CDNS_HOST flag Roger Quadros
@ 2020-10-22  7:17   ` Peter Chen
  0 siblings, 0 replies; 10+ messages in thread
From: Peter Chen @ 2020-10-22  7:17 UTC (permalink / raw)
  To: Roger Quadros, mathias.nyman
  Cc: linux-usb, gregkh, dl-linux-imx, Jun Li, Pawel Laszczak

 
> 
> On 22/10/2020 06:01, Peter Chen wrote:
> > The Cadence xHCI host has the same issue with Intel's,
> 
> s/with/as
> 
> > 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

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

* Re: [PATCH 1/2] usb: host: add XHCI_CDNS_HOST flag
  2020-10-22  3:01 [PATCH 1/2] usb: host: add XHCI_CDNS_HOST flag Peter Chen
  2020-10-22  3:01 ` [PATCH 2/2] usb: host: xhci-plat: forbid runtime pm conditionally Peter Chen
  2020-10-22  6:48 ` [PATCH 1/2] usb: host: add XHCI_CDNS_HOST flag Roger Quadros
@ 2020-10-26 15:02 ` Mathias Nyman
  2020-10-27  1:50   ` Peter Chen
  2 siblings, 1 reply; 10+ messages in thread
From: Mathias Nyman @ 2020-10-26 15:02 UTC (permalink / raw)
  To: Peter Chen, mathias.nyman
  Cc: linux-usb, gregkh, linux-imx, jun.li, Pawel Laszczak, Roger Quadros

On 22.10.2020 6.01, Peter Chen wrote:
> The Cadence xHCI host has the same issue with Intel's,
> it is triggered by reboot stress test.
> 
> Cc: Pawel Laszczak <pawell@cadence.com>
> Cc: Roger Quadros <rogerq@ti.com>
> Signed-off-by: Peter Chen <peter.chen@nxp.com>
> ---
>  drivers/usb/host/xhci.c | 2 +-
>  drivers/usb/host/xhci.h | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index 482fe8c5e3b4..fc72a03dc27f 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -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,
> diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
> index 8be88379c0fb..4b7275c73ea5 100644
> --- a/drivers/usb/host/xhci.h
> +++ b/drivers/usb/host/xhci.h
> @@ -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

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

* RE: [PATCH 1/2] usb: host: add XHCI_CDNS_HOST flag
  2020-10-26 15:02 ` Mathias Nyman
@ 2020-10-27  1:50   ` Peter Chen
  2020-10-27  8:33     ` Mathias Nyman
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Chen @ 2020-10-27  1:50 UTC (permalink / raw)
  To: Mathias Nyman, mathias.nyman
  Cc: linux-usb, gregkh, dl-linux-imx, Jun Li, Pawel Laszczak, Roger Quadros

 
> > Cc: Pawel Laszczak <pawell@cadence.com>
> > Cc: Roger Quadros <rogerq@ti.com>
> > Signed-off-by: Peter Chen <peter.chen@nxp.com>
> > ---
> >  drivers/usb/host/xhci.c | 2 +-
> >  drivers/usb/host/xhci.h | 1 +
> >  2 files changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index
> > 482fe8c5e3b4..fc72a03dc27f 100644
> > --- a/drivers/usb/host/xhci.c
> > +++ b/drivers/usb/host/xhci.c
> > @@ -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,
> > diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index
> > 8be88379c0fb..4b7275c73ea5 100644
> > --- a/drivers/usb/host/xhci.h
> > +++ b/drivers/usb/host/xhci.h
> > @@ -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?
> 

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

Peter



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

* Re: [PATCH 1/2] usb: host: add XHCI_CDNS_HOST flag
  2020-10-27  1:50   ` Peter Chen
@ 2020-10-27  8:33     ` Mathias Nyman
  2020-10-27  9:50       ` Peter Chen
  0 siblings, 1 reply; 10+ messages in thread
From: Mathias Nyman @ 2020-10-27  8:33 UTC (permalink / raw)
  To: Peter Chen, mathias.nyman
  Cc: linux-usb, gregkh, dl-linux-imx, Jun Li, Pawel Laszczak, Roger Quadros

On 27.10.2020 3.50, Peter Chen wrote:
>  
>>> Cc: Pawel Laszczak <pawell@cadence.com>
>>> Cc: Roger Quadros <rogerq@ti.com>
>>> Signed-off-by: Peter Chen <peter.chen@nxp.com>
>>> ---
>>>  drivers/usb/host/xhci.c | 2 +-
>>>  drivers/usb/host/xhci.h | 1 +
>>>  2 files changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index
>>> 482fe8c5e3b4..fc72a03dc27f 100644
>>> --- a/drivers/usb/host/xhci.c
>>> +++ b/drivers/usb/host/xhci.c
>>> @@ -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,
>>> diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index
>>> 8be88379c0fb..4b7275c73ea5 100644
>>> --- a/drivers/usb/host/xhci.h
>>> +++ b/drivers/usb/host/xhci.h
>>> @@ -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?
>>
> 
> 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


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

* Re: [PATCH 1/2] usb: host: add XHCI_CDNS_HOST flag
  2020-10-27  8:33     ` Mathias Nyman
@ 2020-10-27  9:50       ` Peter Chen
  2020-10-28  7:02         ` Peter Chen
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Chen @ 2020-10-27  9:50 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: mathias.nyman, linux-usb, gregkh, dl-linux-imx, Jun Li,
	Pawel Laszczak, Roger Quadros

On 20-10-27 10:33:52, Mathias Nyman wrote:
> On 27.10.2020 3.50, Peter Chen wrote:
> >  
> >>> Cc: Pawel Laszczak <pawell@cadence.com>
> >>> Cc: Roger Quadros <rogerq@ti.com>
> >>> Signed-off-by: Peter Chen <peter.chen@nxp.com>
> >>> ---
> >>>  drivers/usb/host/xhci.c | 2 +-
> >>>  drivers/usb/host/xhci.h | 1 +
> >>>  2 files changed, 2 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index
> >>> 482fe8c5e3b4..fc72a03dc27f 100644
> >>> --- a/drivers/usb/host/xhci.c
> >>> +++ b/drivers/usb/host/xhci.c
> >>> @@ -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,
> >>> diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index
> >>> 8be88379c0fb..4b7275c73ea5 100644
> >>> --- a/drivers/usb/host/xhci.h
> >>> +++ b/drivers/usb/host/xhci.h
> >>> @@ -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?
> >>
> > 
> > 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.

-- 

Thanks,
Peter Chen

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

* RE: [PATCH 1/2] usb: host: add XHCI_CDNS_HOST flag
  2020-10-27  9:50       ` Peter Chen
@ 2020-10-28  7:02         ` Peter Chen
  2020-10-30 23:14           ` Peter Chen
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Chen @ 2020-10-28  7:02 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: mathias.nyman, linux-usb, gregkh, dl-linux-imx, Jun Li,
	Pawel Laszczak, Roger Quadros

 
> > >>>
> > >>>  	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
> >
> 
> 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/20201022013930.2166-1-peter.chen@nxp.com/

Peter

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

* RE: [PATCH 1/2] usb: host: add XHCI_CDNS_HOST flag
  2020-10-28  7:02         ` Peter Chen
@ 2020-10-30 23:14           ` Peter Chen
  0 siblings, 0 replies; 10+ messages in thread
From: Peter Chen @ 2020-10-30 23:14 UTC (permalink / raw)
  To: Mathias Nyman, Roger Quadros
  Cc: mathias.nyman, linux-usb, gregkh, dl-linux-imx, Jun Li, Pawel Laszczak

 
> >
> > 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/20201022013930.2166-1
> -peter.chen@nxp.com/
> 
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

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

end of thread, other threads:[~2020-10-30 23:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-22  3:01 [PATCH 1/2] usb: host: add XHCI_CDNS_HOST flag Peter Chen
2020-10-22  3:01 ` [PATCH 2/2] usb: host: xhci-plat: forbid runtime pm conditionally Peter Chen
2020-10-22  6:48 ` [PATCH 1/2] usb: host: add XHCI_CDNS_HOST flag Roger Quadros
2020-10-22  7:17   ` Peter Chen
2020-10-26 15:02 ` Mathias Nyman
2020-10-27  1:50   ` Peter Chen
2020-10-27  8:33     ` Mathias Nyman
2020-10-27  9:50       ` Peter Chen
2020-10-28  7:02         ` Peter Chen
2020-10-30 23:14           ` Peter Chen

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.