qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL for-2.2 0/3] usb bugfixes for 2.2
@ 2014-11-12 15:13 Gerd Hoffmann
  2014-11-12 15:13 ` [Qemu-devel] [PULL for-2.2 1/3] Provide the missing LIBUSB_LOG_LEVEL_* for older libusb or FreeBSD. Providing just the needed value as a defined Gerd Hoffmann
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2014-11-12 15:13 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

  Hi,

usb patch queue with three little fixes.

please pull,
  Gerd

The following changes since commit 558c2c8ddfb165a36eb95dc93125c04829d68aa7:

  Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2014-11-10 16:28:51 +0000)

are available in the git repository at:


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

for you to fetch changes up to 79ae25af1569a50a0ec799901a1bb280c088f121:

  usb-host: fix usb_host_speed_compat tyops (2014-11-12 15:27:23 +0100)

----------------------------------------------------------------
usb bugfixes for 2.2

----------------------------------------------------------------
Chris Johns (1):
      Provide the missing LIBUSB_LOG_LEVEL_* for older libusb or FreeBSD. Providing just the needed value as a defined.

Gerd Hoffmann (2):
      xhci: add sanity checks to xhci_lookup_uport
      usb-host: fix usb_host_speed_compat tyops

 hw/usb/hcd-xhci.c    |  9 +++++++++
 hw/usb/host-libusb.c | 12 +++++++++---
 2 files changed, 18 insertions(+), 3 deletions(-)

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

* [Qemu-devel] [PULL for-2.2 1/3] Provide the missing LIBUSB_LOG_LEVEL_* for older libusb or FreeBSD. Providing just the needed value as a defined.
  2014-11-12 15:13 [Qemu-devel] [PULL for-2.2 0/3] usb bugfixes for 2.2 Gerd Hoffmann
@ 2014-11-12 15:13 ` Gerd Hoffmann
  2014-11-12 15:13 ` [Qemu-devel] [PULL for-2.2 2/3] xhci: add sanity checks to xhci_lookup_uport Gerd Hoffmann
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2014-11-12 15:13 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Chris Johns

From: Chris Johns <chrisj@rtems.org>

Signed-off-by: Chris Johns <chrisj@rtems.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/host-libusb.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index d2d161b..032a0e4 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -143,6 +143,12 @@ static void usb_host_attach_kernel(USBHostDevice *s);
 
 /* ------------------------------------------------------------------------ */
 
+#ifndef LIBUSB_LOG_LEVEL_WARNING /* older libusb didn't define these */
+#define LIBUSB_LOG_LEVEL_WARNING 2
+#endif
+
+/* ------------------------------------------------------------------------ */
+
 #define CONTROL_TIMEOUT  10000        /* 10 sec    */
 #define BULK_TIMEOUT         0        /* unlimited */
 #define INTR_TIMEOUT         0        /* unlimited */
-- 
1.8.3.1

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

* [Qemu-devel] [PULL for-2.2 2/3] xhci: add sanity checks to xhci_lookup_uport
  2014-11-12 15:13 [Qemu-devel] [PULL for-2.2 0/3] usb bugfixes for 2.2 Gerd Hoffmann
  2014-11-12 15:13 ` [Qemu-devel] [PULL for-2.2 1/3] Provide the missing LIBUSB_LOG_LEVEL_* for older libusb or FreeBSD. Providing just the needed value as a defined Gerd Hoffmann
