On 03/16/2015 09:36 AM, Florian Echtler wrote: > Hello Hans, > > On 15.03.2015 17:26, Hans Verkuil wrote: >> On 03/12/2015 08:37 PM, Florian Echtler wrote: >>> On 09.03.2015 15:02, Hans Verkuil wrote: >>>> On 03/09/2015 02:45 PM, Florian Echtler wrote: >>>>> On 09.03.2015 11:09, Hans Verkuil wrote: >>>>>> The error almost certainly comes from usb_submit_urb(). That function does some >>>>>> checks on the sgl: >>>>>> >>>>> I'll do my best to track this down. Do you think this is an error in my >>>>> code, one in the USB subsystem, or some combination of both? >>>> >>>> If the USB core indeed requires scatter-gather segments of specific lengths >>>> (modulo max), then that explains the problems. >>>> So as suggested try to see if the usb core bails out in that check and what the >>>> 'max' value is. It looks like only XHCI allows SG segments of any size, so I really >>>> suspect that's the problem. But I also need to know the 'max' value to fully >>>> understand the implications. >>> >>> Finally managed to confirm your suspicions on a kernel with a patched >>> dev_err call at the location you mentioned: >>> >>> So the SG segments are expected in multiples of 512 bytes. I assume this >>> is not something I can fix from within my driver? >> >> No, you can't. I would use dma-sg, but disable the USERPTR support. >> Also comment why USERPTR support is disabled. >> >> This was interesting :-) >> > Thanks again for your help, new patch is submitted. Just for my > understanding: is this a hardware limitation? Yes. Apparently only USB 3 (XHCI) has no restriction on the segment length in a SG list. > And why does dma-sg select > such a weird segment size like 4080? It's not so much dma-sg as it is the USERPTR support. In USERPTR mode the application malloc()s memory and when you map that virtual memory block to a SG list for the underlying physical memory, then you see that malloc does not align the start of the memory to a page, instead it starts somewhere in the middle of the page and you end up with a SG descriptor with a 'weird' length. You can't do anything about that, other than just disabling USERPTR support. Regards, Hans -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html