spice patch queue
Hi,
This is the updated spice patch queue. Changes:
* rebased against latest master.
* replaced Alon's chardev patch with v5 which
addresses blue swirl's review comments.
* added one locking bugfix.
* fix bug added recently by configure cleanup.
please pull,
Gerd
Alon Levy (1):
spice: add chardev (v5)
Gerd Hoffmann (5):
add migration state change notifiers spice/vnc: client migration.
spice: MAINTAINERS update
spice/qxl: zap spice 0.4 migration compatibility bits
qxl: locking fix
Jiri Denemark (1):
configure: Fix spice probe
Marc-André Lureau (1):
vnc/spice: fix "never" and "now" expire_time
MAINTAINERS | 8 ++ Makefile.objs | 2 +- configure | 6 +- hmp-commands.hx | 17 +++++ hw/qxl.c | 81 ++++------------------- hw/qxl.h | 4 - migration.c | 28 ++++++++ migration.h | 5 ++ monitor.c | 31 ++++++++- qemu-char.c | 4 + qemu-config.c | 6 ++ qemu-options.hx | 16 ++++- qmp-commands.hx | 35 ++++++++++ spice-qemu-char.c | 190 +++++++++++++++++++++++++++++++++++++++++++++++++++++ trace-events | 6 ++ ui/qemu-spice.h | 7 ++ ui/spice-core.c | 25 +++++++ 17 files changed, 391 insertions(+), 80 deletions(-) create mode 100644 spice-qemu-char.c
The following changes since commit 0bfe006c5380c5f8a485a55ded3329fbbc224396:
multiboot: Fix upper memory size in multiboot info (2011-01-23 22:44:13 +0100)
are available in the git repository at:
git://anongit.freedesktop.org/spice/qemu spice.v29.pull
Alon Levy (1):
spice: add chardev (v5)
Gerd Hoffmann (5):
add migration state change notifiers spice/vnc: client migration.
spice: MAINTAINERS update
spice/qxl: zap spice 0.4 migration compatibility bits
qxl: locking fix
Jiri Denemark (1):
configure: Fix spice probe
Marc-André Lureau (1):
vnc/spice: fix "never" and "now" expire_time
MAINTAINERS | 8 ++ Makefile.objs | 2 +- configure | 6 +- hmp-commands.hx | 17 +++++ hw/qxl.c | 81 ++++------------------- hw/qxl.h | 4 - migration.c | 28 ++++++++ migration.h | 5 ++ monitor.c | 31 ++++++++- qemu-char.c | 4 + qemu-config.c | 6 ++ qemu-options.hx | 16 ++++- qmp-commands.hx | 35 ++++++++++ spice-qemu-char.c | 190 +++++++++++++++++++++++++++++++++++++++++++++++++++++ trace-events | 6 ++ ui/qemu-spice.h | 7 ++ ui/spice-core.c | 25 +++++++ 17 files changed, 391 insertions(+), 80 deletions(-) create mode 100644 spice-qemu-char.c
PATCH 1/8 add migration state change notifiers
This patch adds functions to register and unregister notifiers for migration state changes and a function to query the migration state. The notifier is called on every state change. Once after establishing a new migration object (which is in active state then) and once when the state changes from active to completed, canceled or error.
--- migration.c | 28 ++++++++++++++++++++++++++++ migration.h | 5 +++++ 2 files changed, 33 insertions(+), 0 deletions(-)
migration.c +28 -0
@@ -36,6 +36,9 @@ static int64_t max_throttle = (32 << 20);static MigrationState *current_migration; +static NotifierList migration_state_notifiers = +NOTIFIER_LIST_INITIALIZER (migration_state_notifiers); +int qemu_start_incoming_migration (const char *uri) {const char *p;
@@ -121,6 +124,7 @@ int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data) } current_migration = s; +notifier_list_notify (&migration_state_notifiers);return 0 ; }
@@ -272,6 +276,7 @@ void migrate_fd_error(FdMigrationState *s) {DPRINTF ("setting error state\n" ); s->state =MIG_STATE_ERROR ; +notifier_list_notify (&migration_state_notifiers);migrate_fd_cleanup (s); }
@@ -329,6 +334,7 @@ ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size)monitor_resume (s->mon); } s->state =MIG_STATE_ERROR ; +notifier_list_notify (&migration_state_notifiers); }return ret;
@@ -389,6 +395,7 @@ void migrate_fd_put_ready(void *opaque) state =MIG_STATE_ERROR ; } s->state = state; +notifier_list_notify (&migration_state_notifiers); } }
@@ -408,6 +415,7 @@ void migrate_fd_cancel(MigrationState *mig_state)DPRINTF ("cancelling migration\n" ); s->state =MIG_STATE_CANCELLED ; +notifier_list_notify (&migration_state_notifiers);qemu_savevm_state_cancel (s->mon, s->file);migrate_fd_cleanup (s);
@@ -421,6 +429,7 @@ void migrate_fd_release(MigrationState *mig_state)if (s->state ==MIG_STATE_ACTIVE ) { s->state =MIG_STATE_CANCELLED ; +notifier_list_notify (&migration_state_notifiers);migrate_fd_cleanup (s); }qemu_free (s);
@@ -452,3 +461,22 @@ int migrate_fd_close(void *opaque)qemu_set_fd_handler2 (s->fd,NULL ,NULL ,NULL ,NULL );return s->close (s); } + +void add_migration_state_change_notifier (Notifier *notify) +{ +notifier_list_add (&migration_state_notifiers, notify); +} + +void remove_migration_state_change_notifier (Notifier *notify) +{ +notifier_list_remove (&migration_state_notifiers, notify); +} + +int get_migration_state (void ) +{ +if (current_migration) { +return migrate_fd_get_status (current_migration); + }else { +return MIG_STATE_ERROR ; + } +}
migration.h +5 -0
@@ -16,6 +16,7 @@#include "qdict.h" #include "qemu-common.h" +#include "notify.h" #define MIG_STATE_ERROR -1#define MIG_STATE_COMPLETED 0
@@ -134,4 +135,8 @@ static inline FdMigrationState *migrate_to_fms(MigrationState *mig_state) return container_of(mig_state, FdMigrationState, mig_state); } +void add_migration_state_change_notifier (Notifier *notify); +void remove_migration_state_change_notifier (Notifier *notify); +int get_migration_state (void ); +#endif
Signature · 1 line
1.7.1
PATCH 2/8 spice/vnc: client migration.
In reply to Gerd HoffmannHandle spice client migration, i.e. inform a spice client connected about the new host and connection parameters, so it can move over the connection automatically.
The monitor command has a not-yet used protocol argument simliar to set_password and expire_password commands. This allows to add a simliar feature to vnc in the future. Daniel Berrange plans to work on this.
--- hmp-commands.hx | 17 +++++++++++++++++ monitor.c | 27 +++++++++++++++++++++++++++ qmp-commands.hx | 35 +++++++++++++++++++++++++++++++++++ ui/qemu-spice.h | 4 ++++ ui/spice-core.c | 25 +++++++++++++++++++++++++ 5 files changed, 108 insertions(+), 0 deletions(-)
hmp-commands.hx +17 -0
@@ -815,6 +815,23 @@ ETEXI }, STEXI +@item client_migrate_info @var{protocol} @var{hostname} @var{port} @var{tls-port} @var{cert-subject} +@findex client_migrate_info +Set the spice/vnc connection info for the migration target. The spice/vnc +server will ask the spice/vnc client to automatically reconnect using the +new parameters (if specified) once the vm migration finished successfully. +ETEXI + + { + .name = "client_migrate_info", + .args_type = "protocol:s,hostname:s,port:i?,tls-port:i?,cert-subject:s?", + .params = "protocol hostname port tls-port cert-subject", + .help = "send migration info to spice/vnc client", + .user_print = monitor_user_noop, + .mhandler.cmd_new = client_migrate_info, + }, + +STEXI @item snapshot_blkdev @findex snapshot_blkdev Snapshot device, using snapshot file as target if provided
monitor.c +27 -0
@@ -1173,6 +1173,33 @@ static int expire_password(Monitor *mon, const QDict *qdict, QObject **ret_data)return -1 ; } +static int client_migrate_info (Monitor *mon,const QDict *qdict,QObject **ret_data) +{ +const char *protocol =qdict_get_str (qdict,"protocol" ); +const char *hostname =qdict_get_str (qdict,"hostname" ); +const char *subject =qdict_get_try_str (qdict,"cert-subject" ); +int port =qdict_get_try_int (qdict,"port" ,-1 ); +int tls_port =qdict_get_try_int (qdict,"tls-port" ,-1 ); +int ret; + +if (strcmp (protocol,"spice" ) ==0 ) { +if (!using_spice) { +qerror_report (QERR_DEVICE_NOT_ACTIVE ,"spice" ); +return -1 ; + } + + ret =qemu_spice_migrate_info (hostname, port, tls_port, subject); +if (ret !=0 ) { +qerror_report (QERR_UNDEFINED_ERROR ); +return -1 ; + } +return 0 ; + } + +qerror_report (QERR_INVALID_PARAMETER ,"protocol" ); +return -1 ; +} +static int do_screen_dump (Monitor *mon,const QDict *qdict,QObject **ret_data) {vga_hw_screen_dump (qdict_get_str (qdict,"filename" ));
qmp-commands.hx +35 -0
@@ -503,6 +503,41 @@ EQMP }, SQMP +client_migrate_info +------------------ + +Set the spice/vnc connection info for the migration target. The spice/vnc +server will ask the spice/vnc client to automatically reconnect using the +new parameters (if specified) once the vm migration finished successfully. + +Arguments: + +- "protocol": protocol: "spice" or "vnc" (json-string) +- "hostname": migration target hostname (json-string) +- "port": spice/vnc tcp port for plaintext channels (json-int, optional) +- "tls-port": spice tcp port for tls-secured channels (json-int, optional) +- "cert-subject": server certificate subject (json-string, optional) + +Example: + +-> { "execute": "client_migrate_info", + "arguments": { "protocol": "spice", + "hostname": "virt42.lab.kraxel.org", + "port": 1234 } } +<- { "return": {} } + +EQMP + + { + .name = "client_migrate_info", + .args_type = "protocol:s,hostname:s,port:i?,tls-port:i?,cert-subject:s?", + .params = "protocol hostname port tls-port cert-subject", + .help = "send migration info to spice/vnc client", + .user_print = monitor_user_noop, + .mhandler.cmd_new = client_migrate_info, + }, + +SQMP migrate_set_speed -----------------
ui/qemu-spice.h +4 -0
@@ -35,6 +35,8 @@ int qemu_spice_add_interface(SpiceBaseInstance *sin);int qemu_spice_set_passwd (const char *passwd,bool fail_if_connected,bool disconnect_if_connected);int qemu_spice_set_pw_expire (time_t expires); +int qemu_spice_migrate_info (const char *hostname,int port,int tls_port, +const char *subject);void do_info_spice_print (Monitor *mon,const QObject *data);void do_info_spice (Monitor *mon,QObject **ret_data);
@@ -44,6 +46,8 @@ void do_info_spice(Monitor *mon, QObject **ret_data);#define using_spice 0#define qemu_spice_set_passwd (_p, _f1, _f2) (-1)#define qemu_spice_set_pw_expire (_e) (-1) +static inline int qemu_spice_migrate_info (const char *h,int p,int t,const char *s) +{return -1 ; }#endif /* CONFIG_SPICE */
ui/spice-core.c +25 -0
@@ -30,11 +30,15 @@#include "qbool.h" #include "qstring.h" #include "qjson.h" +#include "notify.h" +#include "migration.h" #include "monitor.h" +#include "hw/hw.h" /* core bits */ static SpiceServer *spice_server; +static Notifier migration_state;static const char *auth ="spice" ;static char *auth_passwd;static time_t auth_expires =TIME_MAX ;
@@ -416,6 +420,24 @@ void do_info_spice(Monitor *mon, QObject **ret_data) *ret_data =QOBJECT (server); } +static void migration_state_notifier (Notifier *notifier) +{ +int state =get_migration_state (); + +if (state ==MIG_STATE_COMPLETED ) { +#if SPICE_SERVER_VERSION >=0x000701 /* 0.7.1 */ +spice_server_migrate_switch (spice_server); +#endif + } +} + +int qemu_spice_migrate_info (const char *hostname,int port,int tls_port, +const char *subject) +{ +return spice_server_migrate_info (spice_server, hostname, + port, tls_port, subject); +} +static int add_channel (const char *name,const char *value,void *opaque) {int security =0 ;
@@ -573,6 +595,9 @@ void qemu_spice_init(void)spice_server_init (spice_server, &core_interface); using_spice =1 ; + migration_state.notify = migration_state_notifier; +add_migration_state_change_notifier (&migration_state); +qemu_spice_input_init ();qemu_spice_audio_init ();
Signature · 1 line
1.7.1
PATCH 3/8 spice: MAINTAINERS update
In reply to Gerd Hoffmann--- MAINTAINERS | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
MAINTAINERS +8 -0
@@ -383,6 +383,14 @@ S: Odd Fixes F: gdbstub* F: gdb-xml/ +SPICE +M: Gerd Hoffmann <[email protected]> +S: Supported +F: ui/qemu-spice.h +F: ui/spice-*.c +F: audio/spiceaudio.c +F: hw/qxl* + Graphics M: Anthony Liguori <[email protected]> S: Maintained
Signature · 1 line
1.7.1
PATCH 4/8 vnc/spice: fix "never" and "now" expire_time
In reply to Gerd HoffmannFrom: Marc-André Lureau <[email protected]>
--- monitor.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
monitor.c +2 -2
@@ -1136,9 +1136,9 @@ static int expire_password(Monitor *mon, const QDict *qdict, QObject **ret_data)time_t when;int rc; -if (strcmp (whenstr,"now" )) { +if (strcmp (whenstr,"now" ) ==0 ) { when =0 ; - }else if (strcmp (whenstr,"never" )) { + }else if (strcmp (whenstr,"never" ) ==0 ) { when =TIME_MAX ; }else if (whenstr[0 ] =='+' ) { when =time (NULL ) +strtoull (whenstr+1 ,NULL ,10 );
Signature · 1 line
1.7.1
PATCH 5/8 spice/qxl: zap spice 0.4 migration compatibility bits
In reply to Gerd HoffmannLive migration from and to spice 0.4 qxl devices isn't going to work. Rip out the bits which attempt to support that. Zap the subsection logic which is obsolete now. Bumb the version to make a clean cut. This should obviously go in before 0.14 is released.
--- hw/qxl.c | 79 ++++++++------------------------------------------------------ hw/qxl.h | 4 --- 2 files changed, 10 insertions(+), 73 deletions(-)
hw/qxl.c +10 -69
@@ -1418,43 +1418,10 @@ static int qxl_post_load(void *opaque, int version) }dprint (d,1 ,"%s: done\n" , __FUNCTION__); -/* spice 0.4 compatibility -- accept but ignore */ -qemu_free (d->worker_data); - d->worker_data =NULL ; - d->worker_data_size =0 ; -return 0 ; } -#define QXL_SAVE_VERSION 20 - -static bool qxl_test_worker_data (void *opaque,int version_id) -{ -PCIQXLDevice * d = opaque; - -if (d->revision !=1 ) { -return false; - } -if (!d->worker_data_size) { -return false; - } -if (!d->worker_data) { - d->worker_data =qemu_malloc (d->worker_data_size); - } -return true; -} - -static bool qxl_test_spice04 (void *opaque,int version_id) -{ -PCIQXLDevice * d = opaque; -return d->revision ==1 ; -} - -static bool qxl_test_spice06 (void *opaque) -{ -PCIQXLDevice * d = opaque; -return d->revision >1 ; -} +#define QXL_SAVE_VERSION 21static VMStateDescription qxl_memslot = { .name ="qxl-memslot" ,
@@ -1486,24 +1453,6 @@ static VMStateDescription qxl_surface = { } }; -static VMStateDescription qxl_vmstate_spice06 = { - .name ="qxl/spice06" , - .version_id =QXL_SAVE_VERSION , - .minimum_version_id =QXL_SAVE_VERSION , - .fields = (VMStateField []) { -VMSTATE_INT32_EQUAL (num_memslots, PCIQXLDevice), -VMSTATE_STRUCT_ARRAY (guest_slots, PCIQXLDevice,NUM_MEMSLOTS ,0 , - qxl_memslot, struct guest_slots), -VMSTATE_STRUCT (guest_primary.surface, PCIQXLDevice,0 , - qxl_surface, QXLSurfaceCreate), -VMSTATE_INT32_EQUAL (num_surfaces, PCIQXLDevice), -VMSTATE_ARRAY (guest_surfaces.cmds, PCIQXLDevice,NUM_SURFACES ,0 , - vmstate_info_uint64, uint64_t), -VMSTATE_UINT64 (guest_cursor, PCIQXLDevice), -VMSTATE_END_OF_LIST () - }, -}; -static VMStateDescription qxl_vmstate = { .name ="qxl" , .version_id =QXL_SAVE_VERSION ,
@@ -1519,25 +1468,17 @@ static VMStateDescription qxl_vmstate = {VMSTATE_UINT32 (last_release_offset, PCIQXLDevice),VMSTATE_UINT32 (mode, PCIQXLDevice),VMSTATE_UINT32 (ssd.unique, PCIQXLDevice), - -/* spice 0.4 sends/expects them */ -VMSTATE_VBUFFER_UINT32 (vga.vram_ptr, PCIQXLDevice,0 , qxl_test_spice04,0 , - vga.vram_size), -VMSTATE_UINT32_TEST (worker_data_size, PCIQXLDevice, qxl_test_spice04), -VMSTATE_VBUFFER_UINT32 (worker_data, PCIQXLDevice,0 , qxl_test_worker_data,0 , - worker_data_size), - +VMSTATE_INT32_EQUAL (num_memslots, PCIQXLDevice), +VMSTATE_STRUCT_ARRAY (guest_slots, PCIQXLDevice,NUM_MEMSLOTS ,0 , + qxl_memslot, struct guest_slots), +VMSTATE_STRUCT (guest_primary.surface, PCIQXLDevice,0 , + qxl_surface, QXLSurfaceCreate), +VMSTATE_INT32_EQUAL (num_surfaces, PCIQXLDevice), +VMSTATE_ARRAY (guest_surfaces.cmds, PCIQXLDevice,NUM_SURFACES ,0 , + vmstate_info_uint64, uint64_t), +VMSTATE_UINT64 (guest_cursor, PCIQXLDevice),VMSTATE_END_OF_LIST () }, - .subsections = (VMStateSubsection[]) { - { -/* additional spice 0.6 state */ - .vmsd = &qxl_vmstate_spice06, - .needed = qxl_test_spice06, - },{ -/* end of list */ - }, - }, }; static PCIDeviceInfo qxl_info_primary = {
hw/qxl.h +0 -4
@@ -80,10 +80,6 @@ typedef struct PCIQXLDevice {/* io bar */ uint32_t io_base; - -/* spice 0.4 loadvm compatibility */ -void *worker_data; -uint32_t worker_data_size; } PCIQXLDevice;#define PANIC_ON (x) if ((x)) { \
Signature · 1 line
1.7.1
PATCH 6/8 qxl: locking fix
In reply to Gerd HoffmannOne spice worker call lacks the unlock/relock calls, which may lead to deadlocks, add them.
--- hw/qxl.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
hw/qxl.c +2 -0
@@ -866,7 +866,9 @@ static void qxl_destroy_primary(PCIQXLDevice *d)dprint (d,1 ,"%s\n" , __FUNCTION__); d->mode =QXL_MODE_UNDEFINED ; +qemu_mutex_unlock_iothread (); d->ssd.worker->destroy_primary_surface (d->ssd.worker,0 ); +qemu_mutex_lock_iothread (); }static void qxl_set_mode (PCIQXLDevice *d,int modenr,int loadvm)
Signature · 1 line
1.7.1
PATCH 7/8 configure: Fix spice probe
In reply to Gerd HoffmannFrom: Jiri Denemark <[email protected]>
Non-existent $pkgconfig instead of $pkg_config was used when configure probes for spice availability.
--- configure | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
configure +3 -3
@@ -2207,9 +2207,9 @@ if test "$spice" != "no" ; then #include <spice.h> int main(void) { spice_server_new(); return 0; } EOF - spice_cflags=$($pkgconfig --cflags spice-protocol spice-server 2>/dev/null) - spice_libs=$($pkgconfig --libs spice-protocol spice-server 2>/dev/null) - if $pkgconfig --atleast-version=0.5.3 spice-server >/dev/null 2>&1 && \ + spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null) + spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null) + if $pkg_config --atleast-version=0.5.3 spice-server >/dev/null 2>&1 && \ compile_prog "$spice_cflags" "$spice_libs" ; then spice="yes" libs_softmmu="$libs_softmmu $spice_libs"
Signature · 1 line
1.7.1
[Qemu-devel] Re: [PATCH 7/8] configure: Fix spice probe
Quoted 18 lines · Gerd Hoffmann
From: Jiri Denemark<[email protected]>
Non-existent $pkgconfig instead of $pkg_config was used when configure probes for spice availability.
Signed-off-by Jiri Denemark<[email protected]>Signed-off-by Gerd Hoffmann<[email protected]>--- configure | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)configure +0
-0@@ -2207,9 +2207,9 @@ if test "$spice" != "no" ; then #include<spice.h> int main(void) { spice_server_new(); return 0; }
configure if test "$spice" != "no" ; then · line 2215
Quoted 10 lines
configure +3
-3EOF - spice_cflags=$($pkgconfig --cflags spice-protocol spice-server 2>/dev/null) - spice_libs=$($pkgconfig --libs spice-protocol spice-server 2>/dev/null) - if $pkgconfig --atleast-version=0.5.3 spice-server>/dev/null 2>&1&& \ + spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null) + spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null) + if $pkg_config --atleast-version=0.5.3 spice-server>/dev/null 2>&1&& \ compile_prog "$spice_cflags" "$spice_libs" ; then spice="yes" libs_softmmu="$libs_softmmu $spice_libs"
Don't know about the rest of the series, but this one is definitely 0.14 material as SPICE doesn't work otherwise.
Paolo
PATCH 8/8 spice: add chardev (v5)
In reply to Gerd HoffmannFrom: Alon Levy <[email protected]>
Adding a chardev backend for spice, where spice determines what to do with it based on the name attribute given during chardev creation. For usage by spice vdagent in conjunction with a properly named virtio-serial device, and future smartcard channel usage.
Example usage:
qemu -device virtio-serial -chardev spicevmc,name=vdagent,id=vdagent \
-device virtserialport,chardev=vdagent,name=com.redhat.spice.0
v4->v5:
* add tracing events
* fix missing comma
* fix help string to show debug is optional
v3->v4:
* updated commit message
v1->v3 changes: (v2 had a wrong commit message)
* removed spice-qemu-char.h, folded into ui/qemu-spice.h
* removed dead IOCTL code
* removed comment
* removed ifdef CONFIG_SPICE from qemu-config.c and qemu-options.hx help.
--- Makefile.objs | 2 +- qemu-char.c | 4 + qemu-config.c | 6 ++ qemu-options.hx | 16 ++++- spice-qemu-char.c | 190 +++++++++++++++++++++++++++++++++++++++++++++++++++++ trace-events | 6 ++ ui/qemu-spice.h | 3 + 7 files changed, 225 insertions(+), 2 deletions(-) create mode 100644 spice-qemu-char.c
Makefile.objs +1 -1
@@ -105,7 +105,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 +4 -0
@@ -97,6 +97,7 @@#endif #include "qemu_socket.h" +#include "ui/qemu-spice.h" #define READ_BUF_LEN 4096
@@ -2495,6 +2496,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 +6 -0
@@ -146,6 +146,12 @@ static QemuOptsList qemu_chardev_opts = { },{ .name = "signal", .type = QEMU_OPT_BOOL, + },{ + .name = "name", + .type = QEMU_OPT_STRING, + },{ + .name = "debug", + .type = QEMU_OPT_NUMBER, }, { /* end of list */ } },
qemu-options.hx +15 -1
@@ -1368,6 +1368,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,name=name[,debug=debug]\n" +#endif , QEMU_ARCH_ALL )
@@ -1392,7 +1395,8 @@ Backend is one of: @option{stdio}, @option{braille}, @option{tty}, -@option{parport}. +@option{parport}, +@option{spicevmc}. The specific backend will determine the applicable options. All devices must have an id, which can be any string up to 127 characters long.
@@ -1568,6 +1572,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 +190 -0
190 lines not on this page · raw message
trace-events +6 -0
@@ -224,3 +224,9 @@ disable qed_aio_write_data(void *s, void *acb, int ret, uint64_t offset, size_t disable qed_aio_write_prefill(void *s, void *acb, uint64_t start, size_t len, uint64_t offset) "s %p acb %p start %"PRIu64" len %zu offset %"PRIu64"" disable qed_aio_write_postfill(void *s, void *acb, uint64_t start, size_t len, uint64_t offset) "s %p acb %p start %"PRIu64" len %zu offset %"PRIu64"" disable qed_aio_write_main(void *s, void *acb, int ret, uint64_t offset, size_t len) "s %p acb %p ret %d offset %"PRIu64" len %zu" + +# spice-qemu-char.c +disable spice_vmc_write(ssize_t out, int len) "spice wrottn %lu of requested %zd" +disable spice_vmc_read(int bytes, int len) "spice read %lu of requested %zd" +disable spice_vmc_register_interface(void *scd) "spice vmc registered interface %p" +disable spice_vmc_unregister_interface(void *scd) "spice vmc unregistered interface %p"
ui/qemu-spice.h +3 -0
@@ -24,6 +24,7 @@#include "qemu-option.h" #include "qemu-config.h" +#include "qemu-char.h" extern int using_spice;
@@ -41,6 +42,8 @@ int qemu_spice_migrate_info(const char *hostname, int port, int tls_port,void do_info_spice_print (Monitor *mon,const QObject *data);void do_info_spice (Monitor *mon,QObject **ret_data); +CharDriverState *qemu_chr_open_spice (QemuOpts *opts); +#else /* CONFIG_SPICE */ #define using_spice 0
Signature · 1 line
1.7.1