Received: from eggs.gnu.org ([2001:4830:134:3::10]:46722) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XhakB-0001sg-RI for qemu-devel@nongnu.org; Fri, 24 Oct 2014 05:01:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xhak2-0003Jm-Fs for qemu-devel@nongnu.org; Fri, 24 Oct 2014 05:01:11 -0400 Received: from mail-la0-x232.google.com ([2a00:1450:4010:c03::232]:62450) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xhak2-0003JX-9J for qemu-devel@nongnu.org; Fri, 24 Oct 2014 05:01:02 -0400 Received: by mail-la0-f50.google.com with SMTP id s18so2241140lam.23 for ; Fri, 24 Oct 2014 02:01:00 -0700 (PDT) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 24 Oct 2014 11:00:53 +0200 Message-Id: <1414141254-31960-1-git-send-email-marcandre.lureau@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH 1/2] virtio-console: notify chardev when writable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: amit.shah@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com When the virtio serial is writable, notify the chardev backend with qemu_chr_accept_input(). Signed-off-by: Marc-André Lureau --- Note: This patch depends on Amit Shah patch: "virtio: serial: expose a 'guest_writable' callback for users" hw/char/virtio-console.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c index 752ed2c..2a867cb 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; } -- 1.9.3