From nobody Mon Apr 29 22:18:52 2024 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.zoho.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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1491807595692671.8149638258216; Sun, 9 Apr 2017 23:59:55 -0700 (PDT) Received: from localhost ([::1]:60859 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cxTIn-0006CS-5S for importer@patchew.org; Mon, 10 Apr 2017 02:59:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54689) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cxTHx-0005te-10 for qemu-devel@nongnu.org; Mon, 10 Apr 2017 02:59:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cxTHs-000644-Qo for qemu-devel@nongnu.org; Mon, 10 Apr 2017 02:59:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46460) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cxTHs-00063a-Le for qemu-devel@nongnu.org; Mon, 10 Apr 2017 02:58:56 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 69242635D2; Mon, 10 Apr 2017 06:58:54 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-27.ams2.redhat.com [10.36.116.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id F0CE9A3A72; Mon, 10 Apr 2017 06:58:51 +0000 (UTC) Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id DFD0280B57; Mon, 10 Apr 2017 08:58:50 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 69242635D2 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kraxel@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 69242635D2 From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 10 Apr 2017 08:58:37 +0200 Message-Id: <20170410065837.31847-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 10 Apr 2017 06:58:54 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] qxl: add migration blocker to avoid pre-save 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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , 1635339@bugs.launchpad.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Cc: 1635339@bugs.launchpad.net Signed-off-by: Gerd Hoffmann --- hw/display/qxl.h | 1 + hw/display/qxl.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/hw/display/qxl.h b/hw/display/qxl.h index d2d49dd..77e5a36 100644 --- a/hw/display/qxl.h +++ b/hw/display/qxl.h @@ -40,6 +40,7 @@ typedef struct PCIQXLDevice { uint32_t cmdlog; =20 uint32_t guest_bug; + Error *migration_blocker; =20 enum qxl_mode mode; uint32_t cmdflags; diff --git a/hw/display/qxl.c b/hw/display/qxl.c index c31b293..74ebeb9 100644 --- a/hw/display/qxl.c +++ b/hw/display/qxl.c @@ -26,6 +26,7 @@ #include "qemu/queue.h" #include "qemu/atomic.h" #include "sysemu/sysemu.h" +#include "migration/migration.h" #include "trace.h" =20 #include "qxl.h" @@ -639,6 +640,27 @@ static int interface_get_command(QXLInstance *sin, str= uct QXLCommandExt *ext) qxl->guest_primary.commands++; qxl_track_command(qxl, ext); qxl_log_command(qxl, "cmd", ext); + { + /* + * Windows 8 drivers place qxl commands in the vram + * (instead of the ram) bar. We can't live migrate such a + * guest, so add a migration blocker in case we detect + * this, to avoid triggering the assert in pre_save(). + * + * https://cgit.freedesktop.org/spice/win32/qxl-wddm-dod/commi= t/?id=3Df6e099db39e7d0787f294d5fd0dce328b5210faa + */ + void *msg =3D qxl_phys2virt(qxl, ext->cmd.data, ext->group_id); + if (msg !=3D NULL && ( + msg < (void *)qxl->vga.vram_ptr || + msg > ((void *)qxl->vga.vram_ptr + qxl->vga.vram_size)= )) { + if (!qxl->migration_blocker) { + Error *local_err =3D NULL; + error_setg(&qxl->migration_blocker, + "qxl: guest bug: command not in ram bar"); + migrate_add_blocker(qxl->migration_blocker, &local_err= ); + } + } + } trace_qxl_ring_command_get(qxl->id, qxl_mode_to_string(qxl->mode)); return true; default: --=20 2.9.3