From nobody Wed Nov 5 05:26:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1533318033142649.7247113746673; Fri, 3 Aug 2018 10:40:33 -0700 (PDT) Received: from localhost ([::1]:52468 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fle3v-0002aj-P7 for importer@patchew.org; Fri, 03 Aug 2018 13:40:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39974) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fle02-0007m3-C8 for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:36:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fle01-0001Bl-MD for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:36:26 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:41658 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fle01-0001Aw-Gi for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:36:25 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 13285F2B40 for ; Fri, 3 Aug 2018 17:36:25 +0000 (UTC) Received: from localhost (ovpn-112-60.ams2.redhat.com [10.36.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id A724A100724F; Fri, 3 Aug 2018 17:36:19 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Fri, 3 Aug 2018 19:36:05 +0200 Message-Id: <20180803173614.12358-2-marcandre.lureau@redhat.com> In-Reply-To: <20180803173614.12358-1-marcandre.lureau@redhat.com> References: <20180803173614.12358-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 03 Aug 2018 17:36:25 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 03 Aug 2018 17:36:25 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'marcandre.lureau@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 01/10] char/spice: trigger HUP event X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Gerd Hoffmann , Markus Armbruster , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Inform the front-end of disconnected state (spice client disconnected). This will wakeup the source handler immediately, so it can detect the disconnection asap. Signed-off-by: Marc-Andr=C3=A9 Lureau --- chardev/spice.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/chardev/spice.c b/chardev/spice.c index e66e3ad568..fe06034d7f 100644 --- a/chardev/spice.c +++ b/chardev/spice.c @@ -152,15 +152,25 @@ static void vmc_unregister_interface(SpiceChardev *sc= d) static gboolean spice_char_source_prepare(GSource *source, gint *timeout) { SpiceCharSource *src =3D (SpiceCharSource *)source; + Chardev *chr =3D CHARDEV(src->scd); =20 *timeout =3D -1; =20 + if (!chr->be_open) { + return true; + } + return !src->scd->blocked; } =20 static gboolean spice_char_source_check(GSource *source) { SpiceCharSource *src =3D (SpiceCharSource *)source; + Chardev *chr =3D CHARDEV(src->scd); + + if (!chr->be_open) { + return true; + } =20 return !src->scd->blocked; } @@ -168,9 +178,12 @@ static gboolean spice_char_source_check(GSource *sourc= e) static gboolean spice_char_source_dispatch(GSource *source, GSourceFunc callback, gpointer user_data) { + SpiceCharSource *src =3D (SpiceCharSource *)source; + Chardev *chr =3D CHARDEV(src->scd); GIOFunc func =3D (GIOFunc)callback; + GIOCondition cond =3D chr->be_open ? G_IO_OUT : G_IO_HUP; =20 - return func(NULL, G_IO_OUT, user_data); + return func(NULL, cond, user_data); } =20 static GSourceFuncs SpiceCharSourceFuncs =3D { --=20 2.18.0.547.g1d89318c48 From nobody Wed Nov 5 05:26:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1533317895036203.6323538329235; Fri, 3 Aug 2018 10:38:15 -0700 (PDT) Received: from localhost ([::1]:52458 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fle1l-0000Gc-QC for importer@patchew.org; Fri, 03 Aug 2018 13:38:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40013) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fle08-0007oU-8s for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:36:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fle05-0001F1-66 for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:36:32 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:44842 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fle04-0001Eb-WF for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:36:29 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6C4FB401CB8A for ; Fri, 3 Aug 2018 17:36:28 +0000 (UTC) Received: from localhost (ovpn-112-60.ams2.redhat.com [10.36.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7C45921565E1; Fri, 3 Aug 2018 17:36:27 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Fri, 3 Aug 2018 19:36:06 +0200 Message-Id: <20180803173614.12358-3-marcandre.lureau@redhat.com> In-Reply-To: <20180803173614.12358-1-marcandre.lureau@redhat.com> References: <20180803173614.12358-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 03 Aug 2018 17:36:28 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 03 Aug 2018 17:36:28 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'marcandre.lureau@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 02/10] char/spice: discard write() if backend is disconnected X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Gerd Hoffmann , Markus Armbruster , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Most chardev backend handle write() as discarded data if underlying system is disconnected. For unknown historical reasons, the Spice backend has "reliable" write. It will wait until the client end is reconnected to accept further write(). Let's review Spice chardev usage and handling of a disconnected client: * spice vdagent The agent will reopen the virtio port on disconnect. * usb redirection A disconnect creates a device disconnection. * smartcard emulation Data is discarded in passthru_apdu_from_guest() * spice webdavd The daemon will restart the service, and reopen the virtio port. * spice ports (serial console, qemu monitor..) Depends on the associated device or usage. - 16550A serial does nothing special, and may block guest on write - QMP/HMP monitor have some CLOSED event handling, but want to flush the write, which will finish when a new client connects. For all these use cases, it is better to discard pending write when the client is disconnected, and expect the device/agent to behave correctly on CHR_EVENT_CLOSED (to stop reading and writing from chardev). Signed-off-by: Marc-Andr=C3=A9 Lureau --- chardev/spice.c | 6 ++++++ chardev/trace-events | 1 + 2 files changed, 7 insertions(+) diff --git a/chardev/spice.c b/chardev/spice.c index fe06034d7f..6ad95ffe62 100644 --- a/chardev/spice.c +++ b/chardev/spice.c @@ -212,6 +212,12 @@ static int spice_chr_write(Chardev *chr, const uint8_t= *buf, int len) int read_bytes; =20 assert(s->datalen =3D=3D 0); + + if (!chr->be_open) { + trace_spice_chr_discard_write(len); + return len; + } + s->datapos =3D buf; s->datalen =3D len; spice_server_char_device_wakeup(&s->sin); diff --git a/chardev/trace-events b/chardev/trace-events index d0e5f3bbc1..b8a7596344 100644 --- a/chardev/trace-events +++ b/chardev/trace-events @@ -10,6 +10,7 @@ wct_cmd_other(const char *cmd) "%s" wct_speed(int speed) "%d" =20 # chardev/spice.c +spice_chr_discard_write(int len) "spice chr write discarded %d" spice_vmc_write(ssize_t out, int len) "spice wrote %zd of requested %d" spice_vmc_read(int bytes, int len) "spice read %d of requested %d" spice_vmc_register_interface(void *scd) "spice vmc registered interface %p" --=20 2.18.0.547.g1d89318c48 From nobody Wed Nov 5 05:26:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1533318054294171.6374946155704; Fri, 3 Aug 2018 10:40:54 -0700 (PDT) Received: from localhost ([::1]:52474 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fle4L-0002xV-35 for importer@patchew.org; Fri, 03 Aug 2018 13:40:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40032) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fle0A-0007on-1E for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:36:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fle08-0001HA-GC for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:36:34 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48070 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fle08-0001Gy-AI for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:36:32 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D59054B759 for ; Fri, 3 Aug 2018 17:36:31 +0000 (UTC) Received: from localhost (ovpn-112-60.ams2.redhat.com [10.36.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id D29D01007256; Fri, 3 Aug 2018 17:36:30 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Fri, 3 Aug 2018 19:36:07 +0200 Message-Id: <20180803173614.12358-4-marcandre.lureau@redhat.com> In-Reply-To: <20180803173614.12358-1-marcandre.lureau@redhat.com> References: <20180803173614.12358-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 03 Aug 2018 17:36:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Fri, 03 Aug 2018 17:36:31 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'marcandre.lureau@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 03/10] configure: bump spice-server required version to 0.12.6 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Gerd Hoffmann , Markus Armbruster , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Looking at chardev/spice.c code, I realize compilation was broken for a while with spice-server < 0.12.3. I propose to bump required version to 0.12.6, released 3y ago, instead of adding more #ifdef. Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/display/qxl.h | 2 -- include/ui/qemu-spice.h | 9 --------- chardev/spice.c | 12 ------------ hw/display/qxl.c | 8 -------- ui/spice-core.c | 8 -------- configure | 4 ++-- 6 files changed, 2 insertions(+), 41 deletions(-) diff --git a/hw/display/qxl.h b/hw/display/qxl.h index 089696ef62..e4afab8c3a 100644 --- a/hw/display/qxl.h +++ b/hw/display/qxl.h @@ -100,9 +100,7 @@ typedef struct PCIQXLDevice { QXLModes *modes; uint32_t rom_size; MemoryRegion rom_bar; -#if SPICE_SERVER_VERSION >=3D 0x000c06 /* release 0.12.6 */ uint16_t max_outputs; -#endif =20 /* vram pci bar */ uint64_t vram_size; diff --git a/include/ui/qemu-spice.h b/include/ui/qemu-spice.h index c6d50eb87a..f3e17612b1 100644 --- a/include/ui/qemu-spice.h +++ b/include/ui/qemu-spice.h @@ -41,18 +41,9 @@ 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); =20 -#if !defined(SPICE_SERVER_VERSION) || (SPICE_SERVER_VERSION < 0xc06) -#define SPICE_NEEDS_SET_MM_TIME 1 -#else #define SPICE_NEEDS_SET_MM_TIME 0 -#endif =20 -#if SPICE_SERVER_VERSION >=3D 0x000c02 void qemu_spice_register_ports(void); -#else -static inline Chardev *qemu_chr_open_spice_port(const char *name) -{ return NULL; } -#endif =20 #else /* CONFIG_SPICE */ =20 diff --git a/chardev/spice.c b/chardev/spice.c index 6ad95ffe62..4d4bafe34e 100644 --- a/chardev/spice.c +++ b/chardev/spice.c @@ -77,7 +77,6 @@ static int vmc_read(SpiceCharDeviceInstance *sin, uint8_t= *buf, int len) return bytes; } =20 -#if SPICE_SERVER_VERSION >=3D 0x000c02 static void vmc_event(SpiceCharDeviceInstance *sin, uint8_t event) { SpiceChardev *scd =3D container_of(sin, SpiceChardev, sin); @@ -95,7 +94,6 @@ static void vmc_event(SpiceCharDeviceInstance *sin, uint8= _t event) trace_spice_vmc_event(chr_event); qemu_chr_be_event(chr, chr_event); } -#endif =20 static void vmc_state(SpiceCharDeviceInstance *sin, int connected) { @@ -119,12 +117,8 @@ static SpiceCharDeviceInterface vmc_interface =3D { .state =3D vmc_state, .write =3D vmc_write, .read =3D vmc_read, -#if SPICE_SERVER_VERSION >=3D 0x000c02 .event =3D vmc_event, -#endif -#if SPICE_SERVER_VERSION >=3D 0x000c06 .flags =3D SPICE_CHAR_DEVICE_NOTIFY_WRITABLE, -#endif }; =20 =20 @@ -242,9 +236,7 @@ static void char_spice_finalize(Object *obj) } =20 g_free((char *)s->sin.subtype); -#if SPICE_SERVER_VERSION >=3D 0x000c02 g_free((char *)s->sin.portname); -#endif } =20 static void spice_vmc_set_fe_open(struct Chardev *chr, int fe_open) @@ -259,7 +251,6 @@ static void spice_vmc_set_fe_open(struct Chardev *chr, = int fe_open) =20 static void spice_port_set_fe_open(struct Chardev *chr, int fe_open) { -#if SPICE_SERVER_VERSION >=3D 0x000c02 SpiceChardev *s =3D SPICE_CHARDEV(chr); =20 if (fe_open) { @@ -267,7 +258,6 @@ static void spice_port_set_fe_open(struct Chardev *chr,= int fe_open) } else { spice_server_port_event(&s->sin, SPICE_PORT_EVENT_CLOSED); } -#endif } =20 static void spice_chr_accept_input(struct Chardev *chr) @@ -317,7 +307,6 @@ static void qemu_chr_open_spice_vmc(Chardev *chr, chr_open(chr, type); } =20 -#if SPICE_SERVER_VERSION >=3D 0x000c02 static void qemu_chr_open_spice_port(Chardev *chr, ChardevBackend *backend, bool *be_opened, @@ -350,7 +339,6 @@ void qemu_spice_register_ports(void) vmc_register_interface(s); } } -#endif =20 static void qemu_chr_parse_spice_vmc(QemuOpts *opts, ChardevBackend *backe= nd, Error **errp) diff --git a/hw/display/qxl.c b/hw/display/qxl.c index 830c392c53..cdd884984d 100644 --- a/hw/display/qxl.c +++ b/hw/display/qxl.c @@ -274,11 +274,9 @@ static void qxl_spice_monitors_config_async(PCIQXLDevi= ce *qxl, int replay) QXL_COOKIE_TYPE_POST_LOAD_MONITORS_CONFIG, 0)); } else { -#if SPICE_SERVER_VERSION >=3D 0x000c06 /* release 0.12.6 */ if (qxl->max_outputs) { spice_qxl_set_max_monitors(&qxl->ssd.qxl, qxl->max_outputs); } -#endif qxl->guest_monitors_config =3D qxl->ram->monitors_config; spice_qxl_monitors_config_async(&qxl->ssd.qxl, qxl->ram->monitors_config, @@ -1094,12 +1092,10 @@ static int interface_client_monitors_config(QXLInst= ance *sin, return 1; } =20 -#if SPICE_SERVER_VERSION >=3D 0x000c06 /* release 0.12.6 */ /* limit number of outputs based on setting limit */ if (qxl->max_outputs && qxl->max_outputs <=3D max_outputs) { max_outputs =3D qxl->max_outputs; } -#endif =20 config_changed =3D qxl_rom_monitors_config_changed(rom, monitors_config, @@ -1177,9 +1173,7 @@ static void qxl_enter_vga_mode(PCIQXLDevice *d) return; } trace_qxl_enter_vga_mode(d->id); -#if SPICE_SERVER_VERSION >=3D 0x000c03 /* release 0.12.3 */ spice_qxl_driver_unload(&d->ssd.qxl); -#endif graphic_console_set_hwops(d->ssd.dcl.con, d->vga.hw_ops, &d->vga); update_displaychangelistener(&d->ssd.dcl, GUI_REFRESH_INTERVAL_DEFAULT= ); qemu_spice_create_host_primary(&d->ssd); @@ -2403,9 +2397,7 @@ static Property qxl_properties[] =3D { DEFINE_PROP_UINT32("vram64_size_mb", PCIQXLDevice, vram_size_mb, -= 1), DEFINE_PROP_UINT32("vgamem_mb", PCIQXLDevice, vgamem_size_mb, 16), DEFINE_PROP_INT32("surfaces", PCIQXLDevice, ssd.num_surfaces, 1024= ), -#if SPICE_SERVER_VERSION >=3D 0x000c06 /* release 0.12.6 */ DEFINE_PROP_UINT16("max_outputs", PCIQXLDevice, max_outputs, 0), -#endif DEFINE_PROP_UINT32("xres", PCIQXLDevice, xres, 0), DEFINE_PROP_UINT32("yres", PCIQXLDevice, yres, 0), DEFINE_PROP_BOOL("global-vmstate", PCIQXLDevice, vga.global_vmstat= e, false), diff --git a/ui/spice-core.c b/ui/spice-core.c index f8c0878529..76896f7c7a 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -746,13 +746,7 @@ void qemu_spice_init(void) } =20 if (qemu_opt_get_bool(opts, "disable-agent-file-xfer", 0)) { -#if SPICE_SERVER_VERSION >=3D 0x000c04 spice_server_set_agent_file_xfer(spice_server, false); -#else - error_report("this qemu build does not support the " - "\"disable-agent-file-xfer\" option"); - exit(1); -#endif } =20 compression =3D SPICE_IMAGE_COMPRESS_AUTO_GLZ; @@ -818,9 +812,7 @@ void qemu_spice_init(void) g_free(x509_cert_file); g_free(x509_cacert_file); =20 -#if SPICE_SERVER_VERSION >=3D 0x000c02 qemu_spice_register_ports(); -#endif =20 #ifdef HAVE_SPICE_GL if (qemu_opt_get_bool(opts, "gl", 0)) { diff --git a/configure b/configure index 8280ae7a8a..8a1371c55c 100755 --- a/configure +++ b/configure @@ -4521,7 +4521,7 @@ int main(void) { spice_server_new(); return 0; } EOF spice_cflags=3D$($pkg_config --cflags spice-protocol spice-server 2>/dev= /null) spice_libs=3D$($pkg_config --libs spice-protocol spice-server 2>/dev/nul= l) - if $pkg_config --atleast-version=3D0.12.0 spice-server && \ + if $pkg_config --atleast-version=3D0.12.6 spice-server && \ $pkg_config --atleast-version=3D0.12.3 spice-protocol && \ compile_prog "$spice_cflags" "$spice_libs" ; then spice=3D"yes" @@ -4532,7 +4532,7 @@ EOF else if test "$spice" =3D "yes" ; then feature_not_found "spice" \ - "Install spice-server(>=3D0.12.0) and spice-protocol(>=3D0.12.3)= devel" + "Install spice-server(>=3D0.12.6) and spice-protocol(>=3D0.12.3)= devel" fi spice=3D"no" fi --=20 2.18.0.547.g1d89318c48 From nobody Wed Nov 5 05:26:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1533317898369809.9138644608331; Fri, 3 Aug 2018 10:38:18 -0700 (PDT) Received: from localhost ([::1]:52459 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fle1p-0000Me-8J for importer@patchew.org; Fri, 03 Aug 2018 13:38:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40053) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fle0C-0007q9-5F for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:36:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fle0B-0001IT-Gc for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:36:36 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33252 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fle0B-0001IA-B1 for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:36:35 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D6900401EF0B for ; Fri, 3 Aug 2018 17:36:34 +0000 (UTC) Received: from localhost (ovpn-112-60.ams2.redhat.com [10.36.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 54F852026D65; Fri, 3 Aug 2018 17:36:34 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Fri, 3 Aug 2018 19:36:08 +0200 Message-Id: <20180803173614.12358-5-marcandre.lureau@redhat.com> In-Reply-To: <20180803173614.12358-1-marcandre.lureau@redhat.com> References: <20180803173614.12358-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 03 Aug 2018 17:36:34 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 03 Aug 2018 17:36:34 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'marcandre.lureau@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 04/10] spice: avoid spice runtime assert X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Gerd Hoffmann , Markus Armbruster , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The Spice server doesn't like to be started or stopped twice . It aborts with: (process:6191): Spice-ERROR **: 19:29:35.912: red-worker.c:623:handle_dev_s= tart: assertion `!worker->running' failed It's easy to avoid that situation since qemu spice_display_is_running tracks the server state. Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/spice-core.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ui/spice-core.c b/ui/spice-core.c index 76896f7c7a..13f1c11b61 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -923,12 +923,20 @@ int qemu_spice_display_add_client(int csock, int skip= auth, int tls) =20 void qemu_spice_display_start(void) { + if (spice_display_is_running) { + return; + } + spice_display_is_running =3D true; spice_server_vm_start(spice_server); } =20 void qemu_spice_display_stop(void) { + if (!spice_display_is_running) { + return; + } + spice_server_vm_stop(spice_server); spice_display_is_running =3D false; } --=20 2.18.0.547.g1d89318c48 From nobody Wed Nov 5 05:26:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1533318202411733.6139646474405; Fri, 3 Aug 2018 10:43:22 -0700 (PDT) Received: from localhost ([::1]:52485 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fle6i-0004vv-Si for importer@patchew.org; Fri, 03 Aug 2018 13:43:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40087) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fle0H-0007ur-MS for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:36:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fle0E-0001JQ-Jn for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:36:41 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:41662 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fle0E-0001JC-Et for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:36:38 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0CDD0857AB for ; Fri, 3 Aug 2018 17:36:38 +0000 (UTC) Received: from localhost (ovpn-112-60.ams2.redhat.com [10.36.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 671AA2026D65; Fri, 3 Aug 2018 17:36:37 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Fri, 3 Aug 2018 19:36:09 +0200 Message-Id: <20180803173614.12358-6-marcandre.lureau@redhat.com> In-Reply-To: <20180803173614.12358-1-marcandre.lureau@redhat.com> References: <20180803173614.12358-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 03 Aug 2018 17:36:38 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 03 Aug 2018 17:36:38 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'marcandre.lureau@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 05/10] spice: merge options lists X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Gerd Hoffmann , Markus Armbruster , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Passing several -spice options to qemu command line, or calling several time qemu_opts_set() will ignore all but the first option list. Since the spice server is a singleton, it makes sense to merge all the options, the last value being the one taken into account. This changes the behaviour from, for ex: $ qemu... -spice port=3D5900 -spice port=3D5901 -> port: 5900 to: $ qemu... -spice port=3D5900 -spice port=3D5901 -> port: 5901 (if necessary we could instead produce an error when an option is given twice, although this makes handling default values and such more complicated) Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/spice-core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/spice-core.c b/ui/spice-core.c index 13f1c11b61..6bd107f0f9 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -400,6 +400,7 @@ static SpiceChannelList *qmp_query_spice_channels(void) static QemuOptsList qemu_spice_opts =3D { .name =3D "spice", .head =3D QTAILQ_HEAD_INITIALIZER(qemu_spice_opts.head), + .merge_lists =3D true, .desc =3D { { .name =3D "port", --=20 2.18.0.547.g1d89318c48 From nobody Wed Nov 5 05:26:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1533318057417377.7195409856579; Fri, 3 Aug 2018 10:40:57 -0700 (PDT) Received: from localhost ([::1]:52475 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fle4O-00031Y-9D for importer@patchew.org; Fri, 03 Aug 2018 13:40:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40130) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fle0M-00080y-Ne for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:36:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fle0M-0001Lw-1e for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:36:46 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:41664 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fle0L-0001Lc-TD for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:36:45 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7ACFC857AB for ; Fri, 3 Aug 2018 17:36:45 +0000 (UTC) Received: from localhost (ovpn-112-60.ams2.redhat.com [10.36.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 66E741CBBF; Fri, 3 Aug 2018 17:36:40 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Fri, 3 Aug 2018 19:36:10 +0200 Message-Id: <20180803173614.12358-7-marcandre.lureau@redhat.com> In-Reply-To: <20180803173614.12358-1-marcandre.lureau@redhat.com> References: <20180803173614.12358-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 03 Aug 2018 17:36:45 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 03 Aug 2018 17:36:45 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'marcandre.lureau@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 06/10] spice: do not stop spice if VM is paused X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Gerd Hoffmann , Markus Armbruster , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" spice_server_vm_start/stop() was added to help migration state. However, a paused VM could keep running the spice server. This will allow a Spice client to keep sending commands to a spice chardev. This allows to stop/cont a VM from a Spice monitor port. Signed-off-by: Marc-Andr=C3=A9 Lureau --- ui/spice-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/spice-core.c b/ui/spice-core.c index 6bd107f0f9..88f0cd7262 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -629,7 +629,7 @@ static void vm_change_state_handler(void *opaque, int r= unning, { if (running) { qemu_spice_display_start(); - } else { + } else if (state !=3D RUN_STATE_PAUSED) { qemu_spice_display_stop(); } } --=20 2.18.0.547.g1d89318c48 From nobody Wed Nov 5 05:26:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1533318329985415.44003182292465; Fri, 3 Aug 2018 10:45:29 -0700 (PDT) Received: from localhost ([::1]:52503 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fle8m-000702-Jt for importer@patchew.org; Fri, 03 Aug 2018 13:45:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fle0S-00084s-95 for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:36:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fle0P-0001Mi-6u for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:36:52 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:44850 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fle0P-0001MU-1E for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:36:49 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 930684012981 for ; Fri, 3 Aug 2018 17:36:48 +0000 (UTC) Received: from localhost (ovpn-112-60.ams2.redhat.com [10.36.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 007891DB20; Fri, 3 Aug 2018 17:36:47 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Fri, 3 Aug 2018 19:36:11 +0200 Message-Id: <20180803173614.12358-8-marcandre.lureau@redhat.com> In-Reply-To: <20180803173614.12358-1-marcandre.lureau@redhat.com> References: <20180803173614.12358-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 03 Aug 2018 17:36:48 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 03 Aug 2018 17:36:48 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'marcandre.lureau@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 07/10] char: move SpiceChardev and open_spice_port() to spice.h header X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Gerd Hoffmann , Markus Armbruster , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This will allow to subclass SpiceChardev easily. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/chardev/spice.h | 27 +++++++++++++++++++++++++++ chardev/spice.c | 28 +++++----------------------- 2 files changed, 32 insertions(+), 23 deletions(-) create mode 100644 include/chardev/spice.h diff --git a/include/chardev/spice.h b/include/chardev/spice.h new file mode 100644 index 0000000000..6431da3205 --- /dev/null +++ b/include/chardev/spice.h @@ -0,0 +1,27 @@ +#ifndef CHARDEV_SPICE_H_ +#define CHARDEV_SPICE_H_ + +#include +#include "chardev/char-fe.h" + +typedef struct SpiceChardev { + Chardev parent; + + SpiceCharDeviceInstance sin; + bool active; + bool blocked; + const uint8_t *datapos; + int datalen; + QLIST_ENTRY(SpiceChardev) next; +} SpiceChardev; + +#define TYPE_CHARDEV_SPICE "chardev-spice" +#define TYPE_CHARDEV_SPICEVMC "chardev-spicevmc" +#define TYPE_CHARDEV_SPICEPORT "chardev-spiceport" + +#define SPICE_CHARDEV(obj) OBJECT_CHECK(SpiceChardev, (obj), TYPE_CHARDEV_= SPICE) + +void qemu_chr_open_spice_port(Chardev *chr, ChardevBackend *backend, + bool *be_opened, Error **errp); + +#endif diff --git a/chardev/spice.c b/chardev/spice.c index 4d4bafe34e..0112efb6d2 100644 --- a/chardev/spice.c +++ b/chardev/spice.c @@ -2,30 +2,12 @@ #include "trace.h" #include "ui/qemu-spice.h" #include "chardev/char.h" +#include "chardev/spice.h" #include "qapi/error.h" #include "qemu/error-report.h" #include "qemu/option.h" -#include #include =20 - -typedef struct SpiceChardev { - Chardev parent; - - SpiceCharDeviceInstance sin; - bool active; - bool blocked; - const uint8_t *datapos; - int datalen; - QLIST_ENTRY(SpiceChardev) next; -} SpiceChardev; - -#define TYPE_CHARDEV_SPICE "chardev-spice" -#define TYPE_CHARDEV_SPICEVMC "chardev-spicevmc" -#define TYPE_CHARDEV_SPICEPORT "chardev-spiceport" - -#define SPICE_CHARDEV(obj) OBJECT_CHECK(SpiceChardev, (obj), TYPE_CHARDEV_= SPICE) - typedef struct SpiceCharSource { GSource source; SpiceChardev *scd; @@ -307,10 +289,10 @@ static void qemu_chr_open_spice_vmc(Chardev *chr, chr_open(chr, type); } =20 -static void qemu_chr_open_spice_port(Chardev *chr, - ChardevBackend *backend, - bool *be_opened, - Error **errp) +void qemu_chr_open_spice_port(Chardev *chr, + ChardevBackend *backend, + bool *be_opened, + Error **errp) { ChardevSpicePort *spiceport =3D backend->u.spiceport.data; const char *name =3D spiceport->fqdn; --=20 2.18.0.547.g1d89318c48 From nobody Wed Nov 5 05:26:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1533318466637729.5861171890929; Fri, 3 Aug 2018 10:47:46 -0700 (PDT) Received: from localhost ([::1]:52514 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fleAs-00006F-IE for importer@patchew.org; Fri, 03 Aug 2018 13:47:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40165) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fle0T-00084t-2p for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:36:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fle0S-0001OZ-5Z for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:36:53 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:41670 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fle0S-0001Nw-0X for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:36:52 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8C5A1F2B40 for ; Fri, 3 Aug 2018 17:36:51 +0000 (UTC) Received: from localhost (ovpn-112-60.ams2.redhat.com [10.36.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id D64B821565E1; Fri, 3 Aug 2018 17:36:50 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Fri, 3 Aug 2018 19:36:12 +0200 Message-Id: <20180803173614.12358-9-marcandre.lureau@redhat.com> In-Reply-To: <20180803173614.12358-1-marcandre.lureau@redhat.com> References: <20180803173614.12358-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 03 Aug 2018 17:36:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 03 Aug 2018 17:36:51 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'marcandre.lureau@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 08/10] char: register spice ports after spice started X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Gerd Hoffmann , Markus Armbruster , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Spice port registration is delayed until the server is started. But ports created after are not being registered. If the server is already started, do vmc_register_interface() to register it from qemu_chr_open_spice_port(). Signed-off-by: Marc-Andr=C3=A9 Lureau --- chardev/spice.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/chardev/spice.c b/chardev/spice.c index 0112efb6d2..1deb0cedef 100644 --- a/chardev/spice.c +++ b/chardev/spice.c @@ -308,6 +308,11 @@ void qemu_chr_open_spice_port(Chardev *chr, *be_opened =3D false; s =3D SPICE_CHARDEV(chr); s->sin.portname =3D g_strdup(name); + + if (using_spice) { + /* spice server already created */ + vmc_register_interface(s); + } } =20 void qemu_spice_register_ports(void) --=20 2.18.0.547.g1d89318c48 From nobody Wed Nov 5 05:26:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1533318221519910.6988998010407; Fri, 3 Aug 2018 10:43:41 -0700 (PDT) Received: from localhost ([::1]:52486 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fle72-0005EL-3q for importer@patchew.org; Fri, 03 Aug 2018 13:43:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40230) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fle0c-0008CN-BY for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:37:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fle0Z-0001Um-9d for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:37:02 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:41672 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fle0Z-0001UG-5C for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:36:59 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AD06D7A7EF for ; Fri, 3 Aug 2018 17:36:58 +0000 (UTC) Received: from localhost (ovpn-112-60.ams2.redhat.com [10.36.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id F189B10B7C93; Fri, 3 Aug 2018 17:36:52 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Fri, 3 Aug 2018 19:36:13 +0200 Message-Id: <20180803173614.12358-10-marcandre.lureau@redhat.com> In-Reply-To: <20180803173614.12358-1-marcandre.lureau@redhat.com> References: <20180803173614.12358-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 03 Aug 2018 17:36:58 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 03 Aug 2018 17:36:58 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'marcandre.lureau@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 09/10] build-sys: add gio-2.0 check X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Gerd Hoffmann , Markus Armbruster , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" GIO is required for the -display app backend. Signed-off-by: Marc-Andr=C3=A9 Lureau --- configure | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/configure b/configure index 8a1371c55c..9f91752289 100755 --- a/configure +++ b/configure @@ -3483,6 +3483,14 @@ for i in $glib_modules; do fi done =20 +if $pkg_config --atleast-version=3D$glib_req_ver gio-2.0; then + gio=3Dyes + gio_cflags=3D$($pkg_config --cflags gio-2.0) + gio_libs=3D$($pkg_config --libs gio-2.0) +else + gio=3Dno +fi + # Sanity check that the current size_t matches the # size that glib thinks it should be. This catches # problems on multi-arch where people try to build @@ -6344,6 +6352,11 @@ if test "$gtk" =3D "yes" ; then echo "CONFIG_GTK_GL=3Dy" >> $config_host_mak fi fi +if test "$gio" =3D "yes" ; then + echo "CONFIG_GIO=3Dy" >> $config_host_mak + echo "GIO_CFLAGS=3D$gio_cflags" >> $config_host_mak + echo "GIO_LIBS=3D$gio_libs" >> $config_host_mak +fi echo "CONFIG_TLS_PRIORITY=3D\"$tls_priority\"" >> $config_host_mak if test "$gnutls" =3D "yes" ; then echo "CONFIG_GNUTLS=3Dy" >> $config_host_mak --=20 2.18.0.547.g1d89318c48 From nobody Wed Nov 5 05:26:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 153331822470517.31160655548308; Fri, 3 Aug 2018 10:43:44 -0700 (PDT) Received: from localhost ([::1]:52487 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fle75-0005IS-AZ for importer@patchew.org; Fri, 03 Aug 2018 13:43:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40261) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fle0h-0008GT-ED for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:37:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fle0f-0001Y2-VQ for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:37:07 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:37960 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fle0f-0001Xh-PC for qemu-devel@nongnu.org; Fri, 03 Aug 2018 13:37:05 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 540D58197021 for ; Fri, 3 Aug 2018 17:37:05 +0000 (UTC) Received: from localhost (ovpn-112-60.ams2.redhat.com [10.36.112.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id D80E51CBBF; Fri, 3 Aug 2018 17:36:59 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Fri, 3 Aug 2018 19:36:14 +0200 Message-Id: <20180803173614.12358-11-marcandre.lureau@redhat.com> In-Reply-To: <20180803173614.12358-1-marcandre.lureau@redhat.com> References: <20180803173614.12358-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 03 Aug 2018 17:37:05 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 03 Aug 2018 17:37:05 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'marcandre.lureau@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 10/10] display: add -display app launching external application X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Gerd Hoffmann , Markus Armbruster , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add a new display backend that will configure Spice to allow a remote client to control QEMU in a similar fashion as other display backend like GTK. For this to work, we set up Spice server with a unix socket, and register a VC chardev that will be exposed as Spice ports. A QMP monitor is also exposed as a Spice port, this allows the remote client fuller qemu control and state handling. - doesn't handle VC set_echo() - this doesn't seem a strong requirement, very few front-end use it - spice options can be tweaked with other -spice arguments - Windows support shouldn't be hard to do, but will probably use a TCP port instead - we may want to watch the child process to quit automatically if it crashed Signed-off-by: Marc-Andr=C3=A9 Lureau --- qapi/ui.json | 3 +- ui/app.c | 179 +++++++++++++++++++++++++++++++++++++++++++++++ qemu-options.hx | 5 ++ ui/Makefile.objs | 5 ++ 4 files changed, 191 insertions(+), 1 deletion(-) create mode 100644 ui/app.c diff --git a/qapi/ui.json b/qapi/ui.json index 4ca91bb45a..9b96f1f9d7 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -1057,7 +1057,8 @@ ## { 'enum' : 'DisplayType', 'data' : [ 'default', 'none', 'gtk', 'sdl', - 'egl-headless', 'curses', 'cocoa' ] } + 'egl-headless', 'curses', 'cocoa', + 'app'] } =20 ## # @DisplayOptions: diff --git a/ui/app.c b/ui/app.c new file mode 100644 index 0000000000..d29f630a70 --- /dev/null +++ b/ui/app.c @@ -0,0 +1,179 @@ +/* + * QEMU external app display driver + * + * Copyright (c) 2018 Marc-Andr=C3=A9 Lureau + * + * Permission is hereby granted, free of charge, to any person obtaining a= copy + * of this software and associated documentation files (the "Software"), t= o deal + * in the Software without restriction, including without limitation the r= ights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included= in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN + * THE SOFTWARE. + */ +#include "qemu/osdep.h" + +#include + +#include "qemu-common.h" +#include "ui/console.h" +#include "qemu/config-file.h" +#include "qemu/option.h" +#include "qemu/cutils.h" +#include "qapi/error.h" +#include "io/channel-command.h" +#include "chardev/spice.h" +#include "sysemu/sysemu.h" + +static char *tmp_dir; +static char *sock_path; + +typedef struct VCChardev { + SpiceChardev parent; +} VCChardev; + +#define TYPE_CHARDEV_VC "chardev-vc" +#define VC_CHARDEV(obj) OBJECT_CHECK(VCChardev, (obj), TYPE_CHARDEV_VC) + +static ChardevBackend * +chr_spice_backend_new(void) +{ + ChardevBackend *be =3D g_new0(ChardevBackend, 1); + + be->type =3D CHARDEV_BACKEND_KIND_SPICEPORT; + be->u.spiceport.data =3D g_new0(ChardevSpicePort, 1); + + return be; +} + +static void vc_chr_open(Chardev *chr, + ChardevBackend *backend, + bool *be_opened, + Error **errp) +{ + ChardevBackend *be; + const char *fqdn =3D NULL; + + if (strstart(chr->label, "serial", NULL)) { + fqdn =3D "org.qemu.console.serial.0"; + } else if (strstart(chr->label, "parallel", NULL)) { + fqdn =3D "org.qemu.console.parallel.0"; + } else if (strstart(chr->label, "compat_monitor", NULL)) { + fqdn =3D "org.qemu.monitor.hmp.0"; + } + + be =3D chr_spice_backend_new(); + be->u.spiceport.data->fqdn =3D fqdn ? + g_strdup(fqdn) : g_strdup_printf("org.qemu.console.%s", chr->label= ); + qemu_chr_open_spice_port(chr, be, be_opened, errp); + qapi_free_ChardevBackend(be); +} + +static void vc_chr_set_echo(Chardev *chr, bool echo) +{ + /* TODO: set echo for frontends QMP and qtest */ +} + +static void char_vc_class_init(ObjectClass *oc, void *data) +{ + ChardevClass *cc =3D CHARDEV_CLASS(oc); + + cc->parse =3D qemu_chr_parse_vc; + cc->open =3D vc_chr_open; + cc->chr_set_echo =3D vc_chr_set_echo; +} + +static const TypeInfo char_vc_type_info =3D { + .name =3D TYPE_CHARDEV_VC, + .parent =3D TYPE_CHARDEV_SPICEPORT, + .instance_size =3D sizeof(VCChardev), + .class_init =3D char_vc_class_init, +}; + +static void app_atexit(void) +{ + if (sock_path) { + unlink(sock_path); + } + if (tmp_dir) { + rmdir(tmp_dir); + } + g_free(sock_path); + g_free(tmp_dir); +} + +static void app_display_early_init(DisplayOptions *opts) +{ + QemuOpts *qopts; + ChardevBackend *be =3D chr_spice_backend_new(); + GError *err =3D NULL; + + atexit(app_atexit); + tmp_dir =3D g_dir_make_tmp(NULL, &err); + if (err) { + error_report("Failed to create temporary directory: %s", err->mess= age); + abort(); + } + + type_register(&char_vc_type_info); + + sock_path =3D g_strjoin("", tmp_dir, "/", "spice.sock", NULL); + qopts =3D qemu_opts_create(qemu_find_opts("spice"), NULL, 0, &error_ab= ort); + qemu_opt_set(qopts, "disable-ticketing", "on", &error_abort); + qemu_opt_set(qopts, "unix", "on", &error_abort); + qemu_opt_set(qopts, "addr", sock_path, &error_abort); + qemu_opt_set(qopts, "image-compression", "off", &error_abort); + qemu_opt_set(qopts, "streaming-video", "off", &error_abort); + qemu_opt_set(qopts, "gl", opts->has_gl ? "on" : "off", &error_abort); + display_opengl =3D opts->has_gl; + + be->u.spiceport.data->fqdn =3D g_strdup("org.qemu.monitor.qmp.0"); + qemu_chardev_new("org.qemu.monitor.qmp", TYPE_CHARDEV_SPICEPORT, + be, &error_abort); + qopts =3D qemu_opts_create(qemu_find_opts("mon"), + NULL, 0, &error_fatal); + qemu_opt_set(qopts, "chardev", "org.qemu.monitor.qmp", &error_abort); + qemu_opt_set(qopts, "mode", "control", &error_abort); + + if (!qemu_name) { + qemu_name =3D "QEMU"; + } + qapi_free_ChardevBackend(be); +} + +static void app_display_init(DisplayState *ds, DisplayOptions *opts) +{ + GError *err =3D NULL; + gchar *uri; + + uri =3D g_strjoin("", "spice+unix://", tmp_dir, "/", "spice.sock", NUL= L); + g_app_info_launch_default_for_uri(uri, NULL, &err); + if (err) { + error_report("Failed to launch %s URI: %s", uri, err->message); + exit(1); + } + g_free(uri); +} + +static QemuDisplay qemu_display_app =3D { + .type =3D DISPLAY_TYPE_APP, + .early_init =3D app_display_early_init, + .init =3D app_display_init, +}; + +static void register_app(void) +{ + qemu_display_register(&qemu_display_app); +} + +type_init(register_app); diff --git a/qemu-options.hx b/qemu-options.hx index b1bf0f485f..846e0b5c65 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1239,6 +1239,7 @@ STEXI ETEXI =20 DEF("display", HAS_ARG, QEMU_OPTION_display, + "-display app[,gl=3Don|off]\n" "-display sdl[,frame=3Don|off][,alt_grab=3Don|off][,ctrl_grab=3Don|off= ]\n" " [,window_close=3Don|off][,gl=3Don|core|es|off]\n" "-display gtk[,grab_on_hover=3Don|off][,gl=3Don|off]|\n" @@ -1286,6 +1287,10 @@ menus and other UI elements to configure and control= the VM during runtime. @item vnc Start a VNC server on display +@item app +Start QEMU as a Spice server and launch the default Spice client +application. The Spice server will redirect the serial consoles and +QEMU monitors. @end table ETEXI =20 diff --git a/ui/Makefile.objs b/ui/Makefile.objs index 00f6976c30..11178fbe24 100644 --- a/ui/Makefile.objs +++ b/ui/Makefile.objs @@ -54,6 +54,11 @@ curses.mo-objs :=3D curses.o curses.mo-cflags :=3D $(CURSES_CFLAGS) curses.mo-libs :=3D $(CURSES_LIBS) =20 +common-obj-$(call land,$(CONFIG_SPICE),$(CONFIG_GIO)) +=3D app.mo +app.mo-objs :=3D app.o +app.mo-cflags :=3D $(GIO_CFLAGS) +app.mo-libs :=3D $(GIO_LIBS) + common-obj-$(CONFIG_OPENGL) +=3D shader.o common-obj-$(CONFIG_OPENGL) +=3D console-gl.o common-obj-$(CONFIG_OPENGL) +=3D egl-helpers.o --=20 2.18.0.547.g1d89318c48