9ae3a8
From 04b0eed67c2564cf9c10a62f57ed606f627c9317 Mon Sep 17 00:00:00 2001
9ae3a8
From: Gerd Hoffmann <kraxel@redhat.com>
9ae3a8
Date: Mon, 27 Mar 2017 10:01:18 +0200
9ae3a8
Subject: [PATCH 3/7] cirrus: add option to disable blitter
9ae3a8
9ae3a8
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
9ae3a8
Message-id: <1490608882-10242-4-git-send-email-kraxel@redhat.com>
9ae3a8
Patchwork-id: 74551
9ae3a8
O-Subject: [RHEL-7.4 qemu-kvm PATCH v2 3/7] cirrus: add option to disable blitter
9ae3a8
Bugzilla: 1430060
9ae3a8
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
9ae3a8
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
9ae3a8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
9ae3a8
Ok, we have this beast in the cirrus code which is not used at all by
9ae3a8
modern guests, except when you try to find security holes in qemu.  So,
9ae3a8
add an option to disable blitter altogether.  Guests released within
9ae3a8
the last ten years should not show any rendering issues if you turn off
9ae3a8
blitter support.
9ae3a8
9ae3a8
There are no known bugs in the cirrus blitter code.  But in the past we
9ae3a8
hoped a few times already that we've finally nailed the last issue.  So
9ae3a8
having some easy way to mitigate in case yet another blitter issue shows
9ae3a8
up certainly makes me sleep a bit better at night.
9ae3a8
9ae3a8
For completeness:  The by far better way to mitigate is to switch away
9ae3a8
from cirrus and use stdvga instead.  Or something more modern like
9ae3a8
virtio-vga in case your guest has support for it.
9ae3a8
9ae3a8
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9ae3a8
Message-id: 1489494540-15745-1-git-send-email-kraxel@redhat.com
9ae3a8
(cherry picked from commit 827bd5172641f2a360ff9a3bad57bcf82e7f03f0)
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
9ae3a8
Conflicts:
9ae3a8
	hw/display/cirrus_vga.c
9ae3a8
---
9ae3a8
 hw/display/cirrus_vga.c | 9 +++++++++
9ae3a8
 1 file changed, 9 insertions(+)
9ae3a8
9ae3a8
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
9ae3a8
index 83cef70..86b4c8b 100644
9ae3a8
--- a/hw/display/cirrus_vga.c
9ae3a8
+++ b/hw/display/cirrus_vga.c
9ae3a8
@@ -203,6 +203,7 @@ typedef struct CirrusVGAState {
9ae3a8
     uint8_t cirrus_hidden_palette[48];
9ae3a8
     uint32_t hw_cursor_x;
9ae3a8
     uint32_t hw_cursor_y;
9ae3a8
+    bool enable_blitter;
9ae3a8
     int cirrus_blt_pixelwidth;
9ae3a8
     int cirrus_blt_width;
9ae3a8
     int cirrus_blt_height;
9ae3a8
@@ -954,6 +955,10 @@ static void cirrus_bitblt_start(CirrusVGAState * s)
9ae3a8
 {
9ae3a8
     uint8_t blt_rop;
9ae3a8
 
9ae3a8
+    if (!s->enable_blitter) {
9ae3a8
+        goto bitblt_ignore;
9ae3a8
+    }
9ae3a8
+
9ae3a8
     s->vga.gr[0x31] |= CIRRUS_BLT_BUSY;
9ae3a8
 
9ae3a8
     s->cirrus_blt_width = (s->vga.gr[0x20] | (s->vga.gr[0x21] << 8)) + 1;
9ae3a8
@@ -2995,6 +3000,8 @@ static int vga_initfn(ISADevice *dev)
9ae3a8
 static Property isa_cirrus_vga_properties[] = {
9ae3a8
     DEFINE_PROP_UINT32("vgamem_mb", struct ISACirrusVGAState,
9ae3a8
                        cirrus_vga.vga.vram_size_mb, 16),
9ae3a8
+    DEFINE_PROP_BOOL("blitter", struct ISACirrusVGAState,
9ae3a8
+                       cirrus_vga.enable_blitter, true),
9ae3a8
     DEFINE_PROP_END_OF_LIST(),
9ae3a8
 };
9ae3a8
 
9ae3a8
@@ -3060,6 +3067,8 @@ static int pci_cirrus_vga_initfn(PCIDevice *dev)
9ae3a8
 static Property pci_vga_cirrus_properties[] = {
9ae3a8
     DEFINE_PROP_UINT32("vgamem_mb", struct PCICirrusVGAState,
9ae3a8
                        cirrus_vga.vga.vram_size_mb, 16),
9ae3a8
+    DEFINE_PROP_BOOL("blitter", struct PCICirrusVGAState,
9ae3a8
+                     cirrus_vga.enable_blitter, true),
9ae3a8
     DEFINE_PROP_END_OF_LIST(),
9ae3a8
 };
9ae3a8
 
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8