* [Qemu-devel] [RfC PATCH] usb/vmstate: add parent dev path
@ 2012-03-13 12:34 Gerd Hoffmann
2012-03-13 12:42 ` Paolo Bonzini
0 siblings, 1 reply; 5+ messages in thread
From: Gerd Hoffmann @ 2012-03-13 12:34 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
... 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 is needed in case you have multiple USB busses in a virtual
machine to make sure the section names are unique. Obviously this
will break migration. I'm sitting on the patch for a while already,
with the plan to sneak it in when we have a migration flag day anyway
for the planned new & shiny migration format.
It doesn't look like this is going to happen anytime soon. I'd like to
have this fixed in the 1.1 release. Suggestions how to go forward?
cheers,
Gerd
---
hw/usb/bus.c | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/hw/usb/bus.c b/hw/usb/bus.c
index d3f8358..0ffb89e 100644
--- a/hw/usb/bus.c
+++ b/hw/usb/bus.c
@@ -460,7 +460,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 (hcd && hcd->parent_bus && hcd->parent_bus->info->get_dev_path) {
+ id = hcd->parent_bus->info->get_dev_path(hcd);
+ }
+ if (id) {
+ int len = strlen(id)+strlen(dev->port->path)+2;
+ char *ret = g_malloc(len);
+ snprintf(ret, len, "%s/%s", id, dev->port->path);
+ return ret;
+ } else {
+ return g_strdup(dev->port->path);
+ }
}
static char *usb_get_fw_dev_path(DeviceState *qdev)
--
1.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [RfC PATCH] usb/vmstate: add parent dev path
2012-03-13 12:34 [Qemu-devel] [RfC PATCH] usb/vmstate: add parent dev path Gerd Hoffmann
@ 2012-03-13 12:42 ` Paolo Bonzini
0 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2012-03-13 12:42 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel
Il 13/03/2012 13:34, Gerd Hoffmann ha scritto:
> ... 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 is needed in case you have multiple USB busses in a virtual
> machine to make sure the section names are unique. Obviously this
> will break migration. I'm sitting on the patch for a while already,
> with the plan to sneak it in when we have a migration flag day anyway
> for the planned new & shiny migration format.
>
> It doesn't look like this is going to happen anytime soon. I'd like to
> have this fixed in the 1.1 release. Suggestions how to go forward?
Add a property to the hcd devices, and set it to false for compatibility
machines?
That is
- if (id) {
+ if (id && qdev_get_bit(hcd, "full-device-path")) {
BTW, your recently added serial.wakeup property uses a uint32... any
chance you could change it to a bit so that -global isa-serial.wakeup=on
works (nicer than =1 imho)?
Paolo
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] [RfC PATCH] usb/vmstate: add parent dev path
@ 2011-08-26 10:11 Gerd Hoffmann
2011-08-26 10:25 ` Daniel P. Berrange
0 siblings, 1 reply; 5+ messages in thread
From: Gerd Hoffmann @ 2011-08-26 10:11 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
... 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).
Obvious problem with that is that it breaks migration from and to older
versions, thats why it is RfC. I don't see any way to fix the issue
without breaking though. So the question is how to deal with that best?
Given that we plan to break the migration anyway for 1.0 one option
would be to just wait a bit and merge this as part of the new migration
protocol patch series.
Comments?
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb-bus.c | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/hw/usb-bus.c b/hw/usb-bus.c
index c0bbc7c..477d57f 100644
--- a/hw/usb-bus.c
+++ b/hw/usb-bus.c
@@ -342,7 +342,20 @@ static void usb_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent)
static char *usb_get_dev_path(DeviceState *qdev)
{
USBDevice *dev = DO_UPCAST(USBDevice, qdev, qdev);
- return g_strdup(dev->port->path);
+ DeviceState *hcd = qdev->parent_bus->parent;
+ char *id = NULL;
+
+ if (hcd && hcd->parent_bus && hcd->parent_bus->info->get_dev_path) {
+ id = hcd->parent_bus->info->get_dev_path(hcd);
+ }
+ if (id) {
+ int len = strlen(id)+strlen(dev->port->path)+2;
+ char *ret = g_malloc(len);
+ snprintf(ret, len, "%s/%s", id, dev->port->path);
+ return ret;
+ } else {
+ return g_strdup(dev->port->path);
+ }
}
static char *usb_get_fw_dev_path(DeviceState *qdev)
--
1.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [RfC PATCH] usb/vmstate: add parent dev path
2011-08-26 10:11 Gerd Hoffmann
@ 2011-08-26 10:25 ` Daniel P. Berrange
2011-08-26 10:46 ` Gerd Hoffmann
0 siblings, 1 reply; 5+ messages in thread
From: Daniel P. Berrange @ 2011-08-26 10:25 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel
On Fri, Aug 26, 2011 at 12:11:20PM +0200, Gerd Hoffmann wrote:
> ... 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).
>
> Obvious problem with that is that it breaks migration from and to older
> versions, thats why it is RfC. I don't see any way to fix the issue
> without breaking though. So the question is how to deal with that best?
How about keeping the original naming *only* for devices on the first
USB controller. Since it was impossible to start a QEMU process with
2 USB controllers, migration compatibility does not matter for the
naming of devices on the 2nd, 3rd, 4th.... controller.
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [RfC PATCH] usb/vmstate: add parent dev path
2011-08-26 10:25 ` Daniel P. Berrange
@ 2011-08-26 10:46 ` Gerd Hoffmann
0 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2011-08-26 10:46 UTC (permalink / raw)
To: Daniel P. Berrange; +Cc: qemu-devel
On 08/26/11 12:25, Daniel P. Berrange wrote:
> On Fri, Aug 26, 2011 at 12:11:20PM +0200, Gerd Hoffmann wrote:
>> ... 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).
>>
>> Obvious problem with that is that it breaks migration from and to older
>> versions, thats why it is RfC. I don't see any way to fix the issue
>> without breaking though. So the question is how to deal with that best?
>
> How about keeping the original naming *only* for devices on the first
> USB controller. Since it was impossible to start a QEMU process with
> 2 USB controllers,
Now it is, and we have a release (0.15) in the wild which supports it.
> migration compatibility does not matter for the
> naming of devices on the 2nd, 3rd, 4th.... controller.
That would still break users which use usb 2.0 with qemu 0.15 today.
cheers,
Gerd
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-03-13 12:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-13 12:34 [Qemu-devel] [RfC PATCH] usb/vmstate: add parent dev path Gerd Hoffmann
2012-03-13 12:42 ` Paolo Bonzini
-- strict thread matches above, loose matches on Subject: below --
2011-08-26 10:11 Gerd Hoffmann
2011-08-26 10:25 ` Daniel P. Berrange
2011-08-26 10:46 ` Gerd Hoffmann
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).