Skip to contentSkip to conversation

virtio-console: Add support for multiple ports for generic guest-host communication

PATCH Superseded Amit Shah 4 participants 17 messages Oct 20, 2009 – Oct 21, 2009 Kbuild

v9 of 10 Superseded Latest is v10 →

lore
Share & tools
lore

Amit Shah

author
#0 lore raw

v9 cover virtio-console: Add support for multiple ports for generic guest-host communication

Hello,

This patch series fixes a few problems since the last send, mainly in the save/restore code and a few bugs shown by the automated test suite (located in a separate git repo, link below).

The automated test suite and a standalone interactive test program are located at

http://fedorapeople.org/gitweb?p=amitshah/public_git/test-virtserial.git

These patches are based on top of the char patches I've sent previously.

Amit Shah (2):
virtio-console: Add a virtio-serial bus, support for multiple ports
virtio-console: Add a new virtserialport device for generic serial
port support

Gerd Hoffmann (1):
qdev: add string property.

 Makefile.target        |    2 +-
 hw/pc.c                |    9 -
 hw/ppc440_bamboo.c     |    7 -
 hw/qdev-properties.c   |   28 ++
 hw/qdev.c              |    8 +-
 hw/qdev.h              |    4 +
 hw/virtio-console.c    |  206 +++++++-------
 hw/virtio-console.h    |   19 --
 hw/virtio-pci.c        |    8 +-
 hw/virtio-serial-bus.c |  764 ++++++++++++++++++++++++++++++++++++++++++++++++
 hw/virtio-serial.h     |  227 ++++++++++++++
 hw/virtio.h            |    2 +-
 qemu-options.hx        |    6 +-
 sysemu.h               |    6 -
 vl.c                   |   65 +++--
 15 files changed, 1182 insertions(+), 179 deletions(-)
 delete mode 100644 hw/virtio-console.h
 create mode 100644 hw/virtio-serial-bus.c
 create mode 100644 hw/virtio-serial.h
author
#1 lore raw

PATCH v9 1/3 qdev: add string property.

From: Gerd Hoffmann <[email protected]>

---
 hw/qdev-properties.c |   28 ++++++++++++++++++++++++++++
 hw/qdev.h            |    4 ++++
 2 files changed, 32 insertions(+), 0 deletions(-)
hw/qdev-properties.c +28 -0
index 5c627fa..8ca345a 100644
@@ -193,6 +193,34 @@ PropertyInfo qdev_prop_hex64 = {
     .print = print_hex64,
 };
 
+/* --- string --- */
+
+static int parse_string(DeviceState *dev, Property *prop, const char *str)
+{
+    char **ptr = qdev_get_prop_ptr(dev, prop);
+
+    if (*ptr)
+        qemu_free(*ptr);
+    *ptr = qemu_strdup(str);
+    return 0;
+}
+
+static int print_string(DeviceState *dev, Property *prop, char *dest, size_t len)
+{
+    char **ptr = qdev_get_prop_ptr(dev, prop);
+    if (!*ptr)
+        return snprintf(dest, len, "<null>");
+    return snprintf(dest, len, "\"%s\"", *ptr);
+}
+
+PropertyInfo qdev_prop_string = {
+    .name  = "string",
+    .type  = PROP_TYPE_STRING,
+    .size  = sizeof(char*),
+    .parse = parse_string,
+    .print = print_string,
+};
+
 /* --- drive --- */
 
 static int parse_drive(DeviceState *dev, Property *prop, const char *str)
hw/qdev.h +4 -0
index 6d61b3a..b79f3e3 100644
@@ -79,6 +79,7 @@ enum PropertyType {
     PROP_TYPE_MACADDR,
     PROP_TYPE_DRIVE,
     PROP_TYPE_CHR,
+    PROP_TYPE_STRING,
     PROP_TYPE_PTR,
 };
 
@@ -186,6 +187,7 @@ extern PropertyInfo qdev_prop_int32;
 extern PropertyInfo qdev_prop_uint64;
 extern PropertyInfo qdev_prop_hex32;
 extern PropertyInfo qdev_prop_hex64;
+extern PropertyInfo qdev_prop_string;
 extern PropertyInfo qdev_prop_chr;
 extern PropertyInfo qdev_prop_ptr;
 extern PropertyInfo qdev_prop_macaddr;
