Skip to contentSkip to conversation

virtio_console: Add support for multiple console ports and generic serial ports

PATCH Superseded Amit Shah 1 participant 3 messages Oct 12, 2009

Subsystems (3)

v8 of 10 Superseded Latest is v10 →

lore
Share & tools
lore

Amit Shah

author
#0 lore raw

v8 cover virtio_console: Add support for multiple console ports and generic serial ports

Hello all,

Here is a new iteration of the patch series that implements a transport for guest and host communications.

I've tested for compatibility (old qemu & new kernel, new qemu & old kernel, new qemu & new kernel) and it all works fine. To maintain backward compatibility, the first port to be spawned (port at id 0) is to be a console port, to be bound to hvc. This keeps new host, old guest happy.

Christian has tested the console functionality on s390.

Please review and apply,
Amit

Amit Shah (1):
virtio_console: Add support for multiple ports for generic guest and
host communication

 drivers/char/Kconfig           |    6 +
 drivers/char/virtio_console.c  | 1290 +++++++++++++++++++++++++++++++++++-----
 include/linux/virtio_console.h |   50 ++-
 3 files changed, 1210 insertions(+), 136 deletions(-)
author
#1 lore raw

PATCH v8 1/1 virtio_console: Add support for multiple ports for generic guest and host communication

Expose multiple char devices ("ports") for simple communication between the host userspace and guest.

Sample offline usages can be: poking around in a guest to find out the file systems used, applications installed, etc. Online usages can be sharing of clipboard data between the guest and the host, sending information about logged-in users to the host, locking the screen or session when a vnc session is closed, and so on.

This patch also enables spawning of multiple console ports that can be attached to hvc consoles.

The interface presented to guest userspace is of a simple char device, so it can be used like this:

    fd = open("/dev/vcon2", O_RDWR);
    ret = read(fd, buf, 100);
    ret = write(fd, string, strlen(string));

A name property, if set by the host, is exposed in

/sys/class/virtio-console/vconNN/name

that can be used to create symlinks by udev scripts, example:

    /dev/vcon/org.libvirt.channel.0  -> /dev/vcon1

For requirements, use-cases and some history see

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

---
 drivers/char/Kconfig           |    6 +
 drivers/char/virtio_console.c  | 1290 +++++++++++++++++++++++++++++++++++-----
 include/linux/virtio_console.h |   50 ++-
 3 files changed, 1210 insertions(+), 136 deletions(-)
drivers/char/Kconfig +6 -0
index 08a6f50..fc8a04e 100644
@@ -679,6 +679,12 @@ config VIRTIO_CONSOLE
 	help
 	  Virtio console for use with lguest and other hypervisors.
 
+	  Also serves as a general-purpose serial device for data
+	  transfer between the guest and host. Character devices at
+	  /dev/vconNN will be created when corresponding ports are
+	  found. If specified by the host, a sysfs attribute called
+	  'name' will be populated with a name for the port which can
+	  be used by udev scripts to create a symlink to /dev/vconNN.
 
 config HVCS
 	tristate "IBM Hypervisor Virtual Console Server support"
drivers/char/virtio_console.c +1156 -134

1,399 lines not on this page · raw message

include/linux/virtio_console.h +48 -2

68 lines not on this page · raw message

Signature · 1 line
1.6.2.5
author
#2 lore raw

PATCH v8 1/1 virtio_console: Add support for multiple ports for generic guest and host communication

In reply to Amit Shah

Expose multiple char devices ("ports") for simple communication between the host userspace and guest.

Sample offline usages can be: poking around in a guest to find out the file systems used, applications installed, etc. Online usages can be sharing of clipboard data between the guest and the host, sending information about logged-in users to the host, locking the screen or session when a vnc session is closed, and so on.

This patch also enables spawning of multiple console ports that can be attached to hvc consoles.

The interface presented to guest userspace is of a simple char device, so it can be used like this:

    fd = open("/dev/vcon2", O_RDWR);
    ret = read(fd, buf, 100);
    ret = write(fd, string, strlen(string));

A name property, if set by the host, is exposed in

/sys/class/virtio-console/vconNN/name

that can be used to create symlinks by udev scripts, example:

    /dev/vcon/org.libvirt.channel.0  -> /dev/vcon1

For requirements, use-cases and some history see

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

---
 drivers/char/Kconfig           |    6 +
 drivers/char/virtio_console.c  | 1290 +++++++++++++++++++++++++++++++++++-----
 include/linux/virtio_console.h |   50 ++-
 3 files changed, 1210 insertions(+), 136 deletions(-)
drivers/char/Kconfig +6 -0
index 08a6f50..fc8a04e 100644
@@ -679,6 +679,12 @@ config VIRTIO_CONSOLE
 	help
 	  Virtio console for use with lguest and other hypervisors.
 
+	  Also serves as a general-purpose serial device for data
+	  transfer between the guest and host. Character devices at
+	  /dev/vconNN will be created when corresponding ports are
+	  found. If specified by the host, a sysfs attribute called
+	  'name' will be populated with a name for the port which can
+	  be used by udev scripts to create a symlink to /dev/vconNN.
 
 config HVCS
 	tristate "IBM Hypervisor Virtual Console Server support"
drivers/char/virtio_console.c +1156 -134

1,399 lines not on this page · raw message

include/linux/virtio_console.h +48 -2

68 lines not on this page · raw message

Signature · 1 line
1.6.2.5