From patchwork Wed Oct 10 16:18:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: hw/qxl: warn on sync io usage Date: Wed, 10 Oct 2012 06:18:45 -0000 From: Alon Levy X-Patchwork-Id: 190711 Message-Id: <1349885925-24216-1-git-send-email-alevy@redhat.com> To: qemu-devel@nongnu.org Cc: kraxel@redhat.com Signed-off-by: Alon Levy --- Try to warn people who keep getting bitten by this. In addition maybe we should bug out if revision >= 3 and sync io is used, and warn if revision < 3 is used in the first place? hw/qxl.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/hw/qxl.c b/hw/qxl.c index 97ae22a..bd37a83 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -1453,6 +1453,18 @@ static void qxl_set_mode(PCIQXLDevice *d, int modenr, int loadvm) qxl_rom_set_dirty(d); } +static void sync_io_warning(PCIQXLDevice *qxl, uint32_t io_port) +{ + fprintf(stderr, "qxl-%d: WARNING: sync io used, see (RHBZ 747011)", + qxl->id); + fprintf(stderr, "qxl-%d: WARNING: virt-viewer/remote-viewer can hang\n", + qxl->id); + if (qxl->revision < 3) { + fprintf(stderr, "qxl-%d: WARNING: revision >= 3 should be used\n", + qxl->id); + } +} + static void ioport_write(void *opaque, target_phys_addr_t addr, uint64_t val, unsigned size) { @@ -1460,6 +1472,7 @@ static void ioport_write(void *opaque, target_phys_addr_t addr, uint32_t io_port = addr; qxl_async_io async = QXL_SYNC; uint32_t orig_io_port = io_port; + static int warned_sync_io; if (d->guest_bug && io_port != QXL_IO_RESET) { return; @@ -1497,6 +1510,20 @@ static void ioport_write(void *opaque, target_phys_addr_t addr, return; } + if (!warned_sync_io) { + switch (io_port) { + case QXL_IO_UPDATE_AREA: + case QXL_IO_MEMSLOT_ADD: + case QXL_IO_CREATE_PRIMARY: + case QXL_IO_DESTROY_PRIMARY: + case QXL_IO_DESTROY_SURFACE_WAIT: + case QXL_IO_DESTROY_ALL_SURFACES: + sync_io_warning(d, io_port); + warned_sync_io = 1; + break; + } + } + /* we change the io_port to avoid ifdeffery in the main switch */ orig_io_port = io_port; switch (io_port) {