From 1787e855bc0ac32296ffe5ed65e08903e9a99b7c Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Thu, 24 Nov 2011 16:21:42 +0100
Subject: [PATCH 06/11] cirrus: fix bank unmap

RH-Author: Gerd Hoffmann <kraxel@redhat.com>
Message-id: <1322151702-28720-1-git-send-email-kraxel@redhat.com>
Patchwork-id: 35436
O-Subject: [RHEL-6.3 qemu-kvm PATCH] cirrus: fix bank unmap
Bugzilla: 594654
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>

Cirrus can map portions of the lfb into the vga window at 0xa0000.  When
unmapping those vga.lfb_vram_mapped must be cleared to make sure the vga
dirty logging logic does the RightThing[TM].  map_linear_vram sets or
clears clears it correctly.  unmap_linear_vram doesn't.  Add it.

Found by autotest iofuzz.

bugzilla: 594654 - Random read/write /dev/port [vga] caused 'invalid
                   parameters' error
upstream: not needed, avi's memory api rewrite fixed it there.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/cirrus_vga.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
 hw/cirrus_vga.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c
index d04adeb..8846087 100644
--- a/hw/cirrus_vga.c
+++ b/hw/cirrus_vga.c
@@ -2600,6 +2600,7 @@ static void unmap_linear_vram(CirrusVGAState *s)
          cpu_register_physical_memory(s->vga.lfb_addr, s->vga.vram_size,
                                       s->cirrus_linear_io_addr);
     }
+    s->vga.lfb_vram_mapped = 0;
     cpu_register_physical_memory(isa_mem_base + 0xa0000, 0x20000,
                                  s->vga.vga_io_memory);
 
-- 
1.7.7.3

