virtio-console: notify chardev when writable
PATCH 1/2 virtio-console: notify chardev when writable
When the virtio serial is writable, notify the chardev backend with qemu_chr_accept_input().
---
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(+)
hw/char/virtio-console.c +10 -0
@@ -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; }
Signature · 1 line
1.9.3
PATCH 2/2 spice-char: notify the server when chardev is writable
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.
--- spice-qemu-char.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
spice-qemu-char.c +11 -0
@@ -111,6 +111,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 };
@@ -261,6 +264,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 ))
@@ -280,6 +290,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);
Signature · 1 line
1.9.3
Re: [Qemu-devel] [PATCH 2/2] spice-char: notify the server when chardev is writable
Quoted 24 lines · Marc-André Lureau
The spice server is polling on write, unless
SPICE_CHAR_DEVICE_NOTIFY_WRITABLEflag is set. In this case, qemu must callspice_server_char_device_wakeup()when the frontend is writable.Signed-off-by Marc-André Lureau <[email protected]>--- spice-qemu-char.c | 11 +++++++++++ 1 file changed, 11 insertions(+)spice-qemu-char.c +3
-0@@ -111,6 +111,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 };
spice-qemu-char.c static void print_allowed_subtypes(void) · line 271
Quoted 8 lines
spice-qemu-char.c +5
-0@@ -261,6 +264,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);
Does this build on older spice versions? I'd suspect this needs #if SPICE_SERVER_VERSION too ...
cheers,
Gerd
Re: [Qemu-devel] [PATCH 2/2] spice-char: notify the server when chardev is writable
Hi
Quoted 8 lines · Gerd Hoffmann
spice-qemu-char.c static void print_allowed_subtypes(void) · line 271
Quoted 5 lines
spice-qemu-char.c +5
-0+static void spice_chr_accept_input (struct CharDriverState *chr) +{ +SpiceCharDriver *s = chr->opaque; + +spice_server_char_device_wakeup (&s->sin);Does this build on older spice versions? I'd suspect this needs #if
SPICE_SERVER_VERSIONtoo ...
There is already a spice_server_char_device_wakeup() call there. On older servers, this additional call will trigger just a read try. With the proposed patch in Spice server, it will do read & write try (I didn't see the need to create a new function to do only read or write, both should be fine)
Signature · 1 line
Marc-André Lureau
Re: [Qemu-devel] [PATCH 2/2] spice-char: notify the server when chardev is writable
Quoted 18 lines · Marc-André Lureau
Hi
On Mon, Oct 27, 2014 at 9:08 AM, Gerd Hoffmann <[email protected]> wrote:
> +static void spice_chr_accept_input(struct CharDriverState *chr) > +{ > + SpiceCharDriver *s = chr->opaque; > + > + spice_server_char_device_wakeup(&s->sin); Does this build on older spice versions? I'd suspect this needs #if SPICE_SERVER_VERSION too ...
Quoted 5 lines
There is already a
spice_server_char_device_wakeup()call there. On older servers, this additional call will trigger just a read try. With the proposed patch in Spice server, it will do read & write try (I didn't see the need to create a new function to do only read or write, both should be fine)
Ok then. Added to spice queue. Fails to build, but that looks like just being the dependency on amits patch and should go away once that one is upstream.
cheers,
Gerd
Re: [Qemu-devel] [PATCH 2/2] spice-char: notify the server when chardev is writable
Hi Gerd,
Quoted 25 lines · Gerd Hoffmann
Quoted 18 lines · Marc-André Lureau
Hi
On Mon, Oct 27, 2014 at 9:08 AM, Gerd Hoffmann <[email protected]> wrote:
> +static void spice_chr_accept_input(struct CharDriverState *chr) > +{ > + SpiceCharDriver *s = chr->opaque; > + > + spice_server_char_device_wakeup(&s->sin); Does this build on older spice versions? I'd suspect this needs #if SPICE_SERVER_VERSION too ...Quoted 5 lines
There is already a
spice_server_char_device_wakeup()call there. On older servers, this additional call will trigger just a read try. With the proposed patch in Spice server, it will do read & write try (I didn't see the need to create a new function to do only read or write, both should be fine)
Quoted 3 lines
Ok then. Added to spice queue. Fails to build, but that looks like just being the dependency on amits patch and should go away once that one is upstream.
The dependency patch is now in tree, please pick this series up.
Thanks,
Amit
Re: [Qemu-devel] [PATCH 2/2] spice-char: notify the server when chardev is writable
Hi,
Quoted 5 lines
Quoted 3 lines
Ok then. Added to spice queue. Fails to build, but that looks like just being the dependency on amits patch and should go away once that one is upstream.
The dependency patch is now in tree, please pick this series up.
Hmm, not in my queue any more, probably dropped at some point due to the build failure.
Can you resend please?
thanks,
Gerd
Re: [Qemu-devel] [PATCH 2/2] spice-char: notify the server when chardev is writable
In reply to Marc-André LureauHi,
Quoted 3 lines · Marc-André Lureau
The spice server is polling on write, unless
SPICE_CHAR_DEVICE_NOTIFY_WRITABLEflag is set. In this case, qemu must callspice_server_char_device_wakeup()when the frontend is writable.
Great, so there's no other change required to actually use the functionality in my patch? Does my patch fit your need fine, or do you need to tweak the notification somehow?
It would be great to get your reviewed-by to my patch in case everything's fine.
Peter has asked me to update the comments on my patch; I'll fix that up right away since this showed up.
Thanks!
Amit
Re: [Qemu-devel] [PATCH 2/2] spice-char: notify the server when chardev is writable
Quoted 5 lines · Amit Shah
Great, so there's no other change required to actually use the functionality in my patch? Does my patch fit your need fine, or do you need to tweak the notification somehow?
It seems to be working nicely.
Quoted 6 lines
It would be great to get your reviewed-by to my patch in case everything's fine.
Peter has asked me to update the comments on my patch; I'll fix that up right away since this showed up.
Sure, I'll wait for next updated patch then.
Signature · 1 line
Marc-André Lureau
Re: [Qemu-devel] [PATCH 2/2] spice-char: notify the server when chardev is writable
Quoted 10 lines · Marc-André Lureau
Quoted 5 lines · Amit Shah
Great, so there's no other change required to actually use the functionality in my patch? Does my patch fit your need fine, or do you need to tweak the notification somehow?
It seems to be working nicely.
Quoted 8 lines
Quoted 6 lines
It would be great to get your reviewed-by to my patch in case everything's fine.
Peter has asked me to update the comments on my patch; I'll fix that up right away since this showed up.
Sure, I'll wait for next updated patch then.
Thanks, just sent a v3 out.
Amit