From: Oliver Neukum <oneukum@suse.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: USB list <linux-usb@vger.kernel.org>, Takashi Iwai <tiwai@suse.de>
Subject: Regression due to 59cf44575456 ("USB: core: Fix oversight in SuperSpeed initialization")
Date: Tue, 9 Apr 2024 15:49:01 +0200 [thread overview]
Message-ID: <9efbd569-7059-4575-983f-0ea30df41871@suse.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2875 bytes --]
Hi,
with the following device:
Bus 002 Device 002: ID fb5d:0001 BHYVE HID Tablet
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 3.00
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0xfb5d
idProduct 0x0001
bcdDevice 0.00
iManufacturer 1 BHYVE
iProduct 2 HID Tablet
iSerial 3 01
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0028
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 4 HID Tablet Device
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 0mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 2 Mouse
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 10.01
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 74
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 10
bMaxBurst 0
Binary Object Store Descriptor:
bLength 5
bDescriptorType 15
wTotalLength 0x000f
bNumDeviceCaps 1
SuperSpeed USB Device Capability:
bLength 10
bDescriptorType 16
bDevCapabilityType 3
bmAttributes 0x00
wSpeedsSupported 0x0008
Device can operate at SuperSpeed (5Gbps)
bFunctionalitySupport 3
Lowest fully-functional device speed is SuperSpeed (5Gbps)
bU1DevExitLat 10 micro seconds
bU2DevExitLat 32 micro seconds
Device Status: 0x0000
(Bus Powered)
we are getting a regression on enumeration. It used to work with the
code prior to your patch. Takashi is proposing the attached fixed.
It looks like we are a bit too restrictive and should just try.
Regards
Oliver
[-- Attachment #2: 0001-USB-hub-Workaround-for-buggy-max-packet-size-with-su.patch --]
[-- Type: text/x-patch, Size: 1982 bytes --]
From: Takashi Iwai <tiwai@suse.de>
Subject: [PATCH] USB: hub: Workaround for buggy max packet size with super
speed
Patch-mainline: Not yet, testing
References: bsc#1220569
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
drivers/usb/core/hub.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index e38a4124f610..64193effc456 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -4830,7 +4830,7 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
const char *driver_name;
bool do_new_scheme;
const bool initial = !dev_descr;
- int maxp0;
+ int maxp0, ep0_maxp;
struct usb_device_descriptor *buf, *descr;
buf = kmalloc(GET_DESCRIPTOR_BUFSIZE, GFP_NOIO);
@@ -5070,7 +5070,8 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
else
i = 0; /* Invalid */
}
- if (usb_endpoint_maxp(&udev->ep0.desc) == i) {
+ ep0_maxp = usb_endpoint_maxp(&udev->ep0.desc);
+ if (ep0_maxp == i) {
; /* Initial ep0 maxpacket guess is right */
} else if ((udev->speed == USB_SPEED_FULL ||
udev->speed == USB_SPEED_HIGH) &&
@@ -5082,9 +5083,15 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
dev_warn(&udev->dev, "Using ep0 maxpacket: %d\n", i);
udev->ep0.desc.wMaxPacketSize = cpu_to_le16(i);
usb_ep0_reinit(udev);
+ } else if (udev->speed >= USB_SPEED_SUPER && initial) {
+ /* FIXME: should be more restrictive? */
+ /* Initial guess is wrong; use the descriptor's value */
+ dev_warn(&udev->dev, "Using ep0 maxpacket: %d\n", i);
+ udev->ep0.desc.wMaxPacketSize = cpu_to_le16(i);
+ usb_ep0_reinit(udev);
} else {
/* Initial guess is wrong and descriptor's value is invalid */
- dev_err(&udev->dev, "Invalid ep0 maxpacket: %d\n", maxp0);
+ dev_err(&udev->dev, "Invalid ep0 maxpacket: %d, expected %d\n", maxp0, ep0_maxp);
retval = -EMSGSIZE;
goto fail;
}
--
2.35.3
next reply other threads:[~2024-04-09 13:49 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-09 13:49 Oliver Neukum [this message]
2024-04-09 14:56 ` Regression due to 59cf44575456 ("USB: core: Fix oversight in SuperSpeed initialization") Alan Stern
2024-04-22 17:33 ` Linux regression tracking (Thorsten Leemhuis)
2024-04-22 18:03 ` Alan Stern
2024-04-22 19:24 ` Takashi Iwai
2024-04-23 19:29 ` Alan Stern
2024-04-24 8:56 ` Takashi Iwai
2024-04-24 14:14 ` Alan Stern
2024-04-24 14:22 ` Takashi Iwai
2024-04-24 14:56 ` Alan Stern
2024-04-24 15:07 ` Takashi Iwai
2024-04-28 7:57 ` Takashi Iwai
2024-04-29 13:28 ` Alan Stern
2024-04-30 8:02 ` Takashi Iwai
2024-04-30 14:33 ` [PATCH] usb: Fix regression caused by invalid ep0 maxpacket in virtual SuperSpeed device Alan Stern
2024-04-22 19:22 ` Regression due to 59cf44575456 ("USB: core: Fix oversight in SuperSpeed initialization") Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9efbd569-7059-4575-983f-0ea30df41871@suse.com \
--to=oneukum@suse.com \
--cc=linux-usb@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.