@ 2014-11-12 15:13 ` Gerd Hoffmann
  2014-11-12 15:13 ` [Qemu-devel] [PULL for-2.2 3/3] usb-host: fix usb_host_speed_compat tyops Gerd Hoffmann
  2014-11-13 11:51 ` [Qemu-devel] [PULL for-2.2 0/3] usb bugfixes for 2.2 Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2014-11-12 15:13 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

Also catch xhci_lookup_uport failures in post_load.

https://bugzilla.redhat.com/show_bug.cgi?id=1074219

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/hcd-xhci.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index 2930b72..9a942cf 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -2262,6 +2262,9 @@ static USBPort *xhci_lookup_uport(XHCIState *xhci, uint32_t *slot_ctx)
     int i, pos, port;
 
     port = (slot_ctx[1]>>16) & 0xFF;
+    if (port < 1 || port > xhci->numports) {
+        return NULL;
+    }
     port = xhci->ports[port-1].uport->index+1;
     pos = snprintf(path, sizeof(path), "%d", port);
     for (i = 0; i < 5; i++) {
@@ -3706,6 +3709,12 @@ static int usb_xhci_post_load(void *opaque, int version_id)
             xhci_mask64(ldq_le_pci_dma(pci_dev, dcbaap + 8 * slotid));
         xhci_dma_read_u32s(xhci, slot->ctx, slot_ctx, sizeof(slot_ctx));
         slot->uport = xhci_lookup_uport(xhci, slot_ctx);
+        if (!slot->uport) {
+            /* should not happen, but may trigger on guest bugs */
+            slot->enabled = 0;
+            slot->addressed = 0;
+            continue;
+        }
         assert(slot->uport && slot->uport->dev);
 
         for (epid = 1; epid <= 31; epid++) {
-- 
1.8.3.1

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

* [Qemu-devel] [PULL for-2.2 3/3] usb-host: fix usb_host_speed_compat tyops
  2014-11-12 15:13 [Qemu-devel] [PULL for-2.2 0/3] usb bugfixes for 2.2 Gerd Hoffmann
  2014-11-12 15:13 ` [Qemu-devel] [PULL for-2.2 1/3] Provide the missing LIBUSB_LOG_LEVEL_* for older libusb or FreeBSD. Providing just the needed value as a defined Gerd Hoffmann
  2014-11-12 15:13 ` [Qemu-devel] [PULL for-2.2 2/3] xhci: add sanity checks to xhci_lookup_uport Gerd Hoffmann
@ 2014-11-12 15:13 ` Gerd Hoffmann
  2014-11-13 11:51 ` [Qemu-devel] [PULL for-2.2 0/3] usb bugfixes for 2.2 Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2014-11-12 15:13 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
---
 hw/usb/host-libusb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index 032a0e4..a5f9dab 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -749,13 +749,13 @@ static void usb_host_speed_compat(USBHostDevice *s)
 
     udev->speedmask = (1 << udev->speed);
     if (udev->speed == USB_SPEED_SUPER && compat_high) {
-        udev->speedmask |= USB_SPEED_HIGH;
+        udev->speedmask |= USB_SPEED_MASK_HIGH;
     }
     if (udev->speed == USB_SPEED_SUPER && compat_full) {
-        udev->speedmask |= USB_SPEED_FULL;
+        udev->speedmask |= USB_SPEED_MASK_FULL;
     }
     if (udev->speed == USB_SPEED_HIGH && compat_full) {
-        udev->speedmask |= USB_SPEED_FULL;
+        udev->speedmask |= USB_SPEED_MASK_FULL;
     }
 }
 
-- 
1.8.3.1

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

* Re: [Qemu-devel] [PULL for-2.2 0/3] usb bugfixes for 2.2
  2014-11-12 15:13 [Qemu-devel] [PULL for-2.2 0/3] usb bugfixes for 2.2 Gerd Hoffmann
                   ` (2 preceding siblings ...)
  2014-11-12 15:13 ` [Qemu-devel] [PULL for-2.2 3/3] usb-host: fix usb_host_speed_compat tyops Gerd Hoffmann
@ 2014-11-13 11:51 ` Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2014-11-13 11:51 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: QEMU Developers

On 12 November 2014 15:13, Gerd Hoffmann <kraxel@redhat.com> wrote:
>   Hi,
>
> usb patch queue with three little fixes.
>
> please pull,
>   Gerd
>
> The following changes since commit 558c2c8ddfb165a36eb95dc93125c04829d68aa7:
>
>   Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2014-11-10 16:28:51 +0000)
>
> are available in the git repository at:
>
>
>   git://git.kraxel.org/qemu tags/pull-usb-20141112-1
>
> for you to fetch changes up to 79ae25af1569a50a0ec799901a1bb280c088f121:
>
>   usb-host: fix usb_host_speed_compat tyops (2014-11-12 15:27:23 +0100)
>
> ----------------------------------------------------------------
> usb bugfixes for 2.2
>
> ----------------------------------------------------------------

Applied, thanks.

-- PMM

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

end of thread, other threads:[~2014-11-13 11:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-12 15:13 [Qemu-devel] [PULL for-2.2 0/3] usb bugfixes for 2.2 Gerd Hoffmann
2014-11-12 15:13 ` [Qemu-devel] [PULL for-2.2 1/3] Provide the missing LIBUSB_LOG_LEVEL_* for older libusb or FreeBSD. Providing just the needed value as a defined Gerd Hoffmann
2014-11-12 15:13 ` [Qemu-devel] [PULL for-2.2 2/3] xhci: add sanity checks to xhci_lookup_uport Gerd Hoffmann
2014-11-12 15:13 ` [Qemu-devel] [PULL for-2.2 3/3] usb-host: fix usb_host_speed_compat tyops Gerd Hoffmann
2014-11-13 11:51 ` [Qemu-devel] [PULL for-2.2 0/3] usb bugfixes for 2.2 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).