nec-usb-xhci: set the device state to USB_STATE_DEFAULT
commita4055d85863be76a5fb70ecd001e7db5bc6bd5cb
authorZhang Shuaiyi <zhang_syi@massclouds.com>
Thu, 30 Jun 2016 03:50:40 +0000 (29 23:50 -0400)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 12 Jul 2016 08:23:59 +0000 (12 10:23 +0200)
treec047445088a5c0f6aadcc3248ad5b91a0b388982
parentf1ef55786691a1bf79db0b74ba1e5347a0d38c1b
nec-usb-xhci: set the device state to USB_STATE_DEFAULT

This patch is a rough fix to "hw/usb/core.c:401: usb_handle_packet:
 Assertion `dev->state == 3' failed.". Qemu will crash when a usb3
device redirect to Windows7 VM via nec-usb-xhci.

In extensible-host-controler-interface-usb-xhci.pdf P94(4.6.5
Address Device):
    • If the Block Set Address Request (BSR) flag = ‘1’
        • If the slot is in the Enabled state:
            ...
            • Set the Slot State in the Output Slot Context to Default.

BSR = ‘1’: Enabled state to Default state; BSR = ‘0’: Default state
to Addressed state. Try to call usb_device_reset to set device state
to USB_STATE_DEFAULT in xhci_address_slot wether bsr is zero.

Signed-off-by: Zhang Shuaiyi <zhang_syi@massclouds.com>
Message-id: 1467258640-11921-1-git-send-email-zhang_syi@massclouds.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/usb/hcd-xhci.c