@@ -227,6 +229,8 @@ extern PropertyInfo qdev_prop_pci_devfn;
     DEFINE_PROP(_n, _s, _f, qdev_prop_ptr, void*)
 #define DEFINE_PROP_CHR(_n, _s, _f)             \
     DEFINE_PROP(_n, _s, _f, qdev_prop_chr, CharDriverState*)
+#define DEFINE_PROP_STRING(_n, _s, _f)             \
+    DEFINE_PROP(_n, _s, _f, qdev_prop_string, char*)
 #define DEFINE_PROP_DRIVE(_n, _s, _f)             \
     DEFINE_PROP(_n, _s, _f, qdev_prop_drive, DriveInfo*)
 #define DEFINE_PROP_MACADDR(_n, _s, _f)         \
Signature · 1 line
1.6.2.5
author
#2 lore raw

PATCH v9 2/3 virtio-console: Add a virtio-serial bus, support for multiple ports

This patch migrates virtio-console to the qdev infrastructure and creates a new virtio-serial bus on which multiple ports are exposed as devices. The bulk of the code now resides in a new file with virtio-console.c being just a simple qdev device.

This interface enables spawning of multiple virtio consoles as well as generic serial ports.

The older -virtconsole argument still works, but when using the new functionality, it is recommended to use

-device virtio-serial-pci -device virtconsole,...

The virtconsole device type accepts a chardev as an argument and a 'name' argument to identify the corresponding consoles on the host as well as the guest. The name, if given, is exposed via the 'name' sysfs attribute.

Care has been taken to ensure compatibility with kernels that do not support multiple ports as well as accepting incoming migrations from older qemu versions.

---
 Makefile.target        |    2 +-
 hw/pc.c                |    9 -
 hw/ppc440_bamboo.c     |    7 -
 hw/qdev.c              |    8 +-
 hw/virtio-console.c    |  180 +++++-------
 hw/virtio-console.h    |   19 --
 hw/virtio-pci.c        |    8 +-
 hw/virtio-serial-bus.c |  764 ++++++++++++++++++++++++++++++++++++++++++++++++
 hw/virtio-serial.h     |  227 ++++++++++++++
 hw/virtio.h            |    2 +-
 qemu-options.hx        |    6 +-
 sysemu.h               |    6 -
 vl.c                   |   65 +++--
 13 files changed, 1118 insertions(+), 185 deletions(-)
 delete mode 100644 hw/virtio-console.h
 create mode 100644 hw/virtio-serial-bus.c
 create mode 100644 hw/virtio-serial.h
Makefile.target +1 -1
index 8d146c5..fd86eeb 100644
@@ -157,7 +157,7 @@ ifdef CONFIG_SOFTMMU
 obj-y = vl.o monitor.o pci.o machine.o gdbstub.o
 # virtio has to be here due to weird dependency between PCI and virtio-net.
 # need to fix this properly
-obj-y += virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o virtio-pci.o
+obj-y += virtio-blk.o virtio-balloon.o virtio-net.o virtio-serial-bus.o virtio-console.o virtio-pci.o
 obj-$(CONFIG_KVM) += kvm.o kvm-all.o
 obj-$(CONFIG_ISA_MMIO) += isa_mmio.o
 LIBS+=-lz
hw/pc.c +0 -9
index 408d6d6..3dbe718 100644
@@ -1319,15 +1319,6 @@ static void pc_init1(ram_addr_t ram_size,
             pci_create_simple(pci_bus, -1, "lsi53c895a");
         }
     }
