From 055b889f942b063bd1901a316b34017f2b699b12 Mon Sep 17 00:00:00 2001 From: Amit Shah Date: Tue, 27 Apr 2010 18:03:59 +0530 Subject: virtio-serial: Use control messages to notify guest of new ports Allow the port 'id's to be set by a user on the command line. This is needed by management apps that will want a stable port numbering scheme for hot-plug/unplug and migration. Since the port numbers are shared with the guest (to identify ports in control messages), we just send a control message to the guest indicating addition of new ports (hot-plug) or notifying the guest of the available ports when the guest sends us a DEVICE_READY control message. Signed-off-by: Amit Shah Signed-off-by: Anthony Liguori --- hw/virtio-serial.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'hw/virtio-serial.h') diff --git a/hw/virtio-serial.h b/hw/virtio-serial.h index f297b00689..0548689b99 100644 --- a/hw/virtio-serial.h +++ b/hw/virtio-serial.h @@ -27,6 +27,8 @@ /* Features supported */ #define VIRTIO_CONSOLE_F_MULTIPORT 1 +#define VIRTIO_CONSOLE_BAD_ID (~(uint32_t)0) + struct virtio_console_config { /* * These two fields are used by VIRTIO_CONSOLE_F_SIZE which @@ -36,7 +38,6 @@ struct virtio_console_config { uint16_t rows; uint32_t max_nr_ports; - uint32_t nr_ports; } __attribute__((packed)); struct virtio_console_control { @@ -46,12 +47,14 @@ struct virtio_console_control { }; /* Some events for the internal messages (control packets) */ -#define VIRTIO_CONSOLE_PORT_READY 0 -#define VIRTIO_CONSOLE_CONSOLE_PORT 1 -#define VIRTIO_CONSOLE_RESIZE 2 -#define VIRTIO_CONSOLE_PORT_OPEN 3 -#define VIRTIO_CONSOLE_PORT_NAME 4 -#define VIRTIO_CONSOLE_PORT_REMOVE 5 +#define VIRTIO_CONSOLE_DEVICE_READY 0 +#define VIRTIO_CONSOLE_PORT_ADD 1 +#define VIRTIO_CONSOLE_PORT_REMOVE 2 +#define VIRTIO_CONSOLE_PORT_READY 3 +#define VIRTIO_CONSOLE_CONSOLE_PORT 4 +#define VIRTIO_CONSOLE_RESIZE 5 +#define VIRTIO_CONSOLE_PORT_OPEN 6 +#define VIRTIO_CONSOLE_PORT_NAME 7 /* == In-qemu interface == */ -- cgit v1.2.1