Message ID | 1402933252-1079-3-git-send-email-ming.lei@canonical.com |
---|---|
State | New |
Headers | show |
On Mon, 16 Jun 2014 23:40:50 +0800 Ming Lei <ming.lei@canonical.com> wrote: > The two common virtio features can be defined per bus, so move all > into virtio-s390 class device to make code more clean. > > Suggested-by: Paolo Bonzini <pbonzini@redhat.com> > Signed-off-by: Ming Lei <ming.lei@canonical.com> > --- > hw/s390x/s390-virtio-bus.c | 15 ++++++--------- > 1 file changed, 6 insertions(+), 9 deletions(-) This one breaks for me: qemu-system-s390x: -device virtio-blk-s390,scsi=off,config-wce=off,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1: Property '.scsi' not found > > diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c > index 9c71afa..ab9758e 100644 > --- a/hw/s390x/s390-virtio-bus.c > +++ b/hw/s390x/s390-virtio-bus.c > @@ -526,18 +526,11 @@ static const TypeInfo s390_virtio_net = { > .class_init = s390_virtio_net_class_init, > }; > > -static Property s390_virtio_blk_properties[] = { > - DEFINE_VIRTIO_BLK_PROPERTIES(VirtIOBlkS390, blk), > - DEFINE_PROP_END_OF_LIST(), > -}; > - > static void s390_virtio_blk_class_init(ObjectClass *klass, void *data) > { > - DeviceClass *dc = DEVICE_CLASS(klass); > VirtIOS390DeviceClass *k = VIRTIO_S390_DEVICE_CLASS(klass); > > k->init = s390_virtio_blk_init; > - dc->props = s390_virtio_blk_properties; ...which is probably because you removed the block properties here. > } > > static const TypeInfo s390_virtio_blk = { > @@ -571,7 +564,6 @@ static const TypeInfo s390_virtio_serial = { > }; > > static Property s390_virtio_rng_properties[] = { > - DEFINE_VIRTIO_COMMON_FEATURES(VirtIOS390Device, host_features), > DEFINE_VIRTIO_RNG_PROPERTIES(VirtIORNGS390, vdev.conf), > DEFINE_PROP_END_OF_LIST(), > }; > @@ -610,10 +602,16 @@ static void s390_virtio_busdev_reset(DeviceState *dev) > virtio_reset(_dev->vdev); > } > > +static Property virtio_s390_properties[] = { > + DEFINE_VIRTIO_COMMON_FEATURES(VirtIOS390Device, host_features), > + DEFINE_PROP_END_OF_LIST(), > +}; > + > static void virtio_s390_device_class_init(ObjectClass *klass, void *data) > { > DeviceClass *dc = DEVICE_CLASS(klass); > > + dc->props = virtio_s390_properties; > dc->init = s390_virtio_busdev_init; > dc->bus_type = TYPE_S390_VIRTIO_BUS; > dc->unplug = qdev_simple_unplug_cb; > @@ -654,7 +652,6 @@ static const TypeInfo s390_virtio_scsi = { > > #ifdef CONFIG_VHOST_SCSI > static Property s390_vhost_scsi_properties[] = { > - DEFINE_VIRTIO_COMMON_FEATURES(VirtIOS390Device, host_features), > DEFINE_VHOST_SCSI_PROPERTIES(VHostSCSIS390, vdev.parent_obj.conf), > DEFINE_PROP_END_OF_LIST(), > };
Hi Cornelia, Thanks for your test. On Tue, Jun 17, 2014 at 12:04 AM, Cornelia Huck <cornelia.huck@de.ibm.com> wrote: > On Mon, 16 Jun 2014 23:40:50 +0800 > Ming Lei <ming.lei@canonical.com> wrote: > >> The two common virtio features can be defined per bus, so move all >> into virtio-s390 class device to make code more clean. >> >> Suggested-by: Paolo Bonzini <pbonzini@redhat.com> >> Signed-off-by: Ming Lei <ming.lei@canonical.com> >> --- >> hw/s390x/s390-virtio-bus.c | 15 ++++++--------- >> 1 file changed, 6 insertions(+), 9 deletions(-) > > This one breaks for me: > > qemu-system-s390x: -device virtio-blk-s390,scsi=off,config-wce=off,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1: Property '.scsi' not found > >> >> diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c >> index 9c71afa..ab9758e 100644 >> --- a/hw/s390x/s390-virtio-bus.c >> +++ b/hw/s390x/s390-virtio-bus.c >> @@ -526,18 +526,11 @@ static const TypeInfo s390_virtio_net = { >> .class_init = s390_virtio_net_class_init, >> }; >> >> -static Property s390_virtio_blk_properties[] = { >> - DEFINE_VIRTIO_BLK_PROPERTIES(VirtIOBlkS390, blk), >> - DEFINE_PROP_END_OF_LIST(), >> -}; >> - >> static void s390_virtio_blk_class_init(ObjectClass *klass, void *data) >> { >> - DeviceClass *dc = DEVICE_CLASS(klass); >> VirtIOS390DeviceClass *k = VIRTIO_S390_DEVICE_CLASS(klass); >> >> k->init = s390_virtio_blk_init; >> - dc->props = s390_virtio_blk_properties; > > ...which is probably because you removed the block properties here. That looks a bit weird because qemu still continues to add parent's properties if the device hasn't define property. I will investigate the issue further tomorrow. thanks, -- Ming Lei
diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c index 9c71afa..ab9758e 100644 --- a/hw/s390x/s390-virtio-bus.c +++ b/hw/s390x/s390-virtio-bus.c @@ -526,18 +526,11 @@ static const TypeInfo s390_virtio_net = { .class_init = s390_virtio_net_class_init, }; -static Property s390_virtio_blk_properties[] = { - DEFINE_VIRTIO_BLK_PROPERTIES(VirtIOBlkS390, blk), - DEFINE_PROP_END_OF_LIST(), -}; - static void s390_virtio_blk_class_init(ObjectClass *klass, void *data) { - DeviceClass *dc = DEVICE_CLASS(klass); VirtIOS390DeviceClass *k = VIRTIO_S390_DEVICE_CLASS(klass); k->init = s390_virtio_blk_init; - dc->props = s390_virtio_blk_properties; } static const TypeInfo s390_virtio_blk = { @@ -571,7 +564,6 @@ static const TypeInfo s390_virtio_serial = { }; static Property s390_virtio_rng_properties[] = { - DEFINE_VIRTIO_COMMON_FEATURES(VirtIOS390Device, host_features), DEFINE_VIRTIO_RNG_PROPERTIES(VirtIORNGS390, vdev.conf), DEFINE_PROP_END_OF_LIST(), }; @@ -610,10 +602,16 @@ static void s390_virtio_busdev_reset(DeviceState *dev) virtio_reset(_dev->vdev); } +static Property virtio_s390_properties[] = { + DEFINE_VIRTIO_COMMON_FEATURES(VirtIOS390Device, host_features), + DEFINE_PROP_END_OF_LIST(), +}; + static void virtio_s390_device_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); + dc->props = virtio_s390_properties; dc->init = s390_virtio_busdev_init; dc->bus_type = TYPE_S390_VIRTIO_BUS; dc->unplug = qdev_simple_unplug_cb; @@ -654,7 +652,6 @@ static const TypeInfo s390_virtio_scsi = { #ifdef CONFIG_VHOST_SCSI static Property s390_vhost_scsi_properties[] = { - DEFINE_VIRTIO_COMMON_FEATURES(VirtIOS390Device, host_features), DEFINE_VHOST_SCSI_PROPERTIES(VHostSCSIS390, vdev.parent_obj.conf), DEFINE_PROP_END_OF_LIST(), };
The two common virtio features can be defined per bus, so move all into virtio-s390 class device to make code more clean. Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Ming Lei <ming.lei@canonical.com> --- hw/s390x/s390-virtio-bus.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)