spice: add chardev
PATCH 1/1 spice: add chardev
Adding a chardev backend for spice, for usage by spice vdagent in conjunction with a properly named virtio-serial device.
--- Makefile.objs | 2 +- qemu-char.c | 7 ++ qemu-config.c | 9 ++ qemu-options.hx | 18 ++++- spice-qemu-char.c | 222 +++++++++++++++++++++++++++++++++++++++++++++++++++++ spice-qemu-char.h | 9 ++ 6 files changed, 265 insertions(+), 2 deletions(-) create mode 100644 spice-qemu-char.c create mode 100644 spice-qemu-char.h
Makefile.objs +1 -1
@@ -102,7 +102,7 @@ common-obj-$(CONFIG_BRLAPI) += baum.o common-obj-$(CONFIG_POSIX) += migration-exec.o migration-unix.o migration-fd.o common-obj-$(CONFIG_WIN32) += version.o -common-obj-$(CONFIG_SPICE) += ui/spice-core.o ui/spice-input.o ui/spice-display.o +common-obj-$(CONFIG_SPICE) += ui/spice-core.o ui/spice-input.o ui/spice-display.o spice-qemu-char.o audio-obj-y = audio.o noaudio.o wavaudio.o mixeng.o audio-obj-$(CONFIG_SDL) += sdlaudio.o
qemu-char.c +7 -0
@@ -98,6 +98,10 @@#include "qemu_socket.h" +#ifdef CONFIG_SPICE +#include "spice-qemu-char.h" +#endif +#define READ_BUF_LEN 4096/***********************************************************/
@@ -2495,6 +2499,9 @@ static const struct { || defined(__FreeBSD_kernel__) { .name = "parport", .open = qemu_chr_open_pp }, #endif +#ifdef CONFIG_SPICE + { .name = "spicevmc", .open = qemu_chr_open_spice }, +#endif }; CharDriverState *qemu_chr_open_opts(QemuOpts *opts,
qemu-config.c +9 -0
@@ -147,6 +147,15 @@ static QemuOptsList qemu_chardev_opts = { .name = "signal", .type = QEMU_OPT_BOOL, }, +#ifdef CONFIG_SPICE + { + .name = "name", + .type = QEMU_OPT_STRING, + },{ + .name = "debug", + .type = QEMU_OPT_NUMBER, + }, +#endif {/* end of list */ } }, };
qemu-options.hx +17 -1
@@ -1357,6 +1357,9 @@ DEF("chardev", HAS_ARG, QEMU_OPTION_chardev, #if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) "-chardev parport,id=id,path=path[,mux=on|off]\n" #endif +#if defined(CONFIG_SPICE) + "-chardev spicevmc,id=id,debug=debug,name=name\n" +#endif , QEMU_ARCH_ALL )
@@ -1381,7 +1384,10 @@ Backend is one of: @option{stdio}, @option{braille}, @option{tty}, -@option{parport}. +@option{parport} +#if defined(CONFIG_SPICE) +@option{spicevmc}. +#endif The specific backend will determine the applicable options. All devices must have an id, which can be any string up to 127 characters long.
@@ -1557,6 +1563,16 @@ Connect to a local parallel port. @option{path} specifies the path to the parallel port device. @option{path} is required. +#if defined(CONFIG_SPICE) +@item -chardev spicevmc ,id=@var{id} ,debug=@var{debug}, name=@var{name} + +@option{debug} debug level for spicevmc + +@option{name} name of spice channel to connect to + +Connect to a spice virtual machine channel, such as vdiport. +#endif + @end table ETEXI
spice-qemu-char.c new file +222 -0
222 lines not on this page · raw message
spice-qemu-char.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef __SPICE_QEMU_CHAR_H__ +#define __SPICE_QEMU_CHAR_H__ + +#include "qemu-char.h" + +CharDriverState *qemu_chr_open_spice (QemuOpts *opts); + +#endif // __SPICE_QEMU_CHAR_H__ +
Signature · 1 line
1.7.3.3
Quoted 2 lines · Alon Levy
Adding a chardev backend for spice, for usage by spice vdagent in conjunction with a properly named virtio-serial device.
Usage example would be nice here.
qemu-char.c line 103
Quoted 3 lines
qemu-char.c +3
-0+#ifdef CONFIG_SPICE +#include "spice-qemu-char.h" +#endif
#ifdef can be dropped.
qemu-config.c static QemuOptsList qemu_chardev_opts = { · line 158
Quoted 9 lines
qemu-config.c +9
-0+#ifdef CONFIG_SPICE + { + .name = "name", + .type = QEMU_OPT_STRING, + },{ + .name = "debug", + .type = QEMU_OPT_NUMBER, + }, +#endif
This too.
qemu-options.hx Backend is one of: · line 1390
Quoted 9 lines
qemu-options.hx +4
-1@@ -1381,7 +1384,10 @@ Backend is one of: @option{stdio}, @option{braille}, @option{tty}, -@option{parport}. +@option{parport} +#if defined(CONFIG_SPICE) +@option{spicevmc}. +#endif
This too, documentation should be there unconditionally.
spice-qemu-char.c line 10
Quoted 1 line
spice-qemu-char.c new file +1
-0+//#define SPICE_QEMU_CHAR_USE_IOCTL
Why is this disabled?
Does it depend on the chardev patches from Amit?
Quoted 6 lines
spice-qemu-char.h new file +0
-0
spice-qemu-char.h line 9
Quoted 9 lines
spice-qemu-char.h new file +9
-0@@ -0,0 +1,9 @@ +#ifndef __SPICE_QEMU_CHAR_H__ +#define __SPICE_QEMU_CHAR_H__ + +#include "qemu-char.h" + +CharDriverState *qemu_chr_open_spice (QemuOpts *opts); + +#endif // __SPICE_QEMU_CHAR_H__ +
Hmm, maybe add this to ui/qemu-spice.h instead, so we don't clutter the tree with lots of tiny includes?
cheers,
Gerd
Quoted 4 lines · Gerd Hoffmann
Quoted 2 lines · Alon Levy
Adding a chardev backend for spice, for usage by spice vdagent in conjunction with a properly named virtio-serial device.
Quoted 8 lines
Usage example would be nice here.
qemu-char.c line 103
Quoted 3 lines
qemu-char.c +3
-0+#ifdef CONFIG_SPICE +#include "spice-qemu-char.h" +#endif #ifdef can be dropped.
ok.
Quoted 11 lines
qemu-config.c static QemuOptsList qemu_chardev_opts = { · line 158
Quoted 9 lines
qemu-config.c +9
-0+#ifdef CONFIG_SPICE + { + .name = "name", + .type = QEMU_OPT_STRING, + },{ + .name = "debug", + .type = QEMU_OPT_NUMBER, + }, +#endifThis too.
ok.
Quoted 13 lines
qemu-options.hx Backend is one of: · line 1390
Quoted 10 lines
qemu-options.hx +4
-1@@ -1381,7 +1384,10 @@ Backend is one of: @option{stdio}, @option{braille}, @option{tty}, -@option{parport}. +@option{parport} +#if defined(CONFIG_SPICE) +@option{spicevmc}. +#endifThis too, documentation should be there unconditionally.
ok.
Quoted 5 lines
spice-qemu-char.c line 10
Quoted 1 line
spice-qemu-char.c new file +1
-0+//#define SPICE_QEMU_CHAR_USE_IOCTL Why is this disabled?
Does it depend on the chardev patches from Amit?
There was a long discussion that concluded we don't want IOCTL's at all, and that there should be some other mechanism for connection state communication between the two sides. Meanwhile I found out I don't need these (I don't remember exactly what I used instead, but basically just the regular results of write/read).
Quoted 10 lines
Quoted 10 lines
spice-qemu-char.h new file +4
-0@@ -0,0 +1,9 @@ +#ifndef __SPICE_QEMU_CHAR_H__ +#define __SPICE_QEMU_CHAR_H__ + +#include "qemu-char.h"
Quoted 8 lines
spice-qemu-char.h line 9
Quoted 5 lines
spice-qemu-char.h new file +5
-0+ +CharDriverState *qemu_chr_open_spice (QemuOpts *opts); + +#endif // __SPICE_QEMU_CHAR_H__ +Hmm, maybe add this to
ui/qemu-spice.hinstead, so we don't clutter the tree with lots of tiny includes?
ok.
Quoted 3 lines
cheers,
Gerd
Hi,
Quoted 11 lines
Quoted 5 lines
Quoted 1 line
+//#define
SPICE_QEMU_CHAR_USE_IOCTLWhy is this disabled?
Does it depend on the chardev patches from Amit?There was a long discussion that concluded we don't want IOCTL's at all, and that there should be some other mechanism for connection state communication between the two sides. Meanwhile I found out I don't need these (I don't remember exactly what I used instead, but basically just the regular results of write/read).
Ok, so when it is obsolete now it can be dropped altogether I guess?
cheers,
Gerd
Quoted 8 lines · Gerd Hoffmann
Hi,
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
+//#define
SPICE_QEMU_CHAR_USE_IOCTLWhy is this disabled?
Does it depend on the chardev patches from Amit?
Quoted 7 lines
Quoted 5 lines
There was a long discussion that concluded we don't want IOCTL's at all, and that there should be some other mechanism for connection state communication between the two sides. Meanwhile I found out I don't need these (I don't remember exactly what I used instead, but basically just the regular results of write/read).
Ok, so when it is obsolete now it can be dropped altogether I guess?
ok, I'll remove it from the patch.
Quoted 5 lines
cheers,
Gerd