diff mbox

[1/1] redirect: change the state after attach usb 3.0 devices to xhci

Message ID tencent_4AC4E71A69161C0F50EBE6F8@qq.com
State New
Headers show

Commit Message

=?gb18030?B?y9XG5NDb?= Jan. 28, 2016, 5:15 p.m. UTC
QEMU crashes when redirect a usb 3.0 device which attached to a xHCI controller. The assertion of "dev->state == 3" in "usb_handle_packet" has failed.


Signed-off-by: Qixiong Su <916628390@qq.com>

---
 hw/usb/redirect.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)


--
2.1.3

Comments

Prasad Pandit Jan. 29, 2016, 6:07 p.m. UTC | #1
Hello Qixiong,

+-- On Fri, 29 Jan 2016, Qixiong Su wrote --+
| QEMU crashes when redirect a usb 3.0 device which attached to a xHCI 
| controller. The assertion of "dev->state == 3" in "usb_handle_packet" has 
| failed.

  You need to follow git commit message syntax. ie. One line commit summary, 
leave second line blank and then commit log message stating why you are doing 
the proposed change.

Please see:
  -> http://qemu-project.org/Contribute/SubmitAPatch

 
| diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
| index 44522d9..cd29776 100644
| --- a/hw/usb/redirect.c
| +++ b/hw/usb/redirect.c
| +static void usbredir_handle_attach(USBDevice *udev)
| +{
| +    assert(udev != NULL);
| +    assert(udev->attached);
| +    assert(udev->state == USB_STATE_ATTACHED);

   This is done in usb_attach() routine, may not be required here.

| +    if (udev->speed == USB_SPEED_SUPER && (udev->port->speedmask & USB_SPEED_MASK_SUPER)) {
| +        udev->state = USB_STATE_DEFAULT;

   Why conditionally set it to default?

--
 - P J P
47AF CE69 3A90 54AA 9045 1053 DD13 3D32 FE5B 041F
diff mbox

Patch

diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index 44522d9..cd29776 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -1437,6 +1437,17 @@  static void usbredir_handle_destroy(USBDevice *udev)
     free(dev->filter_rules);
 }
 
+static void usbredir_handle_attach(USBDevice *udev)
+{
+    assert(udev != NULL);
+    assert(udev->attached);
+    assert(udev->state == USB_STATE_ATTACHED);
+
+    if (udev->speed == USB_SPEED_SUPER && (udev->port->speedmask & USB_SPEED_MASK_SUPER)) {
+        udev->state = USB_STATE_DEFAULT;
+    }
+}
+
 static int usbredir_check_filter(USBRedirDevice *dev)
 {
     if (dev->interface_info.interface_count == NO_INTERFACE_INFO) {
@@ -2480,6 +2491,7 @@  static void usbredir_class_initfn(ObjectClass *klass, void *data)
     uc->init           = usbredir_initfn;
     uc->product_desc   = "USB Redirection Device";
     uc->handle_destroy = usbredir_handle_destroy;
+    uc->handle_attach = usbredir_handle_attach;
     uc->cancel_packet  = usbredir_cancel_packet;
     uc->handle_reset   = usbredir_handle_reset;
     uc->handle_data    = usbredir_handle_data;