yeahuh / rpms / qemu-kvm

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