On Tue, May 28, 2013 at 07:00:59PM +0800, Amos Kong wrote: > Recent virtio refactoring in QEMU made virtio-bus become the parent bus > of scsi-bus, and virtio-bus doesn't have get_fw_dev_path implementation, > so redundant typename will be added to fw_dev_path. It causes that > bootindex parameter of scsi device doesn't work. > > This patch changes qdev_get_fw_dev_path_helper() to add nothing if > implemented get_fw_dev_path() returns NULL. > > Signed-off-by: Amos Kong <ak...@redhat.com> > -- > v2: only add nothing to fw_dev_path when get_fw_dev_path() is > implemented and return NULL. then it will not effect other devices > don't have get_fw_dev_path() implementation.
[Reply to myself] Subject should be fixed, will send v3 later. commit 3643ed5aad5446c7e3eaf1958ae5fc5dbe8ed2d1 Author: Amos Kong <ak...@redhat.com> Date: Tue May 28 18:07:19 2013 +0800 qdev: add nothing to fw_dev_path when implemented get_fw_dev_path returns NULL Recent virtio refactoring in QEMU made virtio-bus become the parent bus of scsi-bus, and virtio-bus doesn't have get_fw_dev_path implementation, so redundant typename will be added to fw_dev_path. It causes that bootindex parameter of scsi device doesn't work. This patch changes qdev_get_fw_dev_path_helper() to add nothing if implemented get_fw_dev_path() returns NULL, and implement virtio_bus_get_fw_dev_path() to return NULL. Then QEMU will still pass original style of fw_dev_path to seabios. Signed-off-by: Amos Kong <ak...@redhat.com> -- v2: only add nothing to fw_dev_path when get_fw_dev_path() is implemented and returns NULL. then it will not effect other devices don't have get_fw_dev_path() implementation. v3: fix subject > --- > hw/core/qdev.c | 5 +++++ > hw/virtio/virtio-bus.c | 6 ++++++ > 2 files changed, 11 insertions(+) > > diff --git a/hw/core/qdev.c b/hw/core/qdev.c > index 6985ad8..2a08368 100644 > --- a/hw/core/qdev.c > +++ b/hw/core/qdev.c > @@ -509,11 +509,16 @@ static int qdev_get_fw_dev_path_helper(DeviceState > *dev, char *p, int size) > > if (dev && dev->parent_bus) { > char *d; > + BusClass *parent_bc = BUS_GET_CLASS(dev->parent_bus); > + > l = qdev_get_fw_dev_path_helper(dev->parent_bus->parent, p, size); > d = bus_get_fw_dev_path(dev->parent_bus, dev); > + > if (d) { > l += snprintf(p + l, size - l, "%s", d); > g_free(d); > + } else if (parent_bc->get_fw_dev_path) { > + return l; > } else { > l += snprintf(p + l, size - l, "%s", > object_get_typename(OBJECT(dev))); > } > diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c > index ea2e11a..6849a01 100644 > --- a/hw/virtio/virtio-bus.c > +++ b/hw/virtio/virtio-bus.c > @@ -161,10 +161,16 @@ static char *virtio_bus_get_dev_path(DeviceState *dev) > return qdev_get_dev_path(proxy); > } > > +static char *virtio_bus_get_fw_dev_path(DeviceState *dev) > +{ > + return NULL; > +} > + > 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; > + bus_class->get_fw_dev_path = virtio_bus_get_fw_dev_path; > } > > static const TypeInfo virtio_bus_info = { > -- > 1.8.1.4 > -- Amos.