On Thu, 5 Jun 2003, Oliver Neukum wrote:

> > That helps.  So a buffer used for device input should be allocated
> > separately from anything written by the CPU, whereas a buffer used for
> > device output can be shared with other data in a buffer allocated by
> > kmalloc, but not on the stack.
> 
> Judging by this implementation from mips Doing so would be quite inefficient.
> 
> extern inline dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr,
>                                       size_t size, int direction)
> {
>       if (direction == PCI_DMA_NONE)
>               BUG();
> 
> #ifndef CONFIG_COHERENT_IO
>       dma_cache_wback_inv((unsigned long)ptr, size);
> #endif
> 
>       return virt_to_bus(ptr);
> }
> 
> It is probably best to allocate all buffers seperately.

I don't follow you.  What's inefficient about this?  It looks like the
decision of whether or not to call dma_cache_wback_inv() has nothing to do
with what other data is stored in the same memory block with the output
buffer.  And there's nothing that indicates dma_cache_wback_inv() is less
efficient when ptr isn't aligned on a cacheline.

Alan Stern



-------------------------------------------------------
This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to