From patchwork Fri Oct 24 09:00:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 402781 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D26B0140088 for ; Fri, 24 Oct 2014 20:01:43 +1100 (AEDT) Received: from localhost ([::1]:46032 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xhakf-0002a2-Qd for incoming@patchwork.ozlabs.org; Fri, 24 Oct 2014 05:01:41 -0400 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=xw1EBXokU/68KZGbXx5df0Sl+ngtLbwfxt5gK92n7hg=; b=1D2/05GfV7svhm/uzIErTqEVUQvH2yYb7vfaZcwLOToQtJEiPsHHH0Ebd2nVNPzIYY I02xWgYiW5LgIKWfZKvwqsprjQboRICwc3aFy0H7rhPf/evJZ/4NesjeKxjoEszvXTYD JmEtCgeJH1vgwkyDNnxSI0LE0DhwAo7iEb25wxOPPg1iAtikBzAQ2fEcoDWITF54mETF pGflG/XuC2zusbJ2xcY7lazmjrk3yL3uNbd437FRhPF6Xm4y83jM7d7kB67Paof5Vl5K gKl2v5VB5XgHS/qdxmI5fSCqSCvLnFXHvsL+B5n4vNB2Vye9GQJm2ncgjHS2CBM7erSO w+xw== X-Received: by 10.152.27.67 with SMTP id r3mr2953096lag.19.1414141260747; Fri, 24 Oct 2014 02:01:00 -0700 (PDT) Received: from localhost (nat-pool-cdg-t.redhat.com. [209.132.186.20]) by mx.google.com with ESMTPSA id w8sm1640164lbp.46.2014.10.24.02.00.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Oct 2014 02:00:59 -0700 (PDT) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Fri, 24 Oct 2014 11:00:53 +0200 Message-Id: <1414141254-31960-1-git-send-email-marcandre.lureau@gmail.com> X-Mailer: git-send-email 1.9.3 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::232 Cc: amit.shah@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Subject: [Qemu-devel] [PATCH 1/2] virtio-console: notify chardev when writable X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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; }