qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/2] virtio-console: notify chardev when writable
@ 2014-10-24  9:00 Marc-André Lureau
  0 siblings, 0 replies; 4+ messages in thread
From: Marc-André Lureau @ 2014-10-24  9:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: amit.shah, Marc-André Lureau, kraxel

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>
---

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PATCH 1/2] virtio-console: notify chardev when writable
@ 2015-05-05 14:58 Marc-André Lureau
  2015-05-05 14:58 ` [Qemu-devel] [PATCH 2/2] spice-char: notify the server when chardev is writable Marc-André Lureau
  2015-05-06  7:38 ` [Qemu-devel] [PATCH 1/2] virtio-console: notify chardev when writable Gerd Hoffmann
  0 siblings, 2 replies; 4+ messages in thread
From: Marc-André Lureau @ 2015-05-05 14:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau, kraxel

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>
---
 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;
 }
 
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PATCH 2/2] spice-char: notify the server when chardev is writable
  2015-05-05 14:58 [Qemu-devel] [PATCH 1/2] virtio-console: notify chardev when writable Marc-André Lureau
@ 2015-05-05 14:58 ` Marc-André Lureau
  2015-05-06  7:38 ` [Qemu-devel] [PATCH 1/2] virtio-console: notify chardev when writable Gerd Hoffmann
  1 sibling, 0 replies; 4+ messages in thread
From: Marc-André Lureau @ 2015-05-05 14:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau, kraxel

The spice server is polling on write, unless
SPICE_CHAR_DEVICE_NOTIFY_WRITABLE flag is set. In this case, qemu must
call spice_server_char_device_wakeup() when the frontend is writable.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
---
 spice-qemu-char.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/spice-qemu-char.c b/spice-qemu-char.c
index a4f4e57..0f8903e 100644
--- a/spice-qemu-char.c
+++ b/spice-qemu-char.c
@@ -110,6 +110,9 @@ static SpiceCharDeviceInterface vmc_interface = {
 #if SPICE_SERVER_VERSION >= 0x000c02
     .event              = vmc_event,
 #endif
+#if SPICE_SERVER_VERSION >= 0x000c06
+    .flags              = SPICE_CHAR_DEVICE_NOTIFY_WRITABLE,
+#endif
 };
 
 
@@ -260,6 +263,13 @@ static void print_allowed_subtypes(void)
     fprintf(stderr, "\n");
 }
 
+static void spice_chr_accept_input(struct CharDriverState *chr)
+{
+    SpiceCharDriver *s = chr->opaque;
+
+    spice_server_char_device_wakeup(&s->sin);
+}
+
 static CharDriverState *chr_open(const char *subtype,
     void (*set_fe_open)(struct CharDriverState *, int))
 
@@ -279,6 +289,7 @@ static CharDriverState *chr_open(const char *subtype,
     chr->chr_set_fe_open = set_fe_open;
     chr->explicit_be_open = true;
     chr->chr_fe_event = spice_chr_fe_event;
+    chr->chr_accept_input = spice_chr_accept_input;
 
     QLIST_INSERT_HEAD(&spice_chars, s, next);
 
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] virtio-console: notify chardev when writable
  2015-05-05 14:58 [Qemu-devel] [PATCH 1/2] virtio-console: notify chardev when writable Marc-André Lureau
  2015-05-05 14:58 ` [Qemu-devel] [PATCH 2/2] spice-char: notify the server when chardev is writable Marc-André Lureau
@ 2015-05-06  7:38 ` Gerd Hoffmann
  1 sibling, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2015-05-06  7:38 UTC (permalink / raw)
  To: Marc-André Lureau; +Cc: qemu-devel

On Di, 2015-05-05 at 16:58 +0200, Marc-André Lureau wrote:
> When the virtio serial is writable, notify the chardev backend
> with qemu_chr_accept_input().

added both patches to spice patch queue.

thanks,
  Gerd

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-06  7:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-05 14:58 [Qemu-devel] [PATCH 1/2] virtio-console: notify chardev when writable Marc-André Lureau
2015-05-05 14:58 ` [Qemu-devel] [PATCH 2/2] spice-char: notify the server when chardev is writable Marc-André Lureau
2015-05-06  7:38 ` [Qemu-devel] [PATCH 1/2] virtio-console: notify chardev when writable Gerd Hoffmann
  -- strict thread matches above, loose matches on Subject: below --
2014-10-24  9:00 Marc-André Lureau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).