From nobody Tue May 7 22:19:14 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 1489494615383678.792663875226; Tue, 14 Mar 2017 05:30:15 -0700 (PDT) Received: from localhost ([::1]:58457 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnlaf-0000VK-4k for importer@patchew.org; Tue, 14 Mar 2017 08:30:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41229) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnlZd-0000Rj-QL for qemu-devel@nongnu.org; Tue, 14 Mar 2017 08:29:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnlZZ-0008TE-QQ for qemu-devel@nongnu.org; Tue, 14 Mar 2017 08:29:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46082) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cnlZZ-0008Se-KE for qemu-devel@nongnu.org; Tue, 14 Mar 2017 08:29:05 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C08A39D4F2 for ; Tue, 14 Mar 2017 12:29:05 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-69.ams2.redhat.com [10.36.116.69]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2ECT495001866; Tue, 14 Mar 2017 08:29:05 -0400 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 47A9380959; Tue, 14 Mar 2017 13:29:03 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 14 Mar 2017 13:29:00 +0100 Message-Id: <1489494540-15745-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 14 Mar 2017 12:29:05 +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] cirrus: add option to disable blitter 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: Gerd Hoffmann 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" Ok, we have this beast in the cirrus code which is not used at all by modern guests, except when you try to find security holes in qemu. So, add an option to disable blitter altogether. Guests released within the last ten years should not show any rendering issues if you turn off blitter support. There are no known bugs in the cirrus blitter code. But in the past we hoped a few times already that we've finally nailed the last issue. So having some easy way to mitigate in case yet another blitter issue shows up certainly makes me sleep a bit better at night. For completeness: The by far better way to mitigate is to switch away from cirrus and use stdvga instead. Or something more modern like virtio-vga in case your guest has support for it. Signed-off-by: Gerd Hoffmann --- hw/display/cirrus_vga.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c index efbd2c1..38fda55 100644 --- a/hw/display/cirrus_vga.c +++ b/hw/display/cirrus_vga.c @@ -205,6 +205,7 @@ typedef struct CirrusVGAState { uint32_t cirrus_bank_base[2]; uint32_t cirrus_bank_limit[2]; uint8_t cirrus_hidden_palette[48]; + bool enable_blitter; int cirrus_blt_pixelwidth; int cirrus_blt_width; int cirrus_blt_height; @@ -966,6 +967,10 @@ static void cirrus_bitblt_start(CirrusVGAState * s) { uint8_t blt_rop; =20 + if (!s->enable_blitter) { + goto bitblt_ignore; + } + s->vga.gr[0x31] |=3D CIRRUS_BLT_BUSY; =20 s->cirrus_blt_width =3D (s->vga.gr[0x20] | (s->vga.gr[0x21] << 8)) + 1; @@ -3030,6 +3035,8 @@ static void isa_cirrus_vga_realizefn(DeviceState *dev= , Error **errp) static Property isa_cirrus_vga_properties[] =3D { DEFINE_PROP_UINT32("vgamem_mb", struct ISACirrusVGAState, cirrus_vga.vga.vram_size_mb, 4), + DEFINE_PROP_BOOL("blitter", struct ISACirrusVGAState, + cirrus_vga.enable_blitter, true), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -3099,6 +3106,8 @@ static void pci_cirrus_vga_realize(PCIDevice *dev, Er= ror **errp) static Property pci_vga_cirrus_properties[] =3D { DEFINE_PROP_UINT32("vgamem_mb", struct PCICirrusVGAState, cirrus_vga.vga.vram_size_mb, 4), + DEFINE_PROP_BOOL("blitter", struct PCICirrusVGAState, + cirrus_vga.enable_blitter, true), DEFINE_PROP_END_OF_LIST(), }; =20 --=20 1.8.3.1