On Mon, 29 Apr 2019, Oliver Neukum wrote: > On Mo, 2019-04-29 at 13:55 -0400, Alan Stern wrote: > > On Mon, 29 Apr 2019, Oliver Neukum wrote: > > > > > On Mo, 2019-04-29 at 12:08 -0400, Alan Stern wrote: > > > > On Mon, 29 Apr 2019, Oliver Neukum wrote: > > > > > > > > > On Mo, 2019-04-29 at 15:06 +0000, David Laight wrote: > > > > > > > > > But the statement the old comment made are no longer correct. > > > > > > > > Perhaps David would be satisfied if the comment were changed to say > > > > that _some_ USB controller drivers have this unusual alignment > > > > requirement. > > > > > > It would seem to me that every controller that does not do > > > scatter/gather has this requirement. In other words, this is > > > the true requirement of USB. It does not come from the > > > controller. It comes from the protocol's need to not > > > send a short package. > > > > Are you sure that xHCI has this requirement? I haven't checked the > > I am sure that it has not. UAS would never have worked. > Like in the case of storage this patch is necessary > for virtual controllers.
Okay, yes, I agree with what you say. With the addition that some controllers which _do_ support scatter-gather also have this requirement. In fact, xhci-hcd may be the only driver that doesn't need this special alignment. Alan Stern > > spec. I know that UHCI, OHCI, and EHCI do need this alignment (and > > OHCI and EHCI do in fact have hardware support for scatter-gather). > > > > More precisely, what matters is whether the controller is able to merge > > two different DMA segments into a single packet. UHCI can't. OHCI and > > Correct. However, we cannot blindly assume in a class driver that > certain controllers will be used. > > > EHCI can, but only if the first segment ends at a page boundary and the > > second begins at a page boundary -- it's easier just to say that the > > segments have to be maxpacket-aligned. > > > > > The second, old, comment is about controllers. > > > > Well, if the drivers would use bounce buffers to work around the > > controllers' issues then they wouldn't have this special requirement. > > So it really is a combination of what the hardware can do and what the > > driver can do. > > Yes, but the point of using an API to specify restrictions to the > upper layer is to avoid using bounce buffers. Besides, bounce > buffers in block IO is interesting in terms of VM implications. > > Regards > Oliver > > >