From: Paolo Bonzini <pbonzini@redhat.com>
To: fred.konrad@greensocs.com
Cc: peter.maydell@linaro.org, aliguori@us.ibm.com,
mark.burton@greensocs.com, qemu-devel@nongnu.org, agraf@suse.de,
amit.shah@redhat.com, cornelia.huck@de.ibm.com, afaerber@suse.de
Subject: Re: [Qemu-devel] [PATCH for-1.5 2/4] virtio-serial: fix command line compatibility.
Date: Mon, 29 Apr 2013 17:45:15 +0200 [thread overview]
Message-ID: <517E958B.2090904@redhat.com> (raw)
In-Reply-To: <1367248365-27260-3-git-send-email-fred.konrad@greensocs.com>
Il 29/04/2013 17:12, fred.konrad@greensocs.com ha scritto:
> From: KONRAD Frederic <fred.konrad@greensocs.com>
>
> The bus name is wrong since the refactoring.
>
> This keep the behaviour of the command line.
>
> Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
> ---
> hw/char/virtio-serial-bus.c | 16 +++++++++++++++-
> hw/s390x/s390-virtio-bus.c | 8 ++++++++
> hw/s390x/virtio-ccw.c | 9 +++++++++
> hw/virtio/virtio-pci.c | 9 +++++++++
> include/hw/virtio/virtio-serial.h | 8 ++++++++
> 5 files changed, 49 insertions(+), 1 deletion(-)
>
> diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
> index 3787ad2..0817041 100644
> --- a/hw/char/virtio-serial-bus.c
> +++ b/hw/char/virtio-serial-bus.c
> @@ -889,6 +889,15 @@ static int virtser_port_qdev_exit(DeviceState *qdev)
> return 0;
> }
>
> +void set_virtio_serial_bus_name(DeviceState *dev, const char *bus_name)
> +{
> + VirtIOSerial *vser = VIRTIO_SERIAL(dev);
> + if (bus_name) {
> + vser->bus_name = g_malloc(strlen(bus_name) + 3);
> + snprintf(vser->bus_name, strlen(bus_name) + 3, "%s.0", bus_name);
> + }
> +}
Same comment as for virtio-scsi.
Thanks,
Paolo
> static int virtio_serial_device_init(VirtIODevice *vdev)
> {
> DeviceState *qdev = DEVICE(vdev);
> @@ -911,7 +920,8 @@ static int virtio_serial_device_init(VirtIODevice *vdev)
> sizeof(struct virtio_console_config));
>
> /* Spawn a new virtio-serial bus on which the ports will ride as devices */
> - qbus_create_inplace(&vser->bus.qbus, TYPE_VIRTIO_SERIAL_BUS, qdev, NULL);
> + qbus_create_inplace(&vser->bus.qbus, TYPE_VIRTIO_SERIAL_BUS, qdev,
> + vser->bus_name);
> vser->bus.qbus.allow_hotplug = 1;
> vser->bus.vser = vser;
> QTAILQ_INIT(&vser->ports);
> @@ -992,6 +1002,10 @@ static int virtio_serial_device_exit(DeviceState *dev)
>
> unregister_savevm(dev, "virtio-console", vser);
>
> + if (vser->bus_name) {
> + g_free(vser->bus_name);
> + }
> +
> g_free(vser->ivqs);
> g_free(vser->ovqs);
> g_free(vser->ports_map);
> diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c
> index d52a547..6620d29 100644
> --- a/hw/s390x/s390-virtio-bus.c
> +++ b/hw/s390x/s390-virtio-bus.c
> @@ -200,6 +200,14 @@ static int s390_virtio_serial_init(VirtIOS390Device *s390_dev)
>
> bus = DO_UPCAST(VirtIOS390Bus, bus, qdev->parent_bus);
>
> + /*
> + * For command line compatibility, this set the virtio-serial-device bus
> + * name as before.
> + */
> + if (qdev->id) {
> + set_virtio_serial_bus_name(vdev, qdev->id);
> + }
> +
> qdev_set_parent_bus(vdev, BUS(&s390_dev->bus));
> if (qdev_init(vdev) < 0) {
> return -1;
> diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
> index ef99080..daa94d6 100644
> --- a/hw/s390x/virtio-ccw.c
> +++ b/hw/s390x/virtio-ccw.c
> @@ -593,6 +593,15 @@ static int virtio_ccw_serial_init(VirtioCcwDevice *ccw_dev)
> {
> VirtioSerialCcw *dev = VIRTIO_SERIAL_CCW(ccw_dev);
> DeviceState *vdev = DEVICE(&dev->vdev);
> + DeviceState *proxy = DEVICE(ccw_dev);
> +
> + /*
> + * For command line compatibility, this set the virtio-serial-device bus
> + * name as before.
> + */
> + if (proxy->id) {
> + set_virtio_serial_bus_name(vdev, proxy->id);
> + }
>
> qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));
> if (qdev_init(vdev) < 0) {
> diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
> index 070df44..598876f 100644
> --- a/hw/virtio/virtio-pci.c
> +++ b/hw/virtio/virtio-pci.c
> @@ -1297,6 +1297,7 @@ static int virtio_serial_pci_init(VirtIOPCIProxy *vpci_dev)
> {
> VirtIOSerialPCI *dev = VIRTIO_SERIAL_PCI(vpci_dev);
> DeviceState *vdev = DEVICE(&dev->vdev);
> + DeviceState *proxy = DEVICE(vpci_dev);
>
> if (vpci_dev->class_code != PCI_CLASS_COMMUNICATION_OTHER &&
> vpci_dev->class_code != PCI_CLASS_DISPLAY_OTHER && /* qemu 0.10 */
> @@ -1310,6 +1311,14 @@ static int virtio_serial_pci_init(VirtIOPCIProxy *vpci_dev)
> vpci_dev->nvectors = dev->vdev.serial.max_virtserial_ports + 1;
> }
>
> + /*
> + * For command line compatibility, this set the virtio-serial-device bus
> + * name as before.
> + */
> + if (proxy->id) {
> + set_virtio_serial_bus_name(vdev, proxy->id);
> + }
> +
> qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
> if (qdev_init(vdev) < 0) {
> return -1;
> diff --git a/include/hw/virtio/virtio-serial.h b/include/hw/virtio/virtio-serial.h
> index 1d2040b..786e76b 100644
> --- a/include/hw/virtio/virtio-serial.h
> +++ b/include/hw/virtio/virtio-serial.h
> @@ -194,6 +194,9 @@ typedef struct VirtIOSerialPostLoad {
> struct VirtIOSerial {
> VirtIODevice parent_obj;
>
> + /* bus_name, for command line compatibility */
> + char *bus_name;
> +
> VirtQueue *c_ivq, *c_ovq;
> /* Arrays of ivqs and ovqs: one per port */
> VirtQueue **ivqs, **ovqs;
> @@ -244,6 +247,11 @@ size_t virtio_serial_guest_ready(VirtIOSerialPort *port);
> */
> void virtio_serial_throttle_port(VirtIOSerialPort *port, bool throttle);
>
> +/*
> + * For command line back compatibility, set the bus name before initialisation.
> + */
> +void set_virtio_serial_bus_name(DeviceState *dev, const char *bus_name);
> +
> #define TYPE_VIRTIO_SERIAL "virtio-serial-device"
> #define VIRTIO_SERIAL(obj) \
> OBJECT_CHECK(VirtIOSerial, (obj), TYPE_VIRTIO_SERIAL)
>
next prev parent reply other threads:[~2013-04-29 15:45 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-29 15:12 [Qemu-devel] [PATCH for-1.5 0/4] virtio: fix bus command line compatibility fred.konrad
2013-04-29 15:12 ` [Qemu-devel] [PATCH for-1.5 1/4] virtio-x-bus: force bus name to virtio-bus fred.konrad
2013-04-29 15:12 ` [Qemu-devel] [PATCH for-1.5 2/4] virtio-serial: fix command line compatibility fred.konrad
2013-04-29 15:45 ` Paolo Bonzini [this message]
2013-04-29 15:12 ` [Qemu-devel] [PATCH for-1.5 3/4] scsi: add scsi_named_bus_new() fred.konrad
2013-04-29 15:40 ` Paolo Bonzini
2013-04-29 16:15 ` KONRAD Frédéric
2013-04-29 15:12 ` [Qemu-devel] [PATCH for-1.5 4/4] virtio-scsi: fix the command line compatibility fred.konrad
2013-04-29 15:44 ` Paolo Bonzini
2013-04-29 16:28 ` KONRAD Frédéric
2013-04-29 16:32 ` Paolo Bonzini
2013-04-29 17:39 ` KONRAD Frédéric
2013-04-29 17:55 ` Andreas Färber
2013-04-29 18:17 ` KONRAD Frédéric
2013-04-30 13:06 ` KONRAD Frédéric
2013-04-30 14:01 ` Paolo Bonzini
2013-04-30 14:15 ` KONRAD Frédéric
2013-04-30 14:17 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=517E958B.2090904@redhat.com \
--to=pbonzini@redhat.com \
--cc=afaerber@suse.de \
--cc=agraf@suse.de \
--cc=aliguori@us.ibm.com \
--cc=amit.shah@redhat.com \
--cc=cornelia.huck@de.ibm.com \
--cc=fred.konrad@greensocs.com \
--cc=mark.burton@greensocs.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).