linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavan Kondeti <quic_pkondeti@quicinc.com>
To: Rohith Kollalsi <quic_rkollals@quicinc.com>
Cc: <mathias.nyman@linux.intel.com>,
	<mika.westerberg@linux.intel.com>, <quic_ajaya@quicinc.com>,
	<quic_pkondeti@quicinc.com>, <linux-usb@vger.kernel.org>
Subject: Re: [PATCH 5.10 211/290] xhci: Fix repeated xhci wake after suspend due to uncleared internal wake state
Date: Thu, 18 Nov 2021 15:34:34 +0530	[thread overview]
Message-ID: <20211118100434.GA7133@hu-pkondeti-hyd.qualcomm.com> (raw)
In-Reply-To: <977d2868-e1cf-9b33-79b3-18e96b9a30c8@quicinc.com>

+linux-usb

On Thu, Nov 18, 2021 at 03:21:54PM +0530, Rohith Kollalsi wrote:
> Hi Mathias,
> 
> This mail is regarding your upstream change in xhci file. There is a
> potential issue with your change which can cause noc error due to unclocked
> access.
> 
> Consider a case where a headset is connected to device and nothing is
> playing. As nothing is playing, usb bus wouldn't be active which leads to
> run time suspend ( i think this feature is not present upstream) as a part
> of which xhci_suspend will be called. Now all the clocks are also switched
> off. Now again when pm_suspend occurs due to disconnect, then again
> xhci_suspend occurs, but now registers can be accessed with clocks off
> leading to unclocked access. Can you please consider below change to prevent
> unclocked access.
> 
> 
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> 
> index 2728027..aaf212d 100644
> 
> --- a/drivers/usb/host/xhci.c
> 
> +++ b/drivers/usb/host/xhci.c
> 
> @@ -1013,13 +1013,13 @@ int xhci_suspend(struct xhci_hcd *xhci, bool
> do_wakeup)
> 
> xhci->shared_hcd->state != HC_STATE_SUSPENDED)
> 
>                 return -EINVAL;
> 
> +       if (!HCD_HW_ACCESSIBLE(hcd)) ---> this will prevent unclocked access
> when xhci_suspend occurs during second time during pm_suspend
> 
> + return 0;
> 
> +
> 
>         /* Clear root port wake on bits if wakeup not allowed. */
> 
>         xhci_disable_hub_port_wake(xhci, &xhci->usb3_rhub, do_wakeup);
> 
>         xhci_disable_hub_port_wake(xhci, &xhci->usb2_rhub, do_wakeup);
> 
> -       if (!HCD_HW_ACCESSIBLE(hcd))
> 
> -               return 0;
> 
> -
> 
>         xhci_dbc_suspend(xhci);
> 
> 
> Thanks,
> 
> Rohith

           reply	other threads:[~2021-11-18 10:06 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <977d2868-e1cf-9b33-79b3-18e96b9a30c8@quicinc.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211118100434.GA7133@hu-pkondeti-hyd.qualcomm.com \
    --to=quic_pkondeti@quicinc.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@linux.intel.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=quic_ajaya@quicinc.com \
    --cc=quic_rkollals@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).