Skip to contentSkip to conversation

UAS: fix alignment of scatter/gather segments

DISCUSSION Oliver Neukum 1 participant 1 message Apr 29, 2019 USB

lore
Share & tools
lore
#0 lore raw
Quoted 15 lines · David Laight

From: Oliver Neukum

Quoted 14 lines

Sent: 29 April 2019 14:38

Quoted 11 lines · David Laight

From: Oliver Neukum

Review

Quoted 6 lines
(quoted diff) +5 -0
+	 * USB has unusual scatter-gather requirements: the length of each
+	 * scatterlist element except the last must be divisible by the
+	 * Bulk maxpacket value.  Fortunately this value is always a
+	 * power of 2.  Inform the block layer about this requirement.
+	 */

That isn't the correct restriction for XHCI. It has its own perverse restrictions.
I think they are all handled within the xhci driver.

Quoted 6 lines
Quoted 3 lines

Yes, but that does not matter. You just cannot assume that only XHCI will be used with UAS. In particular virtual drivers will be used.

True, but there is no need to enforce a 2k (IIRC) alignment for XHCI. Perhaps you need a different property from the controller.

AFAICT controllers do not export that property.

Quoted 3 lines

Even if you decide the code is 'good enough' (I don't know what the cost is of enforcing a 2k alignment instead of 512 bytes) the comment is just plain wrong.

Usually block IO will be pages. They are 4K aligned. In terms of performance this code is unlikely to matter. But it is needed for correctness.

What would you want for the comment?

Regards
Oliver