[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v8 03/18] hw/usb/hcd-ehci: Add an auto-hub property and leave it off



Add auto-hub and leave it off. hw_compat_11_1 turns it on, so an older
machine type keeps the hub it has today and a guest saved by an older
QEMU still loads.

Suggested-by: Gerd Hoffmann <kraxel@xxxxxxxxxx>
Signed-off-by: Jamin Lin <jamin_lin@xxxxxxxxxxxxxx>
---
 hw/usb/hcd-ehci.h | 4 +++-
 hw/core/machine.c | 2 ++
 hw/usb/hcd-ehci.c | 1 +
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/hw/usb/hcd-ehci.h b/hw/usb/hcd-ehci.h
index b5ac9c8670..db9db537ff 100644
--- a/hw/usb/hcd-ehci.h
+++ b/hw/usb/hcd-ehci.h
@@ -269,6 +269,7 @@ struct EHCIState {
     bool migrate_fetch_addr_64bit;
     bool caps_64bit_addr;
     uint32_t ctrldssegment_default;
+    bool auto_hub;
 
     /*
      *  EHCI spec version 1.0 Section 2.3
@@ -336,7 +337,8 @@ struct EHCIState {
     DEFINE_PROP_BOOL("caps-64bit-addr", _state, \
                      ehci.caps_64bit_addr, false), \
     DEFINE_PROP_UINT32("ctrldssegment-default", _state, \
-                       ehci.ctrldssegment_default, 0)
+                       ehci.ctrldssegment_default, 0), \
+    DEFINE_PROP_BOOL("auto-hub", _state, ehci.auto_hub, false)
 
 extern const VMStateDescription vmstate_ehci;
 
diff --git a/hw/core/machine.c b/hw/core/machine.c
index f8f5b01117..0103038cad 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -43,6 +43,8 @@
 GlobalProperty hw_compat_11_1[] = {
     { "sysbus-ehci-usb", "x-migrate-fetch-addr-64bit", "off" },
     { "pci-ehci-usb", "x-migrate-fetch-addr-64bit", "off" },
+    { "sysbus-ehci-usb", "auto-hub", "on" },
+    { "pci-ehci-usb", "auto-hub", "on" },
     { "base-xhci", "auto-hub", "on" },
 };
 const size_t hw_compat_11_1_len = G_N_ELEMENTS(hw_compat_11_1);
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index f371e567f3..29b85869c3 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -2636,6 +2636,7 @@ void usb_ehci_realize(EHCIState *s, DeviceState *dev, 
Error **errp)
 
     usb_bus_new(&s->bus, sizeof(s->bus), s->companion_enable ?
                 &ehci_bus_ops_companion : &ehci_bus_ops_standalone, dev);
+    s->bus.auto_hub = s->auto_hub;
     for (i = 0; i < s->portnr; i++) {
         usb_register_port(&s->bus, &s->ports[i], s, i, &ehci_port_ops,
                           USB_SPEED_MASK_HIGH);
-- 
2.43.0



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.