qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/3] usb: misc fixes.
@ 2016-07-12  8:48 Gerd Hoffmann
  2016-07-12  8:48 ` [Qemu-devel] [PULL 1/3] nec-usb-xhci: set the device state to USB_STATE_DEFAULT Gerd Hoffmann
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2016-07-12  8:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: 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:


  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(-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PULL 1/3] nec-usb-xhci: set the device state to USB_STATE_DEFAULT
  2016-07-12  8:48 [Qemu-devel] [PULL 0/3] usb: misc fixes Gerd Hoffmann
@ 2016-07-12  8:48 ` Gerd Hoffmann
  2016-07-12  8:48 ` [Qemu-devel] [PULL 2/3] usb: add storage hotplug documentation Gerd Hoffmann
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2016-07-12  8:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: Zhang Shuaiyi, Gerd Hoffmann

From: Zhang Shuaiyi <zhang_syi@massclouds.com>

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 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index 1a3377f..976bfb0 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -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,
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PULL 2/3] usb: add storage hotplug documentation
  2016-07-12  8:48 [Qemu-devel] [PULL 0/3] usb: misc fixes Gerd Hoffmann
  2016-07-12  8:48 ` [Qemu-devel] [PULL 1/3] nec-usb-xhci: set the device state to USB_STATE_DEFAULT Gerd Hoffmann
@ 2016-07-12  8:48 ` Gerd Hoffmann
  2016-07-12  8:48 ` [Qemu-devel] [PULL 3/3] xen-usb: Fix 32bit build Gerd Hoffmann
  2016-07-12 11:34 ` [Qemu-devel] [PULL 0/3] usb: misc fixes Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2016-07-12  8:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 1466667901-1341-1-git-send-email-kraxel@redhat.com
---
 docs/usb-storage.txt | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/docs/usb-storage.txt b/docs/usb-storage.txt
index c5a3866..fbc1f2e 100644
--- a/docs/usb-storage.txt
+++ b/docs/usb-storage.txt
@@ -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
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PULL 3/3] xen-usb: Fix 32bit build
  2016-07-12  8:48 [Qemu-devel] [PULL 0/3] usb: misc fixes Gerd Hoffmann
  2016-07-12  8:48 ` [Qemu-devel] [PULL 1/3] nec-usb-xhci: set the device state to USB_STATE_DEFAULT Gerd Hoffmann
  2016-07-12  8:48 ` [Qemu-devel] [PULL 2/3] usb: add storage hotplug documentation Gerd Hoffmann
@ 2016-07-12  8:48 ` Gerd Hoffmann
  2016-07-12 11:34 ` [Qemu-devel] [PULL 0/3] usb: misc fixes Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2016-07-12  8:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony PERARD, Gerd Hoffmann

From: Anthony PERARD <anthony.perard@citrix.com>

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Message-id: 20160623110829.22671-1-anthony.perard@citrix.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/xen-usb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/usb/xen-usb.c b/hw/usb/xen-usb.c
index 0fd34c6..7bed0ce 100644
--- a/hw/usb/xen-usb.c
+++ b/hw/usb/xen-usb.c
@@ -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;
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PULL 0/3] usb: misc fixes.
  2016-07-12  8:48 [Qemu-devel] [PULL 0/3] usb: misc fixes Gerd Hoffmann
                   ` (2 preceding siblings ...)
  2016-07-12  8:48 ` [Qemu-devel] [PULL 3/3] xen-usb: Fix 32bit build Gerd Hoffmann
@ 2016-07-12 11:34 ` Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2016-07-12 11:34 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: QEMU Developers

On 12 July 2016 at 09:48, Gerd Hoffmann <kraxel@redhat.com> wrote:
>   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.
>

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-07-12 11:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-12  8:48 [Qemu-devel] [PULL 0/3] usb: misc fixes Gerd Hoffmann
2016-07-12  8:48 ` [Qemu-devel] [PULL 1/3] nec-usb-xhci: set the device state to USB_STATE_DEFAULT Gerd Hoffmann
2016-07-12  8:48 ` [Qemu-devel] [PULL 2/3] usb: add storage hotplug documentation Gerd Hoffmann
2016-07-12  8:48 ` [Qemu-devel] [PULL 3/3] xen-usb: Fix 32bit build Gerd Hoffmann
2016-07-12 11:34 ` [Qemu-devel] [PULL 0/3] usb: misc fixes Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).