virtio-serial-bus: Maintain guest and host port open/close state Via control channel messages, the guest can tell us whether a port got opened or closed. Similarly, we can also indicate to the guest of host port open/close events. Signed-off-by: Amit Shah <[email protected]> Signed-off-by: Anthony Liguori <[email protected]>
diff --git a/hw/virtio-serial.h b/hw/virtio-serial.h index fe8e357..d9c7acb 100644 --- a/hw/virtio-serial.h +++ b/hw/virtio-serial.h
@@ -49,6 +49,7 @@ #define VIRTIO_CONSOLE_PORT_READY 0 #define VIRTIO_CONSOLE_CONSOLE_PORT 1 #define VIRTIO_CONSOLE_RESIZE 2 +#define VIRTIO_CONSOLE_PORT_OPEN 3 /* == In-qemu interface == */ @@ -92,6 +93,11 @@ /* Identify if this is a port that binds with hvc in the guest */ uint8_t is_console; + + /* Is the corresponding guest device open? */ + bool guest_connected; + /* Is this device open for IO on the host? */ + bool host_connected; }; struct VirtIOSerialPortInfo {