dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 0327-usb-redir-Ensure-our-peer-has-the-necessary-caps-whe.patch

c8dfc6
From af1ecda005c043dd8186725ae7a93ea66ebfe96f Mon Sep 17 00:00:00 2001
c8dfc6
From: Hans de Goede <hdegoede@redhat.com>
c8dfc6
Date: Mon, 3 Sep 2012 12:04:49 +0200
c8dfc6
Subject: [PATCH 327/366] usb-redir: Ensure our peer has the necessary caps
c8dfc6
 when redirecting to XHCI
c8dfc6
c8dfc6
In order for redirection to work properly when redirecting to an emulated
c8dfc6
XHCI controller, the usb-redir-host must support both
c8dfc6
usb_redir_cap_ep_info_max_packet_size and usb_redir_cap_64bits_ids,
c8dfc6
reject any devices redirected to an XHCI controller when these are not
c8dfc6
supported.
c8dfc6
c8dfc6
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
c8dfc6
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
c8dfc6
---
c8dfc6
 hw/usb/redirect.c | 11 +++++++++++
c8dfc6
 1 file changed, 11 insertions(+)
c8dfc6
c8dfc6
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
c8dfc6
index 357f307..5b0f834 100644
c8dfc6
--- a/hw/usb/redirect.c
c8dfc6
+++ b/hw/usb/redirect.c
c8dfc6
@@ -834,6 +834,17 @@ static void usbredir_do_attach(void *opaque)
c8dfc6
 {
c8dfc6
     USBRedirDevice *dev = opaque;
c8dfc6
 
c8dfc6
+    /* In order to work properly with XHCI controllers we need these caps */
c8dfc6
+    if ((dev->dev.port->speedmask & USB_SPEED_MASK_SUPER) && !(
c8dfc6
+        usbredirparser_peer_has_cap(dev->parser,
c8dfc6
+                                    usb_redir_cap_ep_info_max_packet_size) &&
c8dfc6
+        usbredirparser_peer_has_cap(dev->parser,
c8dfc6
+                                    usb_redir_cap_64bits_ids))) {
c8dfc6
+        ERROR("usb-redir-host lacks capabilities needed for use with XHCI\n");
c8dfc6
+        usbredir_reject_device(dev);
c8dfc6
+        return;
c8dfc6
+    }
c8dfc6
+
c8dfc6
     if (usb_device_attach(&dev->dev) != 0) {
c8dfc6
         usbredir_reject_device(dev);
c8dfc6
     }
c8dfc6
-- 
c8dfc6
1.7.12
c8dfc6