summaryrefslogtreecommitdiff
path: root/hw/char/virtio-console.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2015-05-05 16:58:55 +0200
committerGerd Hoffmann <kraxel@redhat.com>2015-05-29 09:56:01 +0200
commit246ca55faff625f4c15e21f3424781e215a254ea (patch)
treed4001ed60c086da18757a51616ba35a84d2fa9aa /hw/char/virtio-console.c
parentce0274f730eacbd24c706523ddbbabb6b95d0659 (diff)
downloadqemu-246ca55faff625f4c15e21f3424781e215a254ea.tar.gz
virtio-console: notify chardev when writable
When the virtio serial is writable, notify the chardev backend with qemu_chr_accept_input(). Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/char/virtio-console.c')
-rw-r--r--hw/char/virtio-console.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c
index 752ed2c3c8..2a867cb4e6 100644
--- a/hw/char/virtio-console.c
+++ b/hw/char/virtio-console.c
@@ -95,6 +95,15 @@ static void set_guest_connected(VirtIOSerialPort *port, int guest_connected)
}
}
+static void guest_writable(VirtIOSerialPort *port)
+{
+ VirtConsole *vcon = VIRTIO_CONSOLE(port);
+
+ if (vcon->chr) {
+ qemu_chr_accept_input(vcon->chr);
+ }
+}
+
/* Readiness of the guest to accept data on a port */
static int chr_can_read(void *opaque)
{
@@ -188,6 +197,7 @@ static void virtserialport_class_init(ObjectClass *klass, void *data)
k->unrealize = virtconsole_unrealize;
k->have_data = flush_buf;
k->set_guest_connected = set_guest_connected;
+ k->guest_writable = guest_writable;
dc->props = virtserialport_properties;
}