summaryrefslogtreecommitdiff
path: root/hw/virtio-console.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/virtio-console.c')
-rw-r--r--hw/virtio-console.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/hw/virtio-console.c b/hw/virtio-console.c
index caea11f3a..285e994ab 100644
--- a/hw/virtio-console.c
+++ b/hw/virtio-console.c
@@ -125,11 +125,42 @@ static int virtserialport_initfn(VirtIOSerialDevice *dev)
return 0;
}
+static void virtconsole_guest_open(VirtIOSerialPort *port)
+{
+ VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
+
+ if (vcon->chr) {
+ qemu_chr_ioctl(vcon->chr, CHR_IOCTL_VIRT_SERIAL_OPEN, NULL);
+ }
+}
+
+static void virtconsole_guest_close(VirtIOSerialPort *port)
+{
+ VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
+
+ if (vcon->chr) {
+ qemu_chr_ioctl(vcon->chr, CHR_IOCTL_VIRT_SERIAL_CLOSE, NULL);
+ }
+}
+
+static void virtconsole_guest_ready(VirtIOSerialPort *port)
+{
+ VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
+
+ if (vcon->chr) {
+ qemu_chr_ioctl(vcon->chr, CHR_IOCTL_VIRT_SERIAL_READY, NULL);
+ }
+}
+
+
static VirtIOSerialPortInfo virtserialport_info = {
.qdev.name = "virtserialport",
.qdev.size = sizeof(VirtConsole),
.init = virtserialport_initfn,
.exit = virtconsole_exitfn,
+ .guest_open = virtconsole_guest_open,
+ .guest_close = virtconsole_guest_close,
+ .guest_ready = virtconsole_guest_ready,
.qdev.props = (Property[]) {
DEFINE_PROP_UINT32("nr", VirtConsole, port.id, VIRTIO_CONSOLE_BAD_ID),
DEFINE_PROP_CHR("chardev", VirtConsole, chr),