Skip to contentSkip to conversation

usb: xhci: keep the transaction count out of Max Packet Size

PATCH Applied Ahmad Fatoum 2 participants 2 messages Nov 8 – Nov 9

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: xhci: keep the transaction count out of Max Packet Size

Bits 12:11 of wMaxPacketSize hold the number of additional transactions per microframe of high-speed isochronous and interrupt endpoints. xhci_get_endpoint_max_burst() already programs them as Max Burst Size, but xhci_set_configuration() copies them into Max Packet Size as well, so a high-bandwidth endpoint ends up with a Max Packet Size beyond the 1024 bytes a high-speed endpoint can have.

Mask them off, like Linux does since commit f94e0186312b ("USB: xhci:
Bandwidth allocation support"), with the mask fixed to cover bit 10 in commit dc07c91b9b40 ("xHCI: fix wMaxPacketSize mask").

Fixes 105b2eabd55a ("usb: Add U-Boot xhci driver")
Assisted-by Claude:opus-5.5
---
 drivers/usb/host/xhci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/host/xhci.c +2 -2
index 661dc0dde0b8..1bb1758ac25d 100644
@@ -574,8 +574,8 @@ static int xhci_set_configuration(struct usb_device *udev)
 
 		ep_ctx[ep_index]->ep_info2 = cpu_to_le32(EP_TYPE(ep_type));
 		ep_ctx[ep_index]->ep_info2 |=
-			cpu_to_le32(MAX_PACKET
-			(get_unaligned(&endpt_desc->wMaxPacketSize)));
+			cpu_to_le32(MAX_PACKET(get_unaligned(&endpt_desc->wMaxPacketSize) &
+					       USB_ENDPOINT_MAXP_MASK));
 
 		/* Allow 3 retries for everything but isoc, set CErr = 3 */
 		if (!usb_endpoint_xfer_isoc(endpt_desc))
Signature · 1 line
2.47.3
Applied
#1 lore raw
Quoted 8 lines · Ahmad Fatoum

Bits 12:11 of wMaxPacketSize hold the number of additional transactions per microframe of high-speed isochronous and interrupt endpoints. xhci_get_endpoint_max_burst() already programs them as Max Burst Size, but xhci_set_configuration() copies them into Max Packet Size as well, so a high-bandwidth endpoint ends up with a Max Packet Size beyond the 1024 bytes a high-speed endpoint can have.

[...]

Applied, thanks!

[1/1] usb: xhci: keep the transaction count out of Max Packet Size
https://git.pengutronix.de/cgit/barebox/commit/?id=2c9589d5238c (link may not be stable)

Best regards,

Signature · 1 line
Sascha Hauer <[email protected]>