Revision bumped to 4 for new IO support, enabled for spice-server =
0.11.1. New io enabled iff revision is 4. Revision can be set to 4, and
defaults to 4, iff spice-server = 0.11.1 spice-protocol =
0.12.0.
This io calls the corresponding new spice api
spice_qxl_monitors_config_async to let spice-server read a new guest set
monitors config and notify the client.
On migration reissue spice_qxl_monitors_config_async.
RHBZ: 770842
Signed-off-by: Alon Levy al...@redhat.com
---
v11-v12:
fix build with older spice server (Gerd).
configure | 7
hw/qxl.c | 97 +++---
hw/qxl.h | 8 +
trace-events | 1 +
ui/spice-display.h | 1 +
5 files changed, 110 insertions(+), 4 deletions(-)
diff --git a/configure b/configure
index cc774b5..84fa2c6 100755
--- a/configure
+++ b/configure
@@ -2657,6 +2657,9 @@ EOF
spice=yes
libs_softmmu=$libs_softmmu $spice_libs
QEMU_CFLAGS=$QEMU_CFLAGS $spice_cflags
+if $pkg_config --atleast-version=0.12.0 spice-protocol /dev/null 21;
then
+spice_qxl_io_monitors_config_async=yes
+fi
else
if test $spice = yes ; then
feature_not_found spice
@@ -3392,6 +3395,10 @@ if test $spice = yes ; then
echo CONFIG_SPICE=y $config_host_mak
fi
+if test $spice_qxl_io_monitors_config_async = yes ; then
+ echo CONFIG_QXL_IO_MONITORS_CONFIG_ASYNC=y $config_host_mak
+fi
+
if test $smartcard = yes ; then
echo CONFIG_SMARTCARD=y $config_host_mak
fi
diff --git a/hw/qxl.c b/hw/qxl.c
index c978f5e..45be2ba 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -27,6 +27,11 @@
#include qxl.h
+#ifndef CONFIG_QXL_IO_MONITORS_CONFIG_ASYNC
+/* spice-protocol is too old, add missing definitions */
+#define QXL_IO_MONITORS_CONFIG_ASYNC (QXL_IO_FLUSH_RELEASE + 1)
+#endif
+
/*
* NOTE: SPICE_RING_PROD_ITEM accesses memory on the pci bar and as
* such can be changed by the guest, so to avoid a guest trigerrable
@@ -249,6 +254,39 @@ static void qxl_spice_destroy_surfaces(PCIQXLDevice *qxl,
qxl_async_io async)
}
}
+static void qxl_spice_monitors_config_async(PCIQXLDevice *qxl, int replay)
+{
+trace_qxl_spice_monitors_config(qxl-id);
+/* 0x000b01 == 0.11.1 */
+#if SPICE_SERVER_VERSION = 0x000b01 \
+defined(CONFIG_QXL_IO_MONITORS_CONFIG_ASYNC)
+if (replay) {
+/*
+ * don't use QXL_COOKIE_TYPE_IO:
+ * - we are not running yet (post_load), we will assert
+ *in send_events
+ * - this is not a guest io, but a reply, so async_io isn't set.
+ */
+spice_qxl_monitors_config_async(qxl-ssd.qxl,
+qxl-guest_monitors_config,
+MEMSLOT_GROUP_GUEST,
+(uintptr_t)qxl_cookie_new(
+QXL_COOKIE_TYPE_POST_LOAD_MONITORS_CONFIG,
+0));
+} else {
+qxl-guest_monitors_config = qxl-ram-monitors_config;
+spice_qxl_monitors_config_async(qxl-ssd.qxl,
+qxl-ram-monitors_config,
+MEMSLOT_GROUP_GUEST,
+(uintptr_t)qxl_cookie_new(QXL_COOKIE_TYPE_IO,
+ QXL_IO_MONITORS_CONFIG_ASYNC));
+}
+#else
+fprintf(stderr, qxl: too old spice-protocol/spice-server for
+QXL_IO_MONITORS_CONFIG_ASYNC\n);
+#endif
+}
+
void qxl_spice_reset_image_cache(PCIQXLDevice *qxl)
{
trace_qxl_spice_reset_image_cache(qxl-id);
@@ -538,6 +576,7 @@ static const char *io_port_to_string(uint32_t io_port)
= QXL_IO_DESTROY_ALL_SURFACES_ASYNC,
[QXL_IO_FLUSH_SURFACES_ASYNC] = QXL_IO_FLUSH_SURFACES_ASYNC,
[QXL_IO_FLUSH_RELEASE] = QXL_IO_FLUSH_RELEASE,
+[QXL_IO_MONITORS_CONFIG_ASYNC] = QXL_IO_MONITORS_CONFIG_ASYNC,
};
return io_port_to_string[io_port];
}
@@ -819,6 +858,7 @@ static void interface_async_complete_io(PCIQXLDevice *qxl,
QXLCookie *cookie)
case QXL_IO_DESTROY_PRIMARY_ASYNC:
case QXL_IO_UPDATE_AREA_ASYNC:
case QXL_IO_FLUSH_SURFACES_ASYNC:
+case QXL_IO_MONITORS_CONFIG_ASYNC:
break;
case QXL_IO_CREATE_PRIMARY_ASYNC:
qxl_create_guest_primary_complete(qxl);
@@ -894,6 +934,8 @@ static void interface_async_complete(QXLInstance *sin,
uint64_t cookie_token)
case QXL_COOKIE_TYPE_RENDER_UPDATE_AREA:
qxl_render_update_area_done(qxl, cookie);
break;
+case QXL_COOKIE_TYPE_POST_LOAD_MONITORS_CONFIG:
+break;
default:
fprintf(stderr, qxl: %s: unexpected cookie type %d\n,
__func__, cookie-type);
@@ -1314,6 +1356,13 @@ static void ioport_write(void *opaque,
target_phys_addr_t addr,
return;
}
+if (d-revision = QXL_REVISION_STABLE_V10
+io_port = QXL_IO_FLUSH_SURFACES_ASYNC) {
+qxl_set_guest_bug(d, unsupported io %d for revision %d\n,
+io_port, d-revision);
+return;
+}
+
switch (io_port) {
case