qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/2] Make sure to enable dirty tracking of VBE vram mapping
@ 2009-06-08 21:48 Anthony Liguori
  2009-06-08 21:48 ` [Qemu-devel] [PATCH 2/2] Make sure to enable dirty log tracking for VMware VGA Anthony Liguori
  0 siblings, 1 reply; 8+ messages in thread
From: Anthony Liguori @ 2009-06-08 21:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori, kvm

Apparently, VBE maps the VGA vram to a fixed physical location.  KVM requires
that all mappings of the VGA vram have dirty tracking enabled on them.  Any
access to the VGA vram through the VBE mapping currently fails to result in
dirty page tracking updates causing a black screen.

This is the true root cause of VMware VGA not working correctly under KVM and
likely also an issue with some of the std-vga black screen issues too.

Cirrus does not enable VBE so it would not be a problem when using Cirrus.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 hw/vga.c        |   35 +++++++++++++++++++++++++----------
 hw/vga_int.h    |    5 ++++-
 hw/vmware_vga.c |    7 +------
 3 files changed, 30 insertions(+), 17 deletions(-)

diff --git a/hw/vga.c b/hw/vga.c
index 013ff10..cb4b750 100644
--- a/hw/vga.c
+++ b/hw/vga.c
@@ -1577,6 +1577,13 @@ static void vga_sync_dirty_bitmap(VGAState *s)
         cpu_physical_sync_dirty_bitmap(isa_mem_base + 0xa0000, 0xa8000);
         cpu_physical_sync_dirty_bitmap(isa_mem_base + 0xa8000, 0xb0000);
     }
+
+#ifdef CONFIG_BOCHS_VBE
+    if (s->vbe_mapped) {
+        cpu_physical_sync_dirty_bitmap(VBE_DISPI_LFB_PHYSICAL_ADDRESS,
+                                       VBE_DISPI_LFB_PHYSICAL_ADDRESS + s->vram_size);
+    }
+#endif
 }
 
 /*
@@ -2233,6 +2240,12 @@ void vga_dirty_log_start(VGAState *s)
         kvm_log_start(isa_mem_base + 0xa0000, 0x8000);
         kvm_log_start(isa_mem_base + 0xa8000, 0x8000);
     }
+
+#ifdef CONFIG_BOCHS_VBE
+    if (kvm_enabled() && s->vbe_mapped) {
+        kvm_log_start(VBE_DISPI_LFB_PHYSICAL_ADDRESS, s->vram_size);
+    }
+#endif
 }
 
 static void vga_map(PCIDevice *pci_dev, int region_num,
@@ -2428,6 +2441,16 @@ static void vga_mm_init(VGAState *s, target_phys_addr_t vram_base,
     qemu_register_coalesced_mmio(vram_base + 0x000a0000, 0x20000);
 }
 
+void vga_init_vbe(VGAState *s)
+{
+#ifdef CONFIG_BOCHS_VBE
+    /* XXX: use optimized standard vga accesses */
+    cpu_register_physical_memory(VBE_DISPI_LFB_PHYSICAL_ADDRESS,
+                                 VGA_RAM_SIZE, s->vram_offset);
+    s->vbe_mapped = 1;
+#endif
+}
+
 int isa_vga_init(void)
 {
     VGAState *s;
@@ -2439,12 +2462,8 @@ int isa_vga_init(void)
 
     s->ds = graphic_console_init(s->update, s->invalidate,
                                  s->screen_dump, s->text_update, s);
+    vga_init_vbe(s);
 
-#ifdef CONFIG_BOCHS_VBE
-    /* XXX: use optimized standard vga accesses */
-    cpu_register_physical_memory(VBE_DISPI_LFB_PHYSICAL_ADDRESS,
-                                 VGA_RAM_SIZE, s->vram_offset);
-#endif
     return 0;
 }
 
@@ -2460,12 +2479,8 @@ int isa_vga_mm_init(target_phys_addr_t vram_base,
 
     s->ds = graphic_console_init(s->update, s->invalidate,
                                  s->screen_dump, s->text_update, s);
+    vga_init_vbe(s);
 
-#ifdef CONFIG_BOCHS_VBE
-    /* XXX: use optimized standard vga accesses */
-    cpu_register_physical_memory(VBE_DISPI_LFB_PHYSICAL_ADDRESS,
-                                 VGA_RAM_SIZE, s->vram_offset);
-#endif
     return 0;
 }
 
diff --git a/hw/vga_int.h b/hw/vga_int.h
index 631b1b0..0b41254 100644
--- a/hw/vga_int.h
+++ b/hw/vga_int.h
@@ -68,7 +68,8 @@
     uint16_t vbe_regs[VBE_DISPI_INDEX_NB];      \
     uint32_t vbe_start_addr;                    \
     uint32_t vbe_line_offset;                   \
-    uint32_t vbe_bank_mask;
+    uint32_t vbe_bank_mask;                     \
+    int vbe_mapped;
 
 #else
 
@@ -193,6 +194,8 @@ void vga_common_init(VGAState *s, int vga_ram_size);
 void vga_init(VGAState *s);
 void vga_reset(void *s);
 
+void vga_init_vbe(VGAState *s);
+
 void vga_dirty_log_start(VGAState *s);
 
 uint32_t vga_mem_readb(void *opaque, target_phys_addr_t addr);
diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c
index 79da1ff..bb17698 100644
--- a/hw/vmware_vga.c
+++ b/hw/vmware_vga.c
@@ -1141,12 +1141,7 @@ static void vmsvga_init(struct vmsvga_state_s *s, int vga_ram_size)
                                      vmsvga_invalidate_display,
                                      vmsvga_screen_dump,
                                      vmsvga_text_update, &s->vga);
-
-#ifdef CONFIG_BOCHS_VBE
-    /* XXX: use optimized standard vga accesses */
-    cpu_register_physical_memory(VBE_DISPI_LFB_PHYSICAL_ADDRESS,
-                                 vga_ram_size, s->vga.vram_offset);
-#endif
+    vga_init_vbe((VGAState *)s);
 }
 
 static void pci_vmsvga_save(QEMUFile *f, void *opaque)
-- 
1.6.2.5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-07-29 18:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-08 21:48 [Qemu-devel] [PATCH 1/2] Make sure to enable dirty tracking of VBE vram mapping Anthony Liguori
2009-06-08 21:48 ` [Qemu-devel] [PATCH 2/2] Make sure to enable dirty log tracking for VMware VGA Anthony Liguori
2009-06-08 21:53   ` [Qemu-devel] " Anthony Liguori
2009-07-29 16:23     ` Jordan Justen
2009-07-29 17:15       ` Anthony Liguori
2009-07-29 17:56         ` Jordan Justen
2009-07-29 18:47           ` Anthony Liguori
     [not found]   ` <loom.20090609T011827-203@post.gmane.org>
2009-06-09  3:37     ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).