Alan, thanks again for your comments,

[moved to the linux-usb list]

On Jan 26, 2008 1:55 AM, Alan Stern <[EMAIL PROTECTED]> wrote:
> On Sat, 26 Jan 2008, Magnus Damm wrote:
>
> > Alan and David, thanks for your comments.
> >
> > The HCD_LOCAL_MEM code only copies data into the bounce buffers if
> > URB_NO_TRANSFER_DMA_MAP is unset. If that flag is set then the code
> > expects the buffer to have been allocated using dma_alloc_coherent()
> > and therefore there is no point in copying it. Or mapping it, as the
> > original dma map code did. Anyway, so having that flag set even though
> > dma is disabled and the dma handle invalid (data is not at all in
> > buffers allocated using dma_alloc_coherent) breaks usb storage for
> > ohci-sm501.
>
> If usb-storage breaks then won't other drivers like ub break as well?

All code that is using usb_sg_init() is currently broken for
ohci-sm501. This includes usb storage and usbtest. Not sure about ub.

> The documentation for URB_NO_TRANSFER_DMA_MAP and URB_NO_SETUP_DMA_MAP
> says only that the DMA handle must be valid; it doesn't say that the
> buffer had to allocated by usb_buffer_alloc(), hcd_buffer_alloc(), or
> dma_alloc_coherent().

But where does that dma handle come from then? Is there any other way
of getting such a handle than through the dma allocator?

> Now, there's nothing wrong with your patch.  It avoids setting
> URB_NO_TRANSFER_DMA_MAP when the DMA handle is invalid.  But the way
> you are overloading the meaning of that flag could easily lead to
> problems with other drivers.

My interpretation of URB_NO_TRANSFER/SETUP_DMA_MAP is that data is
already mapped (with usb_buffer_map_sg() for instance) so there is no
need to map it again (in map_urb_for_dma()).  The HCD_LOCAL_MEM code
follows that but copies instead of maps. The ohci-sm501 driver doesn't
register as a regular dma-capable driver though, so drivers that
require dma will of course be broken. But they need to be fixed to
work with any non-dma usb host controller, right?

Anyway, thanks for you help so far. How do I do to get this patch
included? Should I resend it somewhere?

/ magnus
-
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to