diff options
author | Alon Levy <alevy@redhat.com> | 2010-08-24 17:35:48 +0300 |
---|---|---|
committer | Alon Levy <alevy@redhat.com> | 2010-08-24 17:37:16 +0300 |
commit | 2f51cdecd4b4e3e8f465649db33c2a34ecf9b5ee (patch) | |
tree | e6139ae1a606c3a1ba4b0645c4e6f182d6344976 | |
parent | ed4be9010b94f661295dc27de60261c4446e8955 (diff) |
virtio-serial: add reset handler using qemu_chr_ioctlspice.kvm.v14.usb_ccid.spicevmc_chardev
-rw-r--r-- | hw/virtio-console.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/hw/virtio-console.c b/hw/virtio-console.c index 285e994ab..8de70c5eb 100644 --- a/hw/virtio-console.c +++ b/hw/virtio-console.c @@ -58,6 +58,15 @@ static void chr_event(void *opaque, int event) } } +static void virtconsole_reset(void *opaque) +{ + VirtConsole *vcon = opaque; + + if (vcon->chr) { + qemu_chr_ioctl(vcon->chr, CHR_IOCTL_VIRT_SERIAL_CLOSE, NULL); + } +} + /* Virtio Console Ports */ static int virtconsole_initfn(VirtIOSerialDevice *dev) { @@ -73,6 +82,7 @@ static int virtconsole_initfn(VirtIOSerialDevice *dev) vcon); port->info->have_data = flush_buf; } + qemu_register_reset(virtconsole_reset, vcon); return 0; } @@ -122,6 +132,7 @@ static int virtserialport_initfn(VirtIOSerialDevice *dev) vcon); port->info->have_data = flush_buf; } + qemu_register_reset(virtconsole_reset, vcon); return 0; } @@ -152,7 +163,6 @@ static void virtconsole_guest_ready(VirtIOSerialPort *port) } } - static VirtIOSerialPortInfo virtserialport_info = { .qdev.name = "virtserialport", .qdev.size = sizeof(VirtConsole), |