[PATCH] dma: add new dma_mapping_ops API sync_page

Remi Machet rmachet at slac.stanford.edu
Tue Oct 7 04:38:52 EST 2008


On Mon, 2008-10-06 at 11:30 -0500, Scott Wood wrote:
> Remi Machet wrote:
> > After continuing to work on the dma noncoherent code I realized that
> > sync_page is not the best choice of API: 
> > -The API should preferably take a dma_addr_t in my opinion
> 
> A virtual address will typically be needed to perform the flush; why 
> pass the bus address?
Because it is a sync API. You want to make sure that a physical memory
area is in sync with the caches, not the virtual address. This
distinction can become important in the event where the page is mapped
multiple times in the memory and the architecture does not take care of
synchronizing the multiple mapping, the dma_mapping_ops code should be
able to synchronize the multiple mapping. In most case it would be easy
of course to go from virtual address to the page address, but not if the
page is in high memory ...

By the way I realized later on that scatter/gather structures contain 2
fields: dma_addr and dma_length that can be used to recover the bus
address => no need for sync_sg anymore.

Remi




More information about the Linuxppc-dev mailing list