* [PATCH] usb: host: xhci: Do not re-initialize the XHCI HC if being removed
@ 2023-05-23 1:53 Wesley Cheng
2023-05-23 8:45 ` Sergey Shtylyov
0 siblings, 1 reply; 4+ messages in thread
From: Wesley Cheng @ 2023-05-23 1:53 UTC (permalink / raw)
To: mathias.nyman, gregkh; +Cc: linux-kernel, linux-usb, quic_jackp, Wesley Cheng
During XHCI resume, if there was a host controller error detected the
routine will attempt to re-initialize the XHCI HC, so that it can return
back to an operational state. If the XHCI host controller is being
removed, this sequence would be already handled within the XHCI halt path,
leading to a duplicate set of reg ops/calls. In addition, since the XHCI
bus is being removed, the overhead added in restarting the HCD is
unnecessary. Check for the XHC state before setting the reinit_xhc
parameter, which is responsible for triggering the restart.
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
---
drivers/usb/host/xhci.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index b81313ffeb76..2017ed3ae4a7 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1028,7 +1028,8 @@ int xhci_resume(struct xhci_hcd *xhci, pm_message_t msg)
temp = readl(&xhci->op_regs->status);
/* re-initialize the HC on Restore Error, or Host Controller Error */
- if (temp & (STS_SRE | STS_HCE)) {
+ if ((temp & (STS_SRE | STS_HCE)) &&
+ !(xhci->xhc_state & XHCI_STATE_REMOVING)) {
reinit_xhc = true;
if (!xhci->broken_suspend)
xhci_warn(xhci, "xHC error in resume, USBSTS 0x%x, Reinit\n", temp);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] usb: host: xhci: Do not re-initialize the XHCI HC if being removed
2023-05-23 1:53 [PATCH] usb: host: xhci: Do not re-initialize the XHCI HC if being removed Wesley Cheng
@ 2023-05-23 8:45 ` Sergey Shtylyov
2023-05-23 16:33 ` Greg KH
0 siblings, 1 reply; 4+ messages in thread
From: Sergey Shtylyov @ 2023-05-23 8:45 UTC (permalink / raw)
To: Wesley Cheng, mathias.nyman, gregkh; +Cc: linux-kernel, linux-usb, quic_jackp
Hello!
On 5/23/23 4:53 AM, Wesley Cheng wrote:
> During XHCI resume, if there was a host controller error detected the
> routine will attempt to re-initialize the XHCI HC, so that it can return
> back to an operational state. If the XHCI host controller is being
> removed, this sequence would be already handled within the XHCI halt path,
> leading to a duplicate set of reg ops/calls. In addition, since the XHCI
> bus is being removed, the overhead added in restarting the HCD is
> unnecessary. Check for the XHC state before setting the reinit_xhc
> parameter, which is responsible for triggering the restart.
>
> Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
> ---
> drivers/usb/host/xhci.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index b81313ffeb76..2017ed3ae4a7 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -1028,7 +1028,8 @@ int xhci_resume(struct xhci_hcd *xhci, pm_message_t msg)
> temp = readl(&xhci->op_regs->status);
>
> /* re-initialize the HC on Restore Error, or Host Controller Error */
> - if (temp & (STS_SRE | STS_HCE)) {
> + if ((temp & (STS_SRE | STS_HCE)) &&
> + !(xhci->xhc_state & XHCI_STATE_REMOVING)) {
Please add one more tab here in order not to blend it with the following lines.
> reinit_xhc = true;
> if (!xhci->broken_suspend)
> xhci_warn(xhci, "xHC error in resume, USBSTS 0x%x, Reinit\n", temp);
MBR, Sergey
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] usb: host: xhci: Do not re-initialize the XHCI HC if being removed
2023-05-23 8:45 ` Sergey Shtylyov
@ 2023-05-23 16:33 ` Greg KH
2023-05-23 16:42 ` Sergey Shtylyov
0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2023-05-23 16:33 UTC (permalink / raw)
To: Sergey Shtylyov
Cc: Wesley Cheng, mathias.nyman, linux-kernel, linux-usb, quic_jackp
On Tue, May 23, 2023 at 11:45:27AM +0300, Sergey Shtylyov wrote:
> Hello!
>
> On 5/23/23 4:53 AM, Wesley Cheng wrote:
>
> > During XHCI resume, if there was a host controller error detected the
> > routine will attempt to re-initialize the XHCI HC, so that it can return
> > back to an operational state. If the XHCI host controller is being
> > removed, this sequence would be already handled within the XHCI halt path,
> > leading to a duplicate set of reg ops/calls. In addition, since the XHCI
> > bus is being removed, the overhead added in restarting the HCD is
> > unnecessary. Check for the XHC state before setting the reinit_xhc
> > parameter, which is responsible for triggering the restart.
> >
> > Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
> > ---
> > drivers/usb/host/xhci.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> > index b81313ffeb76..2017ed3ae4a7 100644
> > --- a/drivers/usb/host/xhci.c
> > +++ b/drivers/usb/host/xhci.c
> > @@ -1028,7 +1028,8 @@ int xhci_resume(struct xhci_hcd *xhci, pm_message_t msg)
> > temp = readl(&xhci->op_regs->status);
> >
> > /* re-initialize the HC on Restore Error, or Host Controller Error */
> > - if (temp & (STS_SRE | STS_HCE)) {
> > + if ((temp & (STS_SRE | STS_HCE)) &&
> > + !(xhci->xhc_state & XHCI_STATE_REMOVING)) {
>
> Please add one more tab here in order not to blend it with the following lines.
Ick, no, please do not do that, it needs to move left instead.
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] usb: host: xhci: Do not re-initialize the XHCI HC if being removed
2023-05-23 16:33 ` Greg KH
@ 2023-05-23 16:42 ` Sergey Shtylyov
0 siblings, 0 replies; 4+ messages in thread
From: Sergey Shtylyov @ 2023-05-23 16:42 UTC (permalink / raw)
To: Greg KH; +Cc: Wesley Cheng, mathias.nyman, linux-kernel, linux-usb, quic_jackp
On 5/23/23 7:33 PM, Greg KH wrote:
>>> During XHCI resume, if there was a host controller error detected the
>>> routine will attempt to re-initialize the XHCI HC, so that it can return
>>> back to an operational state. If the XHCI host controller is being
>>> removed, this sequence would be already handled within the XHCI halt path,
>>> leading to a duplicate set of reg ops/calls. In addition, since the XHCI
>>> bus is being removed, the overhead added in restarting the HCD is
>>> unnecessary. Check for the XHC state before setting the reinit_xhc
>>> parameter, which is responsible for triggering the restart.
>>>
>>> Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
>>> ---
>>> drivers/usb/host/xhci.c | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
>>> index b81313ffeb76..2017ed3ae4a7 100644
>>> --- a/drivers/usb/host/xhci.c
>>> +++ b/drivers/usb/host/xhci.c
>>> @@ -1028,7 +1028,8 @@ int xhci_resume(struct xhci_hcd *xhci, pm_message_t msg)
>>> temp = readl(&xhci->op_regs->status);
>>>
>>> /* re-initialize the HC on Restore Error, or Host Controller Error */
>>> - if (temp & (STS_SRE | STS_HCE)) {
>>> + if ((temp & (STS_SRE | STS_HCE)) &&
>>> + !(xhci->xhc_state & XHCI_STATE_REMOVING)) {
>>
>> Please add one more tab here in order not to blend it with the following lines.
>
> Ick, no, please do not do that, it needs to move left instead.
Don't we usually use 2 tabs to indent the continuation lines in the USB code?
> greg k-h
MBR, Sergey
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-05-23 16:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-23 1:53 [PATCH] usb: host: xhci: Do not re-initialize the XHCI HC if being removed Wesley Cheng
2023-05-23 8:45 ` Sergey Shtylyov
2023-05-23 16:33 ` Greg KH
2023-05-23 16:42 ` Sergey Shtylyov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox