[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 01/21] usb/vmstate: add parent dev path
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 01/21] usb/vmstate: add parent dev path |
Date: |
Tue, 17 Apr 2012 10:45:06 +0200 |
... to make vmstate id string truely unique with multiple host
controllers, i.e. move from "1/usb-ptr" to "0000:00:01.3/1/usb-ptr"
(usb tabled connected to piix3 uhci).
This obviously breaks migration. To handle this the usb bus
property "full-path" is added. When setting this to false old
behavior is maintained. This way current qemu will be compatible
with old versions when started using '-M pc-$oldversion'.
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/pc_piix.c | 4 ++++
hw/usb.h | 5 +++++
hw/usb/bus.c | 17 ++++++++++++++++-
3 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index 907d723..6a75718 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -377,6 +377,10 @@ static QEMUMachine pc_machine_v1_1 = {
.driver = "apic",\
.property = "vapic",\
.value = "off",\
+ },{\
+ .driver = "USB",\
+ .property = "full-path",\
+ .value = "no",\
}
static QEMUMachine pc_machine_v1_0 = {
diff --git a/hw/usb.h b/hw/usb.h
index e95085f..ae7ccda 100644
--- a/hw/usb.h
+++ b/hw/usb.h
@@ -182,12 +182,17 @@ struct USBEndpoint {
QTAILQ_HEAD(, USBPacket) queue;
};
+enum USBDeviceFlags {
+ USB_DEV_FLAG_FULL_PATH,
+};
+
/* definition of a USB device */
struct USBDevice {
DeviceState qdev;
USBPort *port;
char *port_path;
void *opaque;
+ uint32_t flags;
/* Actual connected speed */
int speed;
diff --git a/hw/usb/bus.c b/hw/usb/bus.c
index d3f8358..2068640 100644
--- a/hw/usb/bus.c
+++ b/hw/usb/bus.c
@@ -19,6 +19,8 @@ static struct BusInfo usb_bus_info = {
.get_fw_dev_path = usb_get_fw_dev_path,
.props = (Property[]) {
DEFINE_PROP_STRING("port", USBDevice, port_path),
+ DEFINE_PROP_BIT("full-path", USBDevice, flags,
+ USB_DEV_FLAG_FULL_PATH, true),
DEFINE_PROP_END_OF_LIST()
},
};
@@ -460,7 +462,20 @@ static void usb_bus_dev_print(Monitor *mon, DeviceState
*qdev, int indent)
static char *usb_get_dev_path(DeviceState *qdev)
{
USBDevice *dev = USB_DEVICE(qdev);
- return g_strdup(dev->port->path);
+ DeviceState *hcd = qdev->parent_bus->parent;
+ char *id = NULL;
+
+ if ((dev->flags & (1 << USB_DEV_FLAG_FULL_PATH)) &&
+ hcd && hcd->parent_bus && hcd->parent_bus->info->get_dev_path) {
+ id = hcd->parent_bus->info->get_dev_path(hcd);
+ }
+ if (id) {
+ char *ret = g_strdup_printf("%s/%s", id, dev->port->path);
+ g_free(id);
+ return ret;
+ } else {
+ return g_strdup(dev->port->path);
+ }
}
static char *usb_get_fw_dev_path(DeviceState *qdev)
--
1.7.1
- [Qemu-devel] [PULL 00/21] usb patch queue, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 03/21] usb-uhci: queuing fix, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 05/21] usb-host: trace emulated requests, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 17/21] usb: use USBDescriptor for endpoint descriptors., Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 01/21] usb/vmstate: add parent dev path,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 11/21] usb-ehci: fix ehci_child_detach, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 14/21] usb: use USBDescriptor for device qualifier descriptors., Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 10/21] usb-hub: add tracepoints, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 18/21] usb-host: rewrite usb_linux_update_endp_table, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 21/21] usb-ehci: drop assert(), Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 08/21] usb-host: add property to turn off pipelining, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 19/21] usb-ehci: Drop unused sofv value, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 16/21] usb: use USBDescriptor for interface descriptors., Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 09/21] usb_packet_set_state: handle p->ep == NULL, Gerd Hoffmann, 2012/04/17
- [Qemu-devel] [PATCH 06/21] usb-host: trace canceled requests, Gerd Hoffmann, 2012/04/17