All of lore.kernel.org
 help / color / mirror / Atom feed
From: Don Dutile <ddutile@redhat.com>
To: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: Alan Stern <stern@rowland.harvard.edu>,
	Xenia Ragiadakou <burzalodowa@gmail.com>,
	linux-usb@vger.kernel.org, linux-pci@vger.kernel.org
Subject: Re: [OPW kernel] dma_set_coherent_mask
Date: Wed, 22 May 2013 16:43:52 -0400	[thread overview]
Message-ID: <519D2E08.5000504@redhat.com> (raw)
In-Reply-To: <20130516171925.GA4700@xanatos>

On 05/16/2013 01:19 PM, Sarah Sharp wrote:
> On Thu, May 16, 2013 at 10:11:00AM -0400, Alan Stern wrote:
>> On Wed, 15 May 2013, Sarah Sharp wrote:
>>
>>>> If you're using 64-bit DMA then you almost certainly do want to call
>>>> dma_set_coherent_mask().  On the plus side, it is guaranteed that if
>>>> dma_set_mask() succeeds with a particular mask value then
>>>> dma_set_coherent_mask() for the same mask value will also succeed.
>>>
>>> So we need to call both dma_set_coherent_mask() and dma_set_mask()?  Or
>>> just dma_set_coherent_mask()?
>>
>> It depends on what kind of DMA transfers you're going to do.  For
>> streaming transfers (the ones that use dma_map_single() or
>> dma_map_sg(), for example), you need to call dma_set_mask().  For
>> coherent transfers (the ones that use dma_alloc_coherent() or
>> dma_pool_create()), you need to call dma_set_coherent_mask().
>>
>> If you want to do both kinds of transfers then you need to call both
>> routines.
>
> I think we need the host to be able to do DMA to URB buffers that are
> mapped with dma_map_single() or dma_map_sg(), since that's what
> usb_hcd_submit_urb() uses.  So the driver needs to call dma_set_mask(),
> which it does.
>
> The xHCI endpoint rings are allocated from DMA pools, so we need to
> call dma_set_coherent_mask() as well.  Missing that call explains why
> I've never seen 64-bit endpoint rings, but I have seen 64-bit URB buffer
> pointers.
>
Correct.  Otherwise, that DMA is going through the (more limited 64MB) bounce buffer
which is allocated out of low memory since... a device can't do 64-bit addressing;


> Ksenia, do you want to add code to add the call to
> dma_set_coherent_mask() in those two places in xhci_gen_setup()?  As I
> mentioned, let's add this function call first, and then have a separate
> commit refactor the copy-paste code into a new function.
>
> Again, thanks for catching this and asking questions!
>
> Sarah Sharp
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


      reply	other threads:[~2013-05-22 20:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5192F5C8.3090100@gmail.com>
2013-05-15  5:39 ` [OPW kernel] dma_set_coherent_mask Sarah Sharp
2013-05-15 14:37   ` Alan Stern
2013-05-15 22:42     ` Sarah Sharp
2013-05-16 14:11       ` Alan Stern
2013-05-16 17:19         ` Sarah Sharp
2013-05-22 20:43           ` Don Dutile [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=519D2E08.5000504@redhat.com \
    --to=ddutile@redhat.com \
    --cc=burzalodowa@gmail.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=sarah.a.sharp@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.