[linux-dvb] FYI: CinergyT2 and embeded enviroment

Johannes Stezenbach js at linuxtv.org
Mon Apr 4 01:55:34 CEST 2005

On Mon, Mar 21, 2005 at 01:44:13AM +0100, Ralph Metzler wrote:
> Petr Nejedly writes:
>  > I haven't tried using kmalloc instead of pci_alloc_consistent on my x86 
>  > desktop
>  > yet but should it work, wouldn't it be better to rewrite the driver to 
>  > use kmalloc?
> No, it should use usb_buffer_alloc, which does the right thing for
> each platform and controller (either kmalloc or dma_alloc_coherent). 
> I think if you use kmalloc for all platforms you might run into
> trouble with cache inconsistencies on some of them. 

I finally found some time to read the docs on this issue
(Documentation/DMA-mapping.txt and DMA-API.txt and usb/dma.txt).

Since the cinergyT2 driver doesn't take care of handling
DMA vs. cache consistency (it leaves this job to the usb core),
it should just use kmalloc().

Or, it could be made "DMA-aware" and use usb_buffer_alloc() to get
a DMA-coherent memory mapping, and then set urb->transfer_dma and use
URB_NO_TRANSFER_DMA_MAP. (On x86 and ppc this doesn't make much of
a difference as all memory is DMA-coherent anyway.)

(BTW: The default STREAM_BUF_SIZE happens to ensure that the
xfer bufs are cache line aligned for all known architectures.
On arches with non-coherent memory this is crucial...)


More information about the linux-dvb mailing list