-
-    /* Add virtio console devices */
-    if (pci_enabled) {
-        for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) {
-            if (virtcon_hds[i]) {
-                pci_create_simple(pci_bus, -1, "virtio-console-pci");
-            }
-        }
-    }
 }
 
 static void pc_init_pci(ram_addr_t ram_size,
hw/ppc440_bamboo.c +0 -7
index a488240..1ab9872 100644
@@ -108,13 +108,6 @@ static void bamboo_init(ram_addr_t ram_size,
     env = ppc440ep_init(&ram_size, &pcibus, pci_irq_nrs, 1, cpu_model);
 
     if (pcibus) {
-        /* Add virtio console devices */
-        for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) {
-            if (virtcon_hds[i]) {
-                pci_create_simple(pcibus, -1, "virtio-console-pci");
-            }
-        }
-
         /* Register network interfaces. */
         for (i = 0; i < nb_nics; i++) {
             /* There are no PCI NICs on the Bamboo board, but there are
hw/qdev.c +2 -6
index 20f931c..374d2d0 100644
@@ -321,13 +321,9 @@ void qdev_machine_creation_done(void)
 CharDriverState *qdev_init_chardev(DeviceState *dev)
 {
     static int next_serial;
-    static int next_virtconsole;
+
     /* FIXME: This is a nasty hack that needs to go away.  */
-    if (strncmp(dev->info->name, "virtio", 6) == 0) {
-        return virtcon_hds[next_virtconsole++];
-    } else {
-        return serial_hds[next_serial++];
-    }
+    return serial_hds[next_serial++];
 }
 
 BusState *qdev_get_parent_bus(DeviceState *dev)
hw/virtio-console.c +73 -107

216 lines not on this page · raw message

hw/virtio-console.h deleted +0 -19
deleted file mode 100644
index 84d0717..0000000
@@ -1,19 +0,0 @@
-/*
- * Virtio Console Support
- *
- * Copyright IBM, Corp. 2008
- *
- * Authors:
- *  Christian Ehrhardt <[email protected]>
- *
- * This work is licensed under the terms of the GNU GPL, version 2.  See
- * the COPYING file in the top-level directory.
- *
- */
-#ifndef _QEMU_VIRTIO_CONSOLE_H
-#define _QEMU_VIRTIO_CONSOLE_H
-
-/* The ID for virtio console */
-#define VIRTIO_ID_CONSOLE 3
-
-#endif
hw/virtio-pci.c +4 -4
index e07a2a7..cee15b7 100644
@@ -467,7 +467,7 @@ static int virtio_blk_exit_pci(PCIDevice *pci_dev)
     return virtio_exit_pci(pci_dev);
 }
 
-static int virtio_console_init_pci(PCIDevice *pci_dev)
+static int virtio_serial_init_pci(PCIDevice *pci_dev)
 {
     VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
     VirtIODevice *vdev;
@@ -477,7 +477,7 @@ static int virtio_console_init_pci(PCIDevice *pci_dev)
         proxy->class_code != PCI_CLASS_OTHERS)          /* qemu-kvm  */
         proxy->class_code = PCI_CLASS_COMMUNICATION_OTHER;
 
-    vdev = virtio_console_init(&pci_dev->qdev);
+    vdev = virtio_serial_init(&pci_dev->qdev);
     if (!vdev) {
         return -1;
     }
@@ -551,9 +551,9 @@ static PCIDeviceInfo virtio_info[] = {
         },
         .qdev.reset = virtio_pci_reset,
     },{
-        .qdev.name = "virtio-console-pci",
+        .qdev.name = "virtio-serial-pci",
         .qdev.size = sizeof(VirtIOPCIProxy),
-        .init      = virtio_console_init_pci,
+        .init      = virtio_serial_init_pci,
         .exit      = virtio_exit_pci,
         .qdev.props = (Property[]) {
             DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0),
hw/virtio-serial-bus.c new file +764 -0

764 lines not on this page · raw message

hw/virtio-serial.h new file +227 -0

227 lines not on this page · raw message

hw/virtio.h +1 -1
index 0f9be7d..a9601a2 100644
@@ -164,7 +164,7 @@ void virtio_bind_device(VirtIODevice *vdev, const VirtIOBindings *binding,
 /* Base devices.  */
 VirtIODevice *virtio_blk_init(DeviceState *dev, DriveInfo *dinfo);
 VirtIODevice *virtio_net_init(DeviceState *dev);
-VirtIODevice *virtio_console_init(DeviceState *dev);
+VirtIODevice *virtio_serial_init(DeviceState *dev);
 VirtIODevice *virtio_balloon_init(DeviceState *dev);
 
 #endif
qemu-options.hx +5 -1
index 20aa242..70ba2a5 100644
@@ -1635,10 +1635,14 @@ ETEXI
 
 DEF("virtioconsole", HAS_ARG, QEMU_OPTION_virtiocon, \
     "-virtioconsole c\n" \
-    "                set virtio console\n")
+    "                define virtio console\n")
 STEXI
 @item -virtioconsole @var{c}
 Set virtio console.
+
+This option is maintained for backward compatibility.
+
+Please use @code{-device virtioconsole} for the new way of invocation
 ETEXI
 
 DEF("show-cursor", 0, QEMU_OPTION_show_cursor, \
sysemu.h +0 -6
index 763861d..9129728 100644
@@ -226,12 +226,6 @@ extern CharDriverState *serial_hds[MAX_SERIAL_PORTS];
 
 extern CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
 
-/* virtio consoles */
-
-#define MAX_VIRTIO_CONSOLES 1
-
-extern CharDriverState *virtcon_hds[MAX_VIRTIO_CONSOLES];
-
 #define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR)
 
 #ifdef HAS_AUDIO
vl.c +41 -24

108 lines not on this page · raw message

Signature · 1 line
1.6.2.5
author
#3 lore raw

PATCH v9 3/3 virtio-console: Add a new virtserialport device for generic serial port support

This patch adds generic serial ports over the virtio serial bus. These ports have a few more options that are not relevant for virtio console ports: the ability to cache buffers that are received for a port while it's disconnected, setting of limits to the bytes that are cached so as to prevent OOM conditions, etc.

Sample uses for such a device can be obtaining info from the guest like the file systems used, apps installed, etc. for offline usage and logged-in users, clipboard copy-paste, etc. for online usage.

For requirements, use-cases, test cases and some history see

http://www.linux-kvm.org/page/VMchannel_Requirements

---
 hw/virtio-console.c |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)
hw/virtio-console.c +38 -0
index ef32820..fec346c 100644
@@ -107,3 +107,41 @@ static void virtcon_register(void)
     virtio_serial_port_qdev_register(&virtcon_info);
 }
 device_init(virtcon_register)
