linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Sriharsha Allenki <sallenki@codeaurora.org>,
	gregkh@linuxfoundation.org, linux-usb@vger.kernel.org
Cc: jackp@codeaurora.org, mgautam@codeaurora.org,
	Sriharsha Allenki <sallenki@codeaurora.org>
Subject: Re: [PATCH] usb: dwc3: Do not process request if HWO is set for its TRB
Date: Mon, 02 Dec 2019 09:36:54 +0200	[thread overview]
Message-ID: <87tv6jch61.fsf@gmail.com> (raw)
In-Reply-To: <1575270714-29994-1-git-send-email-sallenki@codeaurora.org>

[-- Attachment #1: Type: text/plain, Size: 1425 bytes --]


Hi,

Sriharsha Allenki <sallenki@codeaurora.org> writes:

> If the HWO bit is set for the TRB (or the first TRB if scatter-gather
> is used) of a request, it implies that core is still processing it.
> In that case do not reclaim that TRB and do not giveback the
> request to the function driver, else it will result in a SMMU
> translation fault when core tries to access the buffer
> corresponding to this TRB.

This is not entirely true. There are cases where driver *must* clear HWO
bit manually and driver currently accounts for that. Care to explain
what problem you actually found? Preferrably with tracepoint data
showing the fault.

> Signed-off-by: Sriharsha Allenki <sallenki@codeaurora.org>
> ---
>  drivers/usb/dwc3/gadget.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index a9aba71..4a2c5fc 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -2476,6 +2476,14 @@ static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep,
>  {
>  	int ret;
>  
> +	/*
> +	 * If the HWO is set, it implies the TRB is still being
> +	 * processed by the core. Hence do not reclaim it until
> +	 * it is processed by the core.
> +	 */
> +	if (req->trb->ctrl & DWC3_TRB_CTRL_HWO)
> +		return 1;

I'm pretty sure you're regressing a bunch of other cases here.

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  parent reply	other threads:[~2019-12-02  7:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1574946055-3788-1-git-send-email-sallenki@codeaurora.org>
2019-12-02  7:12 ` [PATCH] usb: dwc3: Do not process request if HWO is set for its TRB Sriharsha Allenki
     [not found] ` <1575270714-29994-1-git-send-email-sallenki@codeaurora.org>
2019-12-02  7:36   ` Felipe Balbi [this message]
2019-12-02 10:30     ` Sriharsha Allenki
2019-12-03 12:30       ` Felipe Balbi
2019-12-10  6:50         ` Sriharsha Allenki
     [not found]         ` <4c34d724-6a45-dc21-2d10-337f358015ce@codeaurora.org>
2019-12-10 11:46           ` Felipe Balbi

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=87tv6jch61.fsf@gmail.com \
    --to=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jackp@codeaurora.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mgautam@codeaurora.org \
    --cc=sallenki@codeaurora.org \
    /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).