[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for-1.5 2/4] virtio-serial: fix command line com
From: |
Paolo Bonzini |
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 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 |
Il 29/04/2013 17:12, address@hidden ha scritto:
> From: KONRAD Frederic <address@hidden>
>
> The bus name is wrong since the refactoring.
>
> This keep the behaviour of the command line.
>
> Signed-off-by: KONRAD Frederic <address@hidden>
> ---
> 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)
>
- [Qemu-devel] [PATCH for-1.5 0/4] virtio: fix bus command line compatibility., fred . konrad, 2013/04/29
- [Qemu-devel] [PATCH for-1.5 1/4] virtio-x-bus: force bus name to virtio-bus., fred . konrad, 2013/04/29
- [Qemu-devel] [PATCH for-1.5 2/4] virtio-serial: fix command line compatibility., fred . konrad, 2013/04/29
- Re: [Qemu-devel] [PATCH for-1.5 2/4] virtio-serial: fix command line compatibility.,
Paolo Bonzini <=
- [Qemu-devel] [PATCH for-1.5 3/4] scsi: add scsi_named_bus_new()., fred . konrad, 2013/04/29
- [Qemu-devel] [PATCH for-1.5 4/4] virtio-scsi: fix the command line compatibility., fred . konrad, 2013/04/29
- Re: [Qemu-devel] [PATCH for-1.5 4/4] virtio-scsi: fix the command line compatibility., Paolo Bonzini, 2013/04/29
- Re: [Qemu-devel] [PATCH for-1.5 4/4] virtio-scsi: fix the command line compatibility., KONRAD Frédéric, 2013/04/29
- Re: [Qemu-devel] [PATCH for-1.5 4/4] virtio-scsi: fix the command line compatibility., Paolo Bonzini, 2013/04/29
- Re: [Qemu-devel] [PATCH for-1.5 4/4] virtio-scsi: fix the command line compatibility., KONRAD Frédéric, 2013/04/29
- Re: [Qemu-devel] [PATCH for-1.5 4/4] virtio-scsi: fix the command line compatibility., Andreas Färber, 2013/04/29
- Re: [Qemu-devel] [PATCH for-1.5 4/4] virtio-scsi: fix the command line compatibility., KONRAD Frédéric, 2013/04/29