Skip to contentSkip to conversation

usb: misc fixes.

GIT PULL Applied Gerd Hoffmann 2 participants 5 messages Jul 12, 2016

lore
Share & tools
lore
#0 lore raw

Hi,

A few usb bugfixes.

please pull,
Gerd

The following changes since commit f1ef55786691a1bf79db0b74ba1e5347a0d38c1b:

Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20160711' into staging (2016-07-11 18:46:38 +0100)

are available in the git repository at:

git://git.kraxel.org/qemu tags/pull-usb-20160712-1

for you to fetch changes up to 042ec47e6825cbea67b9ad957780204dc1d346bc:

xen-usb: Fix 32bit build (2016-07-12 10:47:03 +0200)

----------------------------------------------------------------
usb: misc fixes.

----------------------------------------------------------------
Anthony PERARD (1):
xen-usb: Fix 32bit build

Gerd Hoffmann (1):
usb: add storage hotplug documentation

Zhang Shuaiyi (1):
nec-usb-xhci: set the device state to USB_STATE_DEFAULT

 docs/usb-storage.txt | 12 ++++++++++++
 hw/usb/hcd-xhci.c    |  3 ++-
 hw/usb/xen-usb.c     |  3 ++-
 3 files changed, 16 insertions(+), 2 deletions(-)
#1 lore raw

[Qemu-devel] [PULL 2/3] usb: add storage hotplug documentation

Message-id: [email protected]

---
 docs/usb-storage.txt | 12 ++++++++++++
 1 file changed, 12 insertions(+)
docs/usb-storage.txt +12 -0
index c5a3866..fbc1f2e 100644
@@ -40,6 +40,18 @@ numbers must be continuous, i.e. for three devices you must use 0+1+2.
 The 0+1+5 numbering from the "usb-uas" example isn't going to work
 with "usb-bot".
 
+Starting with qemu version 2.7 usb-bot and usb-uas devices can be
+hotplugged.  In the hotplug case they are added with "attached =
+false" so the guest will not see the device until the "attached"
+property is explicitly set to true.  That allows to attach one or more
+scsi devices before making the device visible to the guest, i.e. the
+workflow looks like this:
+
+   (1) device-add usb-bot,id=foo
+   (2) device-add scsi-{hd,cd},bus=foo.0,lun=0
+   (2b) optionally add more devices (luns 1 ... 15).
+   (3) scripts/qmp/qom-set foo.attached = true
+
 enjoy,
   Gerd
 
Signature · 1 line
1.8.3.1
#2 lore raw

[Qemu-devel] [PULL 1/3] nec-usb-xhci: set the device state to USB_STATE_DEFAULT

In reply to Gerd Hoffmann

From: Zhang Shuaiyi <[email protected]>

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.

Message-id: [email protected]

---
 hw/usb/hcd-xhci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/usb/hcd-xhci.c +2 -1
index 1a3377f..976bfb0 100644
@@ -2364,6 +2364,8 @@ static TRBCCode xhci_address_slot(XHCIState *xhci, unsigned int slotid,
     slot->uport = uport;
     slot->ctx = octx;
 
+    /* Make sure device is in USB_STATE_DEFAULT state */
+    usb_device_reset(dev);
     if (bsr) {
         slot_ctx[3] = SLOT_DEFAULT << SLOT_STATE_SHIFT;
     } else {
@@ -2371,7 +2373,6 @@ static TRBCCode xhci_address_slot(XHCIState *xhci, unsigned int slotid,
         uint8_t buf[1];
 
         slot_ctx[3] = (SLOT_ADDRESSED << SLOT_STATE_SHIFT) | slotid;
-        usb_device_reset(dev);
         memset(&p, 0, sizeof(p));
         usb_packet_addbuf(&p, buf, sizeof(buf));
         usb_packet_setup(&p, USB_TOKEN_OUT,
Signature · 1 line
1.8.3.1
#3 lore raw

[Qemu-devel] [PULL 3/3] xen-usb: Fix 32bit build

In reply to Gerd Hoffmann

From: Anthony PERARD <[email protected]>

Message-id: [email protected]

---
 hw/usb/xen-usb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/usb/xen-usb.c +2 -1
index 0fd34c6..7bed0ce 100644
@@ -253,7 +253,8 @@ static int usbback_init_packet(struct usbback_req *usbback_req)
 
     case USBIF_PIPE_TYPE_CTRL:
         packet->parameter = *(uint64_t *)usbback_req->req.u.ctrl;
-        TR_REQ(xendev, "ctrl parameter: %lx, buflen: %x\n", packet->parameter,
+        TR_REQ(xendev, "ctrl parameter: %"PRIx64", buflen: %x\n",
+               packet->parameter,
                usbback_req->req.buffer_length);
         break;
 
Signature · 1 line
1.8.3.1
#4 lore raw
In reply to Gerd Hoffmann
Quoted 14 lines · Gerd Hoffmann

Hi,

A few usb bugfixes.

please pull,
Gerd

The following changes since commit f1ef55786691a1bf79db0b74ba1e5347a0d38c1b:

Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20160711' into staging (2016-07-11 18:46:38 +0100)

are available in the git repository at:

Quoted 9 lines

git://git.kraxel.org/qemu tags/pull-usb-20160712-1

for you to fetch changes up to 042ec47e6825cbea67b9ad957780204dc1d346bc:

xen-usb: Fix 32bit build (2016-07-12 10:47:03 +0200)

----------------------------------------------------------------
usb: misc fixes.

Applied, thanks.

-- PMM