+
+
+/* Generic Virtio Serial Ports */
+static int virtserial_port_initfn(VirtIOSerialDevice *dev)
+{
+    VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, &dev->qdev);
+    VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
+
+    port->info = dev->info;
+
+    if (vcon->chr) {
+        qemu_chr_add_handlers(vcon->chr, chr_can_read, chr_read, chr_event,
+                              vcon);
+    }
+    return 0;
+}
+
+static VirtIOSerialPortInfo virtserial_port_info = {
+    .qdev.name     = "virtserialport",
+    .qdev.size     = sizeof(VirtConsole),
+    .init          = virtserial_port_initfn,
+    .have_data     = flush_buf,
+    .qdev.props = (Property[]) {
+        DEFINE_PROP_CHR("chardev", VirtConsole, chr),
+        DEFINE_PROP_STRING("name", VirtIOSerialPort, name),
+        DEFINE_PROP_INT32("cache_buffers", VirtIOSerialPort, cache_buffers, 1),
+        DEFINE_PROP_UINT64("byte_limit", VirtIOSerialPort, byte_limit, 0),
+        DEFINE_PROP_UINT64("guest_byte_limit", VirtIOSerialPort,
+                           guest_byte_limit, 0),
+        DEFINE_PROP_END_OF_LIST(),
+    },
+};
+
+static void virtserial_port_register(void)
+{
+    virtio_serial_port_qdev_register(&virtserial_port_info);
+}
+device_init(virtserial_port_register)
Signature · 1 line
1.6.2.5
#4 lore raw

Re: [Qemu-devel] [PATCH v9 3/3] virtio-console: Add a new virtserialport device for generic serial port support

hw/virtio-console.c static void virtcon_register(void) · line 134

Quoted 13 lines
hw/virtio-console.c +8 -0
@@ -107,3 +107,41 @@ static void virtcon_register(void)
      virtio_serial_port_qdev_register(&virtcon_info);
  }
  device_init(virtcon_register)
 
