qxl/update_area_io: guest_bug on invalid parameters
PATCH v8 1/4 qxl/update_area_io: guest_bug on invalid parameters
---
Changes for patchset v7->v8:
QXL_IO_MONITORS_CONFIG_ASYNC is defined even when spice-protocol < 0.12 (Gerd Hoffman) QXL_HAS_.. is either defined or not, same as other feature definitions (Blue Swirl)
Only the third patch "qxl: add QXL_IO_MONITORS_CONFIG_ASYNC" is affected.
hw/qxl.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
hw/qxl.c +12 -0
@@ -1385,6 +1385,18 @@ async_common:QXLCookie *cookie =NULL ;QXLRect update = d->ram->update_area; +if (d->ram->update_surface >NUM_SURFACES ) { +qxl_set_guest_bug (d,"QXL_IO_UPDATE_AREA: invalid surface id %d\n" , + d->ram->update_surface); +return ; + } +if (update.left >= update.right || update.top >= update.bottom) { +qxl_set_guest_bug (d, +"QXL_IO_UPDATE_AREA: invalid area (%ux%u)x(%ux%u)\n" , + update.left, update.top, update.right, update.bottom); +return ; + } +if (async ==QXL_ASYNC ) { cookie =qxl_cookie_new (QXL_COOKIE_TYPE_IO ,QXL_IO_UPDATE_AREA_ASYNC );
Signature · 1 line
1.7.11.2
PATCH v8 2/4 qxl: disallow unknown revisions
--- hw/qxl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
hw/qxl.c +4 -1
@@ -1797,10 +1797,13 @@ static int qxl_init_common(PCIQXLDevice *qxl) io_size =16 ;break ;case 3 :/* qxl-3 */ -default : pci_device_rev =QXL_DEFAULT_REVISION ; io_size =msb_mask (QXL_IO_RANGE_SIZE *2 -1 );break ; +default : +error_report ("Invalid revision %d for qxl device (max %d)" , + qxl->revision,QXL_DEFAULT_REVISION ); +return -1 ; }pci_set_byte (&config[PCI_REVISION_ID ], pci_device_rev);
Signature · 1 line
1.7.11.2
PATCH v8 3/4 qxl: add QXL_IO_MONITORS_CONFIG_ASYNC
In reply to Alon LevyRevision 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
--- configure | 3 +++ hw/qxl.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++--- hw/qxl.h | 8 +++++++ trace-events | 1 + ui/spice-display.h | 1 + 5 files changed, 76 insertions(+), 3 deletions(-)
configure +3 -0
@@ -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 2>&1; then + QEMU_CFLAGS="$QEMU_CFLAGS -DQXL_HAS_IO_MONITORS_CONFIG_ASYNC" + fi else if test "$spice" = "yes" ; then feature_not_found "spice"
hw/qxl.c +63 -3
140 lines not on this page · raw message
hw/qxl.h +8 -0
@@ -71,6 +71,8 @@ typedef struct PCIQXLDevice { } guest_surfaces;QXLPHYSICAL guest_cursor; +QXLPHYSICAL guest_monitors_config; +QemuMutex track_lock;/* thread signaling */
@@ -128,7 +130,13 @@ typedef struct PCIQXLDevice { } \ }while (0 ) +/* 0x000b01 == 0.11.1 */ +#if SPICE_SERVER_VERSION >=0x000b01 &&\ + defined(QXL_HAS_IO_MONITORS_CONFIG_ASYNC ) +#define QXL_DEFAULT_REVISION QXL_REVISION_STABLE_V12 +#else #define QXL_DEFAULT_REVISION QXL_REVISION_STABLE_V10 +#endif /* qxl.c */ void *qxl_phys2virt (PCIQXLDevice *qxl,QXLPHYSICAL phys,int group_id);
trace-events +1 -0
@@ -956,6 +956,7 @@ qxl_spice_destroy_surfaces(int qid, int async) "%d async=%d" qxl_spice_destroy_surface_wait_complete(int qid, uint32_t id) "%d sid=%d" qxl_spice_destroy_surface_wait(int qid, uint32_t id, int async) "%d sid=%d async=%d" qxl_spice_flush_surfaces_async(int qid, uint32_t surface_count, uint32_t num_free_res) "%d s#=%d, res#=%d" +qxl_spice_monitors_config(int id) "%d" qxl_spice_loadvm_commands(int qid, void *ext, uint32_t count) "%d ext=%p count=%d" qxl_spice_oom(int qid) "%d" qxl_spice_reset_cursor(int qid) "%d"
ui/spice-display.h +1 -0
@@ -51,6 +51,7 @@ typedef enum qxl_async_io {enum {QXL_COOKIE_TYPE_IO ,QXL_COOKIE_TYPE_RENDER_UPDATE_AREA , +QXL_COOKIE_TYPE_POST_LOAD_MONITORS_CONFIG , }; typedef struct QXLCookie {
Signature · 1 line
1.7.11.2
PATCH v8 4/4 configure: print spice-protocol and spice-server versions
In reply to Alon Levy--- configure | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
configure +3 -1
@@ -2657,6 +2657,8 @@ EOF spice="yes" libs_softmmu="$libs_softmmu $spice_libs" QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags" + spice_protocol_version=$($pkg_config --modversion spice-protocol) + spice_server_version=$($pkg_config --modversion spice-server) if $pkg_config --atleast-version=0.12.0 spice-protocol >/dev/null 2>&1; then QEMU_CFLAGS="$QEMU_CFLAGS -DQXL_HAS_IO_MONITORS_CONFIG_ASYNC" fi
@@ -3114,7 +3116,7 @@ echo "libcap-ng support $cap_ng" echo "vhost-net support $vhost_net" echo "Trace backend $trace_backend" echo "Trace output file $trace_file-<pid>" -echo "spice support $spice" +echo "spice support $spice ($spice_protocol_version/$spice_server_version)" echo "rbd support $rbd" echo "xfsctl support $xfs" echo "nss used $smartcard_nss"
Signature · 1 line
1.7.11.2
Re: [Qemu-devel] [PATCH v8 3/4] qxl: add QXL_IO_MONITORS_CONFIG_ASYNC
In reply to Alon LevyHi,
Patch looks alot nicer now with a bunch if #ifdefs removed.
One issue left I missed before:
hw/qxl.c static VMStateDescription qxl_vmstate = { · line 2129
Quoted 9 lines
case QXL_MODE_COMPAT: /* note: no need to call qxl_create_memslots, qxl_set_modehw/qxl.c +1
-0@@ -2065,6 +2124,7 @@ static VMStateDescription qxl_vmstate = {VMSTATE_ARRAY (guest_surfaces.cmds, PCIQXLDevice,NUM_SURFACES ,0 , vmstate_info_uint64, uint64_t),VMSTATE_UINT64 (guest_cursor, PCIQXLDevice), +VMSTATE_UINT64 (guest_monitors_config, PCIQXLDevice),VMSTATE_END_OF_LIST () },
That breaks migration.
You probably want a subsection here which stuffs guest_monitors_config into the stream only in case the guest has actually configured it, so migration between qemu versions with & without monitor config support keeps working as long as the guest doesn't use the new feature (or it is disabled via rev=3).
cheers,
Gerd