Guest set capabilities are written to the spice server via spice_qxl_guest_capabilities_set, provided the compiled against spice server is new enough to provide this symbol.
QXL device revision will be raised in a later patch to advertise this support to the guest. Signed-off-by: Alon Levy <al...@redhat.com> --- configure | 7 +++++++ hw/qxl.c | 24 ++++++++++++++++++++++++ trace-events | 1 + 3 files changed, 32 insertions(+) diff --git a/configure b/configure index 30be784..d0e3eb1 100755 --- a/configure +++ b/configure @@ -2709,6 +2709,9 @@ EOF if $pkg_config --atleast-version=0.12.0 spice-protocol >/dev/null 2>&1; then spice_qxl_io_monitors_config_async="yes" fi + if $pkg_config --atleast-version=0.12.2 spice-protocol >/dev/null 2>&1; then + spice_qxl_io_client_monitors_config="yes" + fi else if test "$spice" = "yes" ; then feature_not_found "spice" @@ -3456,6 +3459,10 @@ if test "$spice_qxl_io_monitors_config_async" = "yes" ; then echo "CONFIG_QXL_IO_MONITORS_CONFIG_ASYNC=y" >> $config_host_mak fi +if test "$spice_qxl_io_client_monitors_config" = "yes" ; then + echo "CONFIG_QXL_IO_CLIENT_MONITORS_CONFIG=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 94eb3c8..583a2d9 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -32,6 +32,10 @@ #define QXL_IO_MONITORS_CONFIG_ASYNC (QXL_IO_FLUSH_RELEASE + 1) #endif +#ifndef CONFIG_QXL_IO_CLIENT_MONITORS_CONFIG +#define QXL_IO_CAPABILITIES_SET (QXL_IO_FLUSH_RELEASE + 2) +#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 @@ -289,6 +293,21 @@ static void qxl_spice_monitors_config_async(PCIQXLDevice *qxl, int replay) #endif } +static void qxl_spice_guest_capabilities_set(PCIQXLDevice *qxl) +{ +#if SPICE_SERVER_VERSION >= 0x000b05 && \ + defined(CONFIG_QXL_IO_CLIENT_MONITORS_CONFIG) + uint8_t guest_capabilities[sizeof(qxl->ram->guest_capabilities)]; + + trace_qxl_io_capabilities_set(qxl->id, sizeof(qxl->ram->guest_capabilities), + qxl->ram->guest_capabilities); + memcpy(guest_capabilities, qxl->ram->guest_capabilities, + sizeof(guest_capabilities)); + spice_qxl_guest_capabilities_set(&qxl->ssd.qxl, sizeof(guest_capabilities), + guest_capabilities); +#endif +} + void qxl_spice_reset_image_cache(PCIQXLDevice *qxl) { trace_qxl_spice_reset_image_cache(qxl->id); @@ -576,6 +595,7 @@ static const char *io_port_to_string(uint32_t io_port) [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", + [QXL_IO_CAPABILITIES_SET] = "QXL_IO_CAPABILITIES_SET", }; if (io_port >= ARRAY_SIZE(io_port_to_string)) { @@ -1398,6 +1418,7 @@ static void ioport_write(void *opaque, target_phys_addr_t addr, case QXL_IO_LOG: case QXL_IO_MEMSLOT_ADD_ASYNC: case QXL_IO_CREATE_PRIMARY_ASYNC: + case QXL_IO_CAPABILITIES_SET: break; default: if (d->mode != QXL_MODE_VGA) { @@ -1580,6 +1601,9 @@ async_common: case QXL_IO_MONITORS_CONFIG_ASYNC: qxl_spice_monitors_config_async(d, 0); break; + case QXL_IO_CAPABILITIES_SET: + qxl_spice_guest_capabilities_set(d); + break; default: qxl_set_guest_bug(d, "%s: unexpected ioport=0x%x\n", __func__, io_port); } diff --git a/trace-events b/trace-events index 42dfb93..7a35f62 100644 --- a/trace-events +++ b/trace-events @@ -927,6 +927,7 @@ qxl_io_destroy_primary_ignored(int qid, const char *mode) "%d %s" qxl_io_read_unexpected(int qid) "%d" qxl_io_unexpected_vga_mode(int qid, uint64_t addr, uint64_t val, const char *desc) "%d 0x%"PRIx64"=%"PRIu64" (%s)" qxl_io_write(int qid, const char *mode, uint64_t addr, uint64_t val, unsigned size, int async) "%d %s addr=%"PRIu64 " val=%"PRIu64" size=%u async=%d" +qxl_io_capabilities_set(int qid, int caps_size, uint8_t *caps) "%d %d %p" qxl_memslot_add_guest(int qid, uint32_t slot_id, uint64_t guest_start, uint64_t guest_end) "%d %u: guest phys 0x%"PRIx64 " - 0x%" PRIx64 qxl_post_load(int qid, const char *mode) "%d %s" qxl_pre_load(int qid) "%d" -- 1.7.12