CPU Cache and busdma usage in USB

Piotr Zięcik kosmo at semihalf.com
Wed Jun 24 07:15:39 UTC 2009


> : > >> My question is about general idea of bus_dma usage for cache
> : > >> operations. In my opinion we should not rely on bus_dmamap_sync()
> : > >> behaviour as this function may do different things on different
> : > >> architectures.  This not always works as expected, which is clearly
> : > >> visible in our case. Better solution is to use cpu-specific
> : > >> functions implementing cache operations. Please comment on why
> : > >> CPU-specific functions are not used...
>
> I think because busdma is supposed to abstract this out.  The problem
> is that the usb code chose different terms to represent these
> operations than is typically used.

I don't think so. Bus_dmamap_sync() works in per-transfer basics. It does 
synchronization which is required _before_ and _after_ DMA transfer. We do 
not know and do not want to know any details about the synchronization - this 
is main idea of bus_dma subsystem.

Of course, in most cases cache flush/invalidate will be preformed, but in we 
do not know that without looking into bus_dma implementation on given 
architecture.

In my opinion main problem here is that bus_dmamap_sync() is not used in
per-transfer basics. It is used to abstact cache operations - which is a bit 
different thing.

-- 
Pozdrawiam.
Piotr Zięcik


More information about the freebsd-usb mailing list