linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejas Joglekar <Tejas.Joglekar@synopsys.com>
To: Alan Stern <stern@rowland.harvard.edu>,
	Tejas Joglekar <Tejas.Joglekar@synopsys.com>,
	Mathias Nyman <mathias.nyman@linux.intel.com>
Cc: 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: Fri, 22 May 2020 17:22:54 +0000	[thread overview]
Message-ID: <e9646d69-05ca-a4c7-df3f-bd8414235880@synopsys.com> (raw)
In-Reply-To: <20200522142105.GA32434@rowland.harvard.edu>

Hi,
On 5/22/2020 7:51 PM, Alan Stern wrote:
> On Fri, May 22, 2020 at 01:58:43AM +0000, Tejas Joglekar wrote:
>> Hi,
>> On 5/20/2020 11:14 PM, Alan Stern wrote:
>>> 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.
>>>
>> URB_DMA_MAP_SG or URB_DMA_MAP_PAGE flags are set for an URB in core within
>> function usb_hcd_map_urb_for_dma(), with my patch the xhci_map_urb_for_dma()
>> does not call usb_hcd_map_urb_for_dma() when SG list consolidation is required
>> but it calls the newly added function xhci_map_temp_buffer() within that function
>> only dma_map_single() is called to map consolidated SG list.
> 
> Ah, in your patch xhci-hcd's map_urb_for_dma() routine bypasses 
> usb_hcd_map_urb_for_dma().  I hadn't noticed that.
> 
> Then yes, your use of the URB flags is okay.
> 
> Alan Stern
> 
Thanks for the review Alan
@Mathias: I will send v3 after updating the unmap function.

Thanks & Regards,
Tejas Joglekar




      reply	other threads:[~2020-05-22 17:23 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
2020-05-22  1:58             ` Tejas Joglekar
2020-05-22 14:21               ` Alan Stern
2020-05-22 17:22                 ` Tejas Joglekar [this message]

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=e9646d69-05ca-a4c7-df3f-bd8414235880@synopsys.com \
    --to=tejas.joglekar@synopsys.com \
    --cc=John.Youn@synopsys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=mathias.nyman@linux.intel.com \
    --cc=stern@rowland.harvard.edu \
    /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).