Skip to contentSkip to conversation

[5793] vga optimization (Glauber Costa)

Qemu-devel Anthony Liguori 1 participant 1 message Nov 24, 2008

lore
Share & tools
lore
#0 lore raw

Revision: 5793

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5793
Author:   aliguori
Date:     2008-11-24 20:21:41 +0000 (Mon, 24 Nov 2008)

Log Message:
-----------
vga optimization (Glauber Costa)

Hypervisors like KVM perform badly while doing mmio on a loop, because it'll generate an exit on each access. This is the case with VGA, which results in very bad performance.

In this patch, we map the linear frame buffer as RAM, make sure it has dirty region tracking enabled, and then just let the region to be written.

Cleanups suggestions by:
Stefano Stabellini <[email protected]>

Modified Paths:
--------------
trunk/cpu-all.h
trunk/exec.c
trunk/hw/cirrus_vga.c
trunk/hw/vga.c
trunk/hw/vga_int.h

Modified: trunk/cpu-all.h
===================================================================

cpu-all.h +2 -0
@@ -948,6 +948,8 @@
 
 int cpu_physical_memory_get_dirty_tracking(void);
 
+void cpu_physical_sync_dirty_bitmap(target_phys_addr_t start_addr, target_phys_addr_t end_addr);
+
 void dump_exec_info(FILE *f,
                     int (*cpu_fprintf)(FILE *f, const char *fmt, ...));
 

Modified: trunk/exec.c
===================================================================

exec.c +6 -0
@@ -1887,6 +1887,12 @@
     return in_migration;
 }
 
+void cpu_physical_sync_dirty_bitmap(target_phys_addr_t start_addr, target_phys_addr_t end_addr)
+{
+    if (kvm_enabled())
+        kvm_physical_sync_dirty_bitmap(start_addr, end_addr);
+}
+
 static inline void tlb_update_dirty(CPUTLBEntry *tlb_entry)
 {
     ram_addr_t ram_addr;

Modified: trunk/hw/cirrus_vga.c
===================================================================

hw/cirrus_vga.c +65 -0

118 lines not on this page · raw message

Modified: trunk/hw/vga.c
===================================================================

hw/vga.c +47 -0

89 lines not on this page · raw message

Modified: trunk/hw/vga_int.h
===================================================================

hw/vga_int.h +9 -0
@@ -102,6 +102,11 @@
     uint8_t *vram_ptr;                                                  \
     ram_addr_t vram_offset;                                             \
     unsigned int vram_size;                                             \
+    uint32_t lfb_addr;                                                  \
+    uint32_t lfb_end;                                                   \
+    uint32_t map_addr;                                                  \
+    uint32_t map_end;                                                   \
+    uint32_t lfb_vram_mapped; /* whether 0xa0000 is mapped as ram */    \
     unsigned long bios_offset;                                          \
     unsigned int bios_size;                                             \
     target_phys_addr_t base_ctrl;                                       \
@@ -189,6 +194,10 @@
 void vga_common_init(VGAState *s, DisplayState *ds, uint8_t *vga_ram_base,
                      ram_addr_t vga_ram_offset, int vga_ram_size);
 void vga_init(VGAState *s);
+
+void vga_dirty_log_start(VGAState *s);
+void vga_dirty_log_stop(VGAState *s);
+
 uint32_t vga_mem_readb(void *opaque, target_phys_addr_t addr);
 void vga_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val);
 void vga_invalidate_scanlines(VGAState *s, int y1, int y2);