Skip to contentSkip to conversation

virtio: add virtio_bus_get_dev_path.

PATCH Applied [email protected] 3 participants 3 messages May 16, 2013 – May 22, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio: add virtio_bus_get_dev_path.

From: KONRAD Frederic <[email protected]>

This adds virtio_bus_get_dev_path to fix migration id string which is wrong since the virtio refactoring.

---
 hw/virtio/virtio-bus.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
hw/virtio/virtio-bus.c +14 -0
index aab72ff..ea2e11a 100644
@@ -154,12 +154,26 @@ void virtio_bus_set_vdev_config(VirtioBusState *bus, uint8_t *config)
     }
 }
 
+static char *virtio_bus_get_dev_path(DeviceState *dev)
+{
+    BusState *bus = qdev_get_parent_bus(dev);
+    DeviceState *proxy = DEVICE(bus->parent);
+    return qdev_get_dev_path(proxy);
+}
+
+static void virtio_bus_class_init(ObjectClass *klass, void *data)
+{
+    BusClass *bus_class = BUS_CLASS(klass);
+    bus_class->get_dev_path = virtio_bus_get_dev_path;
+}
+
 static const TypeInfo virtio_bus_info = {
     .name = TYPE_VIRTIO_BUS,
     .parent = TYPE_BUS,
     .instance_size = sizeof(VirtioBusState),
     .abstract = true,
     .class_size = sizeof(VirtioBusClass),
+    .class_init = virtio_bus_class_init
 };
 
 static void virtio_register_types(void)
Signature · 1 line
1.7.11.7
Tested-by on v1 1/1
#1 lore raw

Re: [Qemu-devel] [PATCH for-1.5] virtio: add virtio_bus_get_dev_path.'

Quoted 8 lines · On Thu, May 16, 2013 at 07:06:07PM +0200, [email protected] wrote:

From: KONRAD Frederic <[email protected]>

This adds virtio_bus_get_dev_path to fix migration id string which is wrong since the virtio refactoring.

Re-tested the failure scenario with this patch applied and this does seem to resolve the issue. For reference, the configuration was v1.4.0 <-> 1.5.0-rc2+fix using the following options:

x86_64-softmmu/qemu-system-x86_64 -enable-kvm -L temp-bios -M pc-i440fx-1.4 -m 512M -kernel boot/vmlinuz-x86_64 -initrd boot/test-initramfs-x86_64.img.gz -vga std -append seed=1234 -drive file=disk1.img,if=virtio -drive file=disk2.img,if=virtio -device virtio-net-pci,netdev=net0 -netdev user,id=net0

Quoted 38 lines
---
 hw/virtio/virtio-bus.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
hw/virtio/virtio-bus.c +14 -0
index aab72ff..ea2e11a 100644
@@ -154,12 +154,26 @@ void virtio_bus_set_vdev_config(VirtioBusState *bus, uint8_t *config)
     }
 }
 
+static char *virtio_bus_get_dev_path(DeviceState *dev)
+{
+    BusState *bus = qdev_get_parent_bus(dev);
+    DeviceState *proxy = DEVICE(bus->parent);
+    return qdev_get_dev_path(proxy);
+}
+
+static void virtio_bus_class_init(ObjectClass *klass, void *data)
+{
+    BusClass *bus_class = BUS_CLASS(klass);
+    bus_class->get_dev_path = virtio_bus_get_dev_path;
+}
+
 static const TypeInfo virtio_bus_info = {
     .name = TYPE_VIRTIO_BUS,
     .parent = TYPE_BUS,
     .instance_size = sizeof(VirtioBusState),
     .abstract = true,
     .class_size = sizeof(VirtioBusClass),
+    .class_init = virtio_bus_class_init
 };
 
 static void virtio_register_types(void)
Signature · 1 line
1.7.11.7