usb: gadget: dummy_hcd: set no_sg_constraint only on the SuperSpeed bus dummy_hcd registers two separate root hubs/buses: a HighSpeed one emulating an EHCI-class controller, and a SuperSpeed one emulating an xHCI-class controller. usb_submit_urb() rejects SG URBs whose non-final segments are not a multiple of the endpoint maxpacket size, unless the bus has no_sg_constraint set. For SuperSpeed bulk endpoints maxpacket is 1024 bytes; usbtest generates SG lists with varying segment sizes (e.g. 512 bytes) that are valid transfers but not maxpacket-aligned, causing usb_submit_urb to return -EINVAL before the URB reaches the host controller. xHCI-class controllers have no such DMA alignment requirement, so set no_sg_constraint on the SS bus to match. Leave the HS bus unchanged: EHCI-class controllers do have this requirement in hardware, and dummy_hcd's HS roothub is meant to emulate that behaviour, so the constraint should stay enforced there. Suggested-by: Alan Stern <stern@rowland.harvard.edu> Assisted-by: OpenCode:claude-sonnet-5 Signed-off-by: Igor Skalkin <igor.skalkin@oss.qualcomm.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Link: https://patch.msgid.link/20260812081910.6821-3-igor.skalkin@oss.qualcomm.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c index d3076a42..27cb3b25 100644 --- a/drivers/usb/gadget/udc/dummy_hcd.c +++ b/drivers/usb/gadget/udc/dummy_hcd.c
@@ -2596,6 +2596,15 @@ static int dummy_setup(struct usb_hcd *hcd) dum->ss_hcd->dum = dum; hcd->speed = HCD_USB3; hcd->self.root_hub->speed = USB_SPEED_SUPER; + + /* + * xHCI-class SuperSpeed controllers have no maxpacket + * alignment requirement for non-final SG segments. Only + * relax the constraint on the SS bus; the HS bus keeps + * emulating the alignment requirement of EHCI-class + * controllers. + */ + hcd->self.no_sg_constraint = 1; } return 0; }