* [PULL 0/2] Usb 20200212 patches
@ 2020-02-12 20:57 Gerd Hoffmann
2020-02-12 20:57 ` [PULL 1/2] usb-host: wait for cancel complete Gerd Hoffmann
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2020-02-12 20:57 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
The following changes since commit e18e5501d8ac692d32657a3e1ef545b14e72b730:
Merge remote-tracking branch 'remotes/dgilbert-gitlab/tags/pull-virtiofs-20200210' into staging (2020-02-10 18:09:14 +0000)
are available in the Git repository at:
git://git.kraxel.org/qemu tags/usb-20200212-pull-request
for you to fetch changes up to 8ddcc43592f215a7523774704df6c60d12d9f647:
uas: fix super speed bMaxPacketSize0 (2020-02-12 17:20:41 +0100)
----------------------------------------------------------------
usb: bugfixes
----------------------------------------------------------------
Gerd Hoffmann (2):
usb-host: wait for cancel complete
uas: fix super speed bMaxPacketSize0
hw/usb/dev-uas.c | 2 +-
hw/usb/host-libusb.c | 17 +++++++++--------
2 files changed, 10 insertions(+), 9 deletions(-)
--
2.18.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PULL 1/2] usb-host: wait for cancel complete
2020-02-12 20:57 [PULL 0/2] Usb 20200212 patches Gerd Hoffmann
@ 2020-02-12 20:57 ` Gerd Hoffmann
2020-02-12 20:57 ` [PULL 2/2] uas: fix super speed bMaxPacketSize0 Gerd Hoffmann
2020-02-13 17:25 ` [PULL 0/2] Usb 20200212 patches Peter Maydell
2 siblings, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2020-02-12 20:57 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
After canceling transfers call into libvirt so it can process the
request, and wait for it to complete. Also cancel all pending
transfers before exiting qemu.
Buglink: https://bugzilla.redhat.com//show_bug.cgi?id=1749745
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20200203114108.23952-1-kraxel@redhat.com
---
hw/usb/host-libusb.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index 259470090102..2ac7a936fb91 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -354,9 +354,7 @@ static USBHostRequest *usb_host_req_alloc(USBHostDevice *s, USBPacket *p,
static void usb_host_req_free(USBHostRequest *r)
{
- if (r->host) {
- QTAILQ_REMOVE(&r->host->requests, r, next);
- }
+ QTAILQ_REMOVE(&r->host->requests, r, next);
libusb_free_transfer(r->xfer);
g_free(r->buffer);
g_free(r);
@@ -468,12 +466,7 @@ static void usb_host_req_abort(USBHostRequest *r)
usb_packet_complete(USB_DEVICE(s), r->p);
}
r->p = NULL;
- }
- QTAILQ_REMOVE(&r->host->requests, r, next);
- r->host = NULL;
-
- if (inflight) {
libusb_cancel_transfer(r->xfer);
}
}
@@ -962,6 +955,13 @@ static void usb_host_abort_xfers(USBHostDevice *s)
QTAILQ_FOREACH_SAFE(r, &s->requests, next, rtmp) {
usb_host_req_abort(r);
}
+
+ while (QTAILQ_FIRST(&s->requests) != NULL) {
+ struct timeval tv;
+ memset(&tv, 0, sizeof(tv));
+ tv.tv_usec = 2500;
+ libusb_handle_events_timeout(ctx, &tv);
+ }
}
static int usb_host_close(USBHostDevice *s)
@@ -1011,6 +1011,7 @@ static void usb_host_exit_notifier(struct Notifier *n, void *data)
USBHostDevice *s = container_of(n, USBHostDevice, exit);
if (s->dh) {
+ usb_host_abort_xfers(s);
usb_host_release_interfaces(s);
libusb_reset_device(s->dh);
usb_host_attach_kernel(s);
--
2.18.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PULL 2/2] uas: fix super speed bMaxPacketSize0
2020-02-12 20:57 [PULL 0/2] Usb 20200212 patches Gerd Hoffmann
2020-02-12 20:57 ` [PULL 1/2] usb-host: wait for cancel complete Gerd Hoffmann
@ 2020-02-12 20:57 ` Gerd Hoffmann
2020-02-13 17:25 ` [PULL 0/2] Usb 20200212 patches Peter Maydell
2 siblings, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2020-02-12 20:57 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
For usb2 bMaxPacketSize0 is "n", for usb3 it is "1 << n",
so it must be 9 not 64 ...
rom "Universal Serial Bus 3.1 Specification":
If the device is operating at Gen X speed, the bMaxPacketSize0
field shall be set to 09H indicating a 512-byte maximum packet.
An Enhanced SuperSpeed device shall not support any other maximum
packet sizes for the default control pipe (endpoint 0) control
endpoint.
We now announce a 512-byte maximum packet.
Fixes: 89a453d4a5c ("uas-uas: usb3 streams")
Reported-by: Benjamin David Lunt <fys@fysnet.net>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20200117073716.31335-1-kraxel@redhat.com
---
hw/usb/dev-uas.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c
index 9825ec37d09c..11a8684cc2ab 100644
--- a/hw/usb/dev-uas.c
+++ b/hw/usb/dev-uas.c
@@ -303,7 +303,7 @@ static const USBDescDevice desc_device_high = {
static const USBDescDevice desc_device_super = {
.bcdUSB = 0x0300,
- .bMaxPacketSize0 = 64,
+ .bMaxPacketSize0 = 9,
.bNumConfigurations = 1,
.confs = (USBDescConfig[]) {
{
--
2.18.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PULL 0/2] Usb 20200212 patches
2020-02-12 20:57 [PULL 0/2] Usb 20200212 patches Gerd Hoffmann
2020-02-12 20:57 ` [PULL 1/2] usb-host: wait for cancel complete Gerd Hoffmann
2020-02-12 20:57 ` [PULL 2/2] uas: fix super speed bMaxPacketSize0 Gerd Hoffmann
@ 2020-02-13 17:25 ` Peter Maydell
2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2020-02-13 17:25 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: QEMU Developers
On Wed, 12 Feb 2020 at 21:00, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> The following changes since commit e18e5501d8ac692d32657a3e1ef545b14e72b730:
>
> Merge remote-tracking branch 'remotes/dgilbert-gitlab/tags/pull-virtiofs-20200210' into staging (2020-02-10 18:09:14 +0000)
>
> are available in the Git repository at:
>
> git://git.kraxel.org/qemu tags/usb-20200212-pull-request
>
> for you to fetch changes up to 8ddcc43592f215a7523774704df6c60d12d9f647:
>
> uas: fix super speed bMaxPacketSize0 (2020-02-12 17:20:41 +0100)
>
> ----------------------------------------------------------------
> usb: bugfixes
>
> ----------------------------------------------------------------
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/5.0
for any user-visible changes.
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-02-13 17:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-12 20:57 [PULL 0/2] Usb 20200212 patches Gerd Hoffmann
2020-02-12 20:57 ` [PULL 1/2] usb-host: wait for cancel complete Gerd Hoffmann
2020-02-12 20:57 ` [PULL 2/2] uas: fix super speed bMaxPacketSize0 Gerd Hoffmann
2020-02-13 17:25 ` [PULL 0/2] Usb 20200212 patches 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).