Re: using cacheable buffer for descriptor

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Ming Lei <tom.leiming@...>
Cc: Yang Fei-AFY095 <fei.yang@...>, Alan Stern <stern@...>, <linux-usb@...>, Xiao Richard-a2590c <a2590c@...>, Luan James-WLJL13 <James.Luan@...>, <linux-arm-kernel@...>
Date: Saturday, July 4, 2009 - 2:07 pm

On Sat, Jul 04, 2009 at 11:41:46PM +0800, Ming Lei wrote:

You missed an important statement: accessing the dma buffer during a dma
transfer is not permitted without an intervening call to the dma_sync_*
functions.

DMA buffers have the idea of "ownership" - they initially start off being
owned by the CPU.  Upon dma_map_*(), ownership transfers to the DMA agent,
and remains there until either a dma_unmap_*() or dma_sync_single_for_cpu().
In the case of dma_sync_single_for_cpu(), it can only be given back to the
DMA agent using dma_sync_single_for_device().

The important point from the above is that _only_ the current owner may
access the buffer.  So, if you've mapped a buffer, accessing the buffer
subsequently without a call to dma_sync_single_for_cpu() is illegal.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
using cacheable buffer for descriptor, Yang Fei-AFY095, (Fri Jul 3, 12:43 am)
Re: using cacheable buffer for descriptor, Alan Stern, (Fri Jul 3, 5:16 pm)
RE: using cacheable buffer for descriptor, Yang Fei-AFY095, (Fri Jul 3, 6:06 pm)
RE: using cacheable buffer for descriptor, Alan Stern, (Fri Jul 3, 7:19 pm)
RE: using cacheable buffer for descriptor, Yang Fei-AFY095, (Fri Jul 3, 11:43 pm)
Re: using cacheable buffer for descriptor, Ming Lei, (Sat Jul 4, 5:11 am)
Re: using cacheable buffer for descriptor, Ming Lei, (Sat Jul 4, 11:41 am)
Re: using cacheable buffer for descriptor, Russell King - ARM Linux, (Sat Jul 4, 2:07 pm)
Re: using cacheable buffer for descriptor, Ming Lei, (Sat Jul 4, 10:38 pm)
Re: using cacheable buffer for descriptor, Russell King - ARM Linux, (Sun Jul 5, 2:46 am)
RE: using cacheable buffer for descriptor, Yang Fei-AFY095, (Sat Jul 4, 5:01 pm)
Re: using cacheable buffer for descriptor, Alan Stern, (Sat Jul 4, 11:51 am)