Re: [RFC PATCH v2 8/9] USB: add HCD_NO_COHERENT_MEM host controller driver flag

2010-03-02 Thread Alan Stern
On Mon, 1 Mar 2010, Albert Herranz wrote: If transfer_buffer_length is 0 then do nothing. Otherwise if num_sgs 0 then do nothing. Otherwise if URB_NO_TRANSFER_DMA_MAP and transfer_dma are both set (this avoids your HCD_NO_COHERENT_MEM case) then do

Re: [RFC PATCH v2 8/9] USB: add HCD_NO_COHERENT_MEM host controller driver flag

2010-03-02 Thread Albert Herranz
Alan Stern wrote: On Mon, 1 Mar 2010, Albert Herranz wrote: If transfer_buffer_length is 0 then do nothing. Otherwise if num_sgs 0 then do nothing. Otherwise if URB_NO_TRANSFER_DMA_MAP and transfer_dma are both set (this avoids your HCD_NO_COHERENT_MEM

Re: [RFC PATCH v2 8/9] USB: add HCD_NO_COHERENT_MEM host controller driver flag

2010-03-02 Thread Alan Stern
On Tue, 2 Mar 2010, Albert Herranz wrote: Currently this URB doesn't require PIO is always true, but in the future it won't be. Can this be currently tested? Not yet, but soon. You can follow the gory details in this email thread:

Re: [RFC PATCH v2 8/9] USB: add HCD_NO_COHERENT_MEM host controller driver flag

2010-03-01 Thread Alan Stern
On Sun, 28 Feb 2010, Albert Herranz wrote: The HCD_NO_COHERENT_MEM USB host controller driver flag can be enabled to instruct the USB stack to avoid allocating coherent memory for USB buffers. This flag is useful to overcome some esoteric memory access restrictions found in some platforms.

Re: [RFC PATCH v2 8/9] USB: add HCD_NO_COHERENT_MEM host controller driver flag

2010-03-01 Thread Albert Herranz
Alan Stern wrote: --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -1260,6 +1260,34 @@ static void hcd_free_coherent(struct usb_bus *bus, dma_addr_t *dma_handle, *dma_handle = 0; } +static int urb_needs_setup_dma_map(struct usb_hcd *hcd, struct urb *urb) +{ +

Re: [RFC PATCH v2 8/9] USB: add HCD_NO_COHERENT_MEM host controller driver flag

2010-03-01 Thread Alan Stern
On Mon, 1 Mar 2010, Albert Herranz wrote: Also, I can't help thinking that the corresponding *_map() and *_unmap() routines are so similar, it ought to be possible to combine them. The only difference is a check for a NULL DMA address, and it's not clear to me why it is present. It's

Re: [RFC PATCH v2 8/9] USB: add HCD_NO_COHERENT_MEM host controller driver flag

2010-03-01 Thread Albert Herranz
Alan Stern wrote: If urb-num_sgs 0 then urb has been s-g mapped. Although we don't currently check for it, quite a few URBs have transfer_buffer_length == 0 (a number of control requests are like this, for example) so they don't need a mapping either. Ok, I'll use urb-num_sgs 0 to check

Re: [RFC PATCH v2 8/9] USB: add HCD_NO_COHERENT_MEM host controller driver flag

2010-03-01 Thread Alan Stern
On Mon, 1 Mar 2010, Albert Herranz wrote: Am I on the right path? More or less. I would do it somewhat differently: If URB_NO_TRANSFER_DMA_MAP is set then no map is needed. Otherwise if num_sgs 0 then no map is needed. Otherwise if HCD_NO_COHERENT_MEM is set then use

Re: [RFC PATCH v2 8/9] USB: add HCD_NO_COHERENT_MEM host controller driver flag

2010-03-01 Thread Albert Herranz
Alan Stern wrote: On Mon, 1 Mar 2010, Albert Herranz wrote: Am I on the right path? More or less. I would do it somewhat differently: If URB_NO_TRANSFER_DMA_MAP is set then no map is needed. Otherwise if num_sgs 0 then no map is needed. Otherwise if HCD_NO_COHERENT_MEM is