linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Tejas Joglekar <Tejas.Joglekar@synopsys.com>
Cc: Mathias Nyman <mathias.nyman@linux.intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	USB <linux-usb@vger.kernel.org>,
	Mathias Nyman <mathias.nyman@intel.com>,
	John Youn <John.Youn@synopsys.com>
Subject: Re: [RFC PATCH v2 4/4] usb: xhci: Use temporary buffer to consolidate SG
Date: Wed, 20 May 2020 13:44:37 -0400	[thread overview]
Message-ID: <20200520174437.GA15590@rowland.harvard.edu> (raw)
In-Reply-To: <a577925a-98ea-2e6d-da0c-b3e8dbe3dc7e@synopsys.com>

On Wed, May 20, 2020 at 05:00:50PM +0000, Tejas Joglekar wrote:
> Hi,
> On 5/20/2020 10:20 PM, Alan Stern wrote:
> > On Wed, May 20, 2020 at 06:41:16AM +0000, Tejas Joglekar wrote:
> >>>> +	urb->transfer_buffer = temp;
> >>>> +	urb->transfer_dma = dma_map_single(hcd->self.sysdev,
> >>>> +					   urb->transfer_buffer,
> >>>> +					   urb->transfer_buffer_length,
> >>>> +					   dir);
> >>>> +
> >>>> +	if (dma_mapping_error(hcd->self.sysdev,
> >>>> +			      urb->transfer_dma)) {
> >>>> +		ret = -EAGAIN;
> >>>> +		kfree(temp);
> >>>> +	} else {
> >>>> +		urb->transfer_flags |= URB_DMA_MAP_SINGLE;
> >>>
> >>> Not sure if using URB_DMA_MAP_SINGLE to flag that this urb is boucebuffered is
> >>> appropriate.
> >>>
> >>> If Greg or Alan don't object then it's fine for me as well.
> >>>
> >>>
> >>>
> >> @Greg/Alan do you suggest any change for the flag here?
> > 
> > This requires care, because the core will already have set other flags 
> > for this URB.  I don't remember the details and I don't have time to 
> > check them now.  But it wouldn't be at all surprising if the core 
> > doesn't expect an URB both to use SG and to use DMA_MAP_SINGLE.
> > 
> When this quirk is enabled and it is required to consolidate SG list to 
> single buffer no other flags are set for the URB.

I don't believe that.  What about URB_DMA_MAP_SG or 
URB_DMA_MAP_PAGE?  The USB core certainly would have set one of them 
already.  Not only would you need to clear that flag, you want also need 
to undo the mapping.

> Only question here is 
> if it is good to use DMA_MAP_SINGLE flag for the consolidated SG list 
> into a single temporary buffer.

If you call dma_map_single() then USB_DMA_MAP_SINGLE is the appropriate 
flag to sest.

Alan Stern

  reply	other threads:[~2020-05-20 17:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-21  9:47 [RFC PATCH v2 0/4] Add logic to consolidate TRBs for Synopsys xHC Tejas Joglekar
2020-04-21  9:48 ` [RFC PATCH v2 1/4] dt-bindings: usb: Add documentation for SG trb cache size quirk Tejas Joglekar
2020-05-06 20:15   ` Rob Herring
2020-05-07 16:03     ` Tejas Joglekar
2020-05-06 20:16   ` Rob Herring
2020-05-07 16:07     ` Tejas Joglekar
2020-04-21  9:48 ` [RFC PATCH v2 2/4] usb: xhci: Set quirk for XHCI_SG_TRB_CACHE_SIZE_QUIRK Tejas Joglekar
2020-04-21  9:48 ` [RFC PATCH v2 3/4] usb: dwc3: Add device property sgl-trb-cache-size-quirk Tejas Joglekar
2020-04-21  9:49 ` [RFC PATCH v2 4/4] usb: xhci: Use temporary buffer to consolidate SG Tejas Joglekar
2020-05-18  8:38   ` Tejas Joglekar
2020-05-18 16:21   ` Mathias Nyman
2020-05-20  6:41     ` Tejas Joglekar
2020-05-20 16:50       ` Alan Stern
2020-05-20 17:00         ` Tejas Joglekar
2020-05-20 17:44           ` Alan Stern [this message]
2020-05-22  1:58             ` Tejas Joglekar
2020-05-22 14:21               ` Alan Stern
2020-05-22 17:22                 ` Tejas Joglekar

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=20200520174437.GA15590@rowland.harvard.edu \
    --to=stern@rowland.harvard.edu \
    --cc=John.Youn@synopsys.com \
    --cc=Tejas.Joglekar@synopsys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=mathias.nyman@linux.intel.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).