+static VirtIOSerialPortInfo virtserial_port_info = {
+    .qdev.name     = "virtserialport",
+    .qdev.size     = sizeof(VirtConsole),
+    .init          = virtserial_port_initfn,
+    .have_data     = flush_buf,
+    .qdev.props = (Property[]) {
+        DEFINE_PROP_CHR("chardev", VirtConsole, chr),
+        DEFINE_PROP_STRING("name", VirtIOSerialPort, name),

likewise: DEFINE_PROP_STRING("name", VirtConsole, port.name),

hw/virtio-console.c static void virtcon_register(void) · line 147

Quoted 5 lines
hw/virtio-console.c +5 -0
+static void virtserial_port_register(void)
+{
+    virtio_serial_port_qdev_register(&virtserial_port_info);
+}
+device_init(virtserial_port_register)

You can simply stick two register calls into the existing init function ...

cheers,
Gerd

author
#5 lore raw

Re: [Qemu-devel] [PATCH v9 3/3] virtio-console: Add a new virtserialport device for generic serial port support

Quoted 14 lines · Gerd Hoffmann

hw/virtio-console.c static void virtcon_register(void) · line 134

Quoted 13 lines
hw/virtio-console.c +8 -0
@@ -107,3 +107,41 @@ static void virtcon_register(void)
      virtio_serial_port_qdev_register(&virtcon_info);
  }
  device_init(virtcon_register)
 
+static VirtIOSerialPortInfo virtserial_port_info = {
+    .qdev.name     = "virtserialport",
+    .qdev.size     = sizeof(VirtConsole),
+    .init          = virtserial_port_initfn,
+    .have_data     = flush_buf,
+    .qdev.props = (Property[]) {
+        DEFINE_PROP_CHR("chardev", VirtConsole, chr),
+        DEFINE_PROP_STRING("name", VirtIOSerialPort, name),
Quoted 1 line

likewise: DEFINE_PROP_STRING("name", VirtConsole, port.name),

The 'name' field is common to all ports, so it makes sense to put it in the VirtIOSerialPort struct. (Internal users can pre-define it to their liking, eg, org.qemu.vnc)

Quoted 7 lines

hw/virtio-console.c static void virtcon_register(void) · line 147

Quoted 5 lines
hw/virtio-console.c +5 -0
+static void virtserial_port_register(void)
+{
+    virtio_serial_port_qdev_register(&virtserial_port_info);
+}
+device_init(virtserial_port_register)

You can simply stick two register calls into the existing init function ...

The console init function has extra init'ing to do, like disable buffer caching, set is_console to true, etc., so there are two init fns.

Amit

#6 lore raw

Re: [Qemu-devel] [PATCH v9 3/3] virtio-console: Add a new virtserialport device for generic serial port support

Quoted 15 lines · Amit Shah
Quoted 14 lines · Gerd Hoffmann
Quoted 13 lines
hw/virtio-console.c +8 -0
@@ -107,3 +107,41 @@ static void virtcon_register(void)
       virtio_serial_port_qdev_register(&virtcon_info);
   }
   device_init(virtcon_register)
 
+static VirtIOSerialPortInfo virtserial_port_info = {
+    .qdev.name     = "virtserialport",
+    .qdev.size     = sizeof(VirtConsole),
+    .init          = virtserial_port_initfn,
+    .have_data     = flush_buf,
+    .qdev.props = (Property[]) {
+        DEFINE_PROP_CHR("chardev", VirtConsole, chr),
+        DEFINE_PROP_STRING("name", VirtIOSerialPort, name),
Quoted 5 lines
Quoted 1 line

likewise: DEFINE_PROP_STRING("name", VirtConsole, port.name),

The 'name' field is common to all ports, so it makes sense to put it in the VirtIOSerialPort struct. (Internal users can pre-define it to their liking, eg, org.qemu.vnc)

Sure. I don't want to move it out there. But the driver state struct is 'VirtConsole' so all properties should use that. Note that the field changed too: from "name" to "port.name", so everything keeps working ;)

cheers,
Gerd

author
#7 lore raw

Re: [Qemu-devel] [PATCH v9 3/3] virtio-console: Add a new virtserialport device for generic serial port support

Quoted 18 lines · Gerd Hoffmann
Quoted 17 lines · Amit Shah
Quoted 15 lines · Gerd Hoffmann

hw/virtio-console.c static void virtcon_register(void) · line 134

Quoted 13 lines
hw/virtio-console.c +8 -0
@@ -107,3 +107,41 @@ static void virtcon_register(void)
       virtio_serial_port_qdev_register(&virtcon_info);
   }
   device_init(virtcon_register)
 
+static VirtIOSerialPortInfo virtserial_port_info = {
+    .qdev.name     = "virtserialport",
+    .qdev.size     = sizeof(VirtConsole),
+    .init          = virtserial_port_initfn,
+    .have_data     = flush_buf,
+    .qdev.props = (Property[]) {
+        DEFINE_PROP_CHR("chardev", VirtConsole, chr),
+        DEFINE_PROP_STRING("name", VirtIOSerialPort, name),

likewise: DEFINE_PROP_STRING("name", VirtConsole, port.name),

Quoted 7 lines
Quoted 3 lines

The 'name' field is common to all ports, so it makes sense to put it in the VirtIOSerialPort struct. (Internal users can pre-define it to their liking, eg, org.qemu.vnc)

Sure. I don't want to move it out there. But the driver state struct is 'VirtConsole' so all properties should use that. Note that the field changed too: from "name" to "port.name", so everything keeps working ;)

Ah; I understand it now. Sorry for the confusion.

Thanks Gerd for the reviews.

Amit

#8 lore raw

Re: [Qemu-devel] [PATCH v9 2/3] virtio-console: Add a virtio-serial bus, support for multiple ports

In reply to Amit Shah

hw/virtio-console.c line 100

Quoted 8 lines
hw/virtio-console.c +8 -0
+static VirtIOSerialPortInfo virtcon_info = {
+    .qdev.name     = "virtconsole",
+    .qdev.size     = sizeof(VirtConsole),
+    .init          = vcon_initfn,
+    .have_data     = flush_buf,
+    .qdev.props = (Property[]) {
+        DEFINE_PROP_CHR("chardev", VirtConsole, chr),
+        DEFINE_PROP_STRING("name", VirtIOSerialPort, name),

DEFINE_PROP_STRING("name", VirtConsole, port.name)

cheers,
Gerd

#9 lore raw

Re: [Qemu-devel] [PATCH v9 2/3] virtio-console: Add a virtio-serial bus, support for multiple ports

In reply to Amit Shah

qemu-options.hx ETEXI · line 1638

Quoted 4 lines · Amit Shah
 DEF("virtioconsole", HAS_ARG, QEMU_OPTION_virtiocon, \
     "-virtioconsole c\n" \
qemu-options.hx +1 -1
-    "                set virtio console\n")
+    "                define virtio console\n")

It would be much better to add a detectable string here so we (libguestfs) can tell if multiport is supported. Something like:

" set virtio console (multiport)\n"

qemu-options.hx ETEXI · line 1645

Quoted 7 lines

STEXI
@item -virtioconsole @var{c}
Set virtio console.

qemu-options.hx +4 -0
+
+This option is maintained for backward compatibility.
+
+Please use @code{-device virtioconsole} for the new way of invocation

I think you mean -device virtconsole here.

Rich.

Signature · 4 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
author
#10 lore raw

Re: [Qemu-devel] [PATCH v9 2/3] virtio-console: Add a virtio-serial bus, support for multiple ports

Quoted 10 lines · Richard W.M. Jones

qemu-options.hx ETEXI · line 1638

Quoted 4 lines · Amit Shah
 DEF("virtioconsole", HAS_ARG, QEMU_OPTION_virtiocon, \
     "-virtioconsole c\n" \
qemu-options.hx +1 -1
-    "                set virtio console\n")
+    "                define virtio console\n")

It would be much better to add a detectable string here so we (libguestfs) can tell if multiport is supported. Something like:

" set virtio console (multiport)\n"

How about (deprecated)? (We need to have this in some general policy of deprecating command-line options.)

Quoted 9 lines

qemu-options.hx ETEXI · line 1645

Quoted 7 lines

STEXI
@item -virtioconsole @var{c}
Set virtio console.

qemu-options.hx +4 -0
+
+This option is maintained for backward compatibility.
+
+Please use @code{-device virtioconsole} for the new way of invocation

I think you mean -device virtconsole here.

Yeah; thanks. Will fix.

Amit

#11 lore raw

Re: [Qemu-devel] [PATCH v9 2/3] virtio-console: Add a virtio-serial bus, support for multiple ports

Quoted 2 lines · Amit Shah

How about (deprecated)? (We need to have this in some general policy of deprecating command-line options.)

No, the important thing is that we can detect somehow that multiport virtio console is possible for some random version of qemu that we have to work with.

The only feasible way we've been able to discover is to poke qemu with various arguments (usually, "qemu -help") and then match on substrings in the output.

If there's a better way to do this, please let me know.

But for now, having "(multiport)" there allows us to detect that multiport virtio console is supported.

Quoted 3 lines
Quoted 1 line

I think you mean -device virtconsole here.

Yeah; thanks. Will fix.

So is this documentation correct or not?

http://www.linux-kvm.org/page/VMchannel_Requirements#Invocation

Rich.

Signature · 4 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
author
#12 lore raw

Re: [Qemu-devel] [PATCH v9 2/3] virtio-console: Add a virtio-serial bus, support for multiple ports

Quoted 11 lines · Richard W.M. Jones
Quoted 2 lines · Amit Shah

How about (deprecated)? (We need to have this in some general policy of deprecating command-line options.)

No, the important thing is that we can detect somehow that multiport virtio console is possible for some random version of qemu that we have to work with.

The only feasible way we've been able to discover is to poke qemu with various arguments (usually, "qemu -help") and then match on substrings in the output.

Hm, probing with -device '?' will get you the new devices:

-device virtio-serial-pci and -device virtserialport are two new devices added (along with -device virtconsole).

Quoted 1 line

If there's a better way to do this, please let me know.

I'm not sure of that, but there should be.

Quoted 2 lines

But for now, having "(multiport)" there allows us to detect that multiport virtio console is supported.

But suggesting -virtioconsole supports multiport is misleading and further usage of -virtioconsole is not to be encouraged as well..

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

I think you mean -device virtconsole here.

Yeah; thanks. Will fix.

So is this documentation correct or not?

http://www.linux-kvm.org/page/VMchannel_Requirements#Invocation

Yes, that's updated very recently and is according to what we have now.

Amit

#13 lore raw
In reply to Amit Shah

Hi,

Quoted 3 lines

This patch series fixes a few problems since the last send, mainly in the save/restore code and a few bugs shown by the automated test suite (located in a separate git repo, link below).

A bit hard to review in this form, especially the virtio-console.c changes, because you put everything upside down in that file. Hard to do better though given the massive code reorganization ...

So I applied the bits and looked at the resulting tree instead. Looks good overall, just a few minor nits, check the replies to the individual patches. I think we are ready to go as soon as the linux kernel side is on the way to mainline.

cheers,
Gerd

author
#14 lore raw
Quoted 9 lines · Gerd Hoffmann

Hi,

Quoted 3 lines

This patch series fixes a few problems since the last send, mainly in the save/restore code and a few bugs shown by the automated test suite (located in a separate git repo, link below).

A bit hard to review in this form, especially the virtio-console.c changes, because you put everything upside down in that file. Hard to do better though given the massive code reorganization ...

Top-down is the usual way of writing code, isn't it (avoids fwd declarations too).

Also, I've arranged the code according to some grouping: functions useful to outside users first, then functions using some outside facilities, and then intialisation functions.

Quoted 4 lines

So I applied the bits and looked at the resulting tree instead. Looks good overall, just a few minor nits, check the replies to the individual patches. I think we are ready to go as soon as the linux kernel side is on the way to mainline.

Yeah; waiting for Rusty's comments.

Amit

#15 lore raw
In reply to Amit Shah
Quoted 10 lines · Amit Shah

Hello,

This patch series fixes a few problems since the last send, mainly in the save/restore code and a few bugs shown by the automated test suite (located in a separate git repo, link below).

The automated test suite and a standalone interactive test program are located at

http://fedorapeople.org/gitweb?p=amitshah/public_git/test-virtserial.git

Why not keep it in-tree? Out of tree it will soon break, especially for new releases and it'll be harder for autotest to pick it up.

Quoted 2 lines

These patches are based on top of the char patches I've sent

author
#16 lore raw
Quoted 7 lines · Dor Laor
Quoted 6 lines · Amit Shah

Hello,

This patch series fixes a few problems since the last send, mainly in the save/restore code and a few bugs shown by the automated test suite (located in a separate git repo, link below).

Quoted 7 lines
Quoted 4 lines

The automated test suite and a standalone interactive test program are located at

http://fedorapeople.org/gitweb?p=amitshah/public_git/test-virtserial.git

Why not keep it in-tree? Out of tree it will soon break, especially for new releases and it'll be harder for autotest to pick it up.

The code is best integrated within autotest and I'm talking with Lucas for integrating it.

BTW if a test breaks, it's generally not a good sign :-)

Amit