[PATCH] dma: add new dma_mapping_ops API sync_page

Remi Machet rmachet at slac.stanford.edu
Sat Oct 4 02:33:13 EST 2008


On Wed, 2008-10-01 at 15:03 -0700, Remi Machet wrote:
> This patch replaces the global APIs __dma_sync and __dma_sync_page
> with a new dma_mapping_ops API named sync_page. This is necessary to make
> sure that the proper synchronization mechanism is used for a device
> DMA depending on the bus the device is on.
> 

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
-Using sync_page forced me to create a new define in io.h: bus_to_page.

I now think it would be better to have 2 new API: sync (which takes a
dma_addr_t) and sync_sg (which takes a scatter/gather list). Adding
sync_sg would make us get rid of the last page_to_bus in the code (to
get the dma_addr_t from the scatter gather list entry sg I do:
page_to_bus(sg_page(sg))+sg->offset).

Any feedback is welcome on this issue. I hate adding 2 new APIs but they
would make it possible to have 2 completely different DMA architectures
supported in one kernel on the same hardware.

Remi




More information about the Linuxppc-dev mailing list