From: Avi Kivity <a...@redhat.com> The last qemu.git merge broke vga. Revert the vga changes pending better dirty logging support.
Signed-off-by: Avi Kivity <a...@redhat.com> diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c index 3e67acd..20f17a6 100644 --- a/hw/cirrus_vga.c +++ b/hw/cirrus_vga.c @@ -2619,6 +2619,7 @@ static CPUWriteMemoryFunc *cirrus_linear_bitblt_write[3] = { static void map_linear_vram(CirrusVGAState *s) { + vga_dirty_log_stop((VGAState *)s); if (!s->map_addr && s->lfb_addr && s->lfb_end) { s->map_addr = s->lfb_addr; s->map_end = s->lfb_end; @@ -2631,11 +2632,16 @@ static void map_linear_vram(CirrusVGAState *s) #ifndef TARGET_IA64 s->lfb_vram_mapped = 0; + cpu_register_physical_memory(isa_mem_base + 0xa0000, 0x8000, + (s->vram_offset + s->cirrus_bank_base[0]) | IO_MEM_UNASSIGNED); + cpu_register_physical_memory(isa_mem_base + 0xa8000, 0x8000, + (s->vram_offset + s->cirrus_bank_base[1]) | IO_MEM_UNASSIGNED); if (!(s->cirrus_srcptr != s->cirrus_srcptr_end) && !((s->sr[0x07] & 0x01) == 0) && !((s->gr[0x0B] & 0x14) == 0x14) && !(s->gr[0x0B] & 0x02)) { + vga_dirty_log_stop((VGAState *)s); cpu_register_physical_memory(isa_mem_base + 0xa0000, 0x8000, (s->vram_offset + s->cirrus_bank_base[0]) | IO_MEM_RAM); cpu_register_physical_memory(isa_mem_base + 0xa8000, 0x8000, @@ -2654,11 +2660,14 @@ static void map_linear_vram(CirrusVGAState *s) static void unmap_linear_vram(CirrusVGAState *s) { + vga_dirty_log_stop((VGAState *)s); if (s->map_addr && s->lfb_addr && s->lfb_end) s->map_addr = s->map_end = 0; cpu_register_physical_memory(isa_mem_base + 0xa0000, 0x20000, s->vga_io_memory); + + vga_dirty_log_start((VGAState *)s); } /* Compute the memory access functions */ @@ -3305,6 +3314,8 @@ static void cirrus_pci_lfb_map(PCIDevice *d, int region_num, { CirrusVGAState *s = &((PCICirrusVGAState *)d)->cirrus_vga; + vga_dirty_log_stop((VGAState *)s); + /* XXX: add byte swapping apertures */ cpu_register_physical_memory(addr, s->vram_size, s->cirrus_linear_io_addr); @@ -3336,10 +3347,14 @@ static void pci_cirrus_write_config(PCIDevice *d, PCICirrusVGAState *pvs = container_of(d, PCICirrusVGAState, dev); CirrusVGAState *s = &pvs->cirrus_vga; + vga_dirty_log_stop((VGAState *)s); + pci_default_write_config(d, address, val, len); if (s->map_addr && pvs->dev.io_regions[0].addr == -1) s->map_addr = 0; cirrus_update_memory_access(s); + + vga_dirty_log_start((VGAState *)s); } void pci_cirrus_vga_init(PCIBus *bus, int vga_ram_size) diff --git a/hw/vga.c b/hw/vga.c index 4931b69..9ab6e1a 100644 --- a/hw/vga.c +++ b/hw/vga.c @@ -1280,6 +1280,8 @@ static void vga_draw_text(VGAState *s, int full_update) vga_draw_glyph8_func *vga_draw_glyph8; vga_draw_glyph9_func *vga_draw_glyph9; + vga_dirty_log_stop(s); + /* compute font data address (in plane 2) */ v = s->sr[3]; offset = (((v >> 4) & 1) | ((v << 1) & 6)) * 8192 * 4 + 2; @@ -1578,6 +1580,7 @@ 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); } + vga_dirty_log_start(s); } /* @@ -1809,6 +1812,7 @@ static void vga_draw_blank(VGAState *s, int full_update) return; if (s->last_scr_width <= 0 || s->last_scr_height <= 0) return; + vga_dirty_log_stop(s); s->rgb_to_pixel = rgb_to_pixel_dup_table[get_depth_index(s->ds)]; @@ -2258,6 +2262,18 @@ void vga_dirty_log_start(VGAState *s) } } +void vga_dirty_log_stop(VGAState *s) +{ + if (kvm_enabled() && s->map_addr && s1) + kvm_log_stop(s->map_addr, s->map_end - s->map_addr); + + if (kvm_enabled() && s->lfb_vram_mapped && s2) { + kvm_log_stop(isa_mem_base + 0xa0000, 0x8000); + kvm_log_stop(isa_mem_base + 0xa8000, 0x8000); + } + s1 = s2 = 0; +} + static void vga_map(PCIDevice *pci_dev, int region_num, uint32_t addr, uint32_t size, int type) { @@ -2267,10 +2283,12 @@ static void vga_map(PCIDevice *pci_dev, int region_num, cpu_register_physical_memory(addr, s->bios_size, s->bios_offset); } else { cpu_register_physical_memory(addr, s->vram_size, s->vram_offset); - s->map_addr = addr; - s->map_end = addr + s->vram_size; - vga_dirty_log_start(s); } + + s->map_addr = addr; + s->map_end = addr + VGA_RAM_SIZE; + + vga_dirty_log_start(s); } void vga_common_init(VGAState *s, int vga_ram_size) @@ -2498,9 +2516,11 @@ static void pci_vga_write_config(PCIDevice *d, PCIVGAState *pvs = container_of(d, PCIVGAState, dev); VGAState *s = &pvs->vga_state; + vga_dirty_log_stop(s); pci_default_write_config(d, address, val, len); if (s->map_addr && pvs->dev.io_regions[0].addr == -1) s->map_addr = 0; + vga_dirty_log_start(s); } int pci_vga_init(PCIBus *bus, int vga_ram_size, diff --git a/hw/vga_int.h b/hw/vga_int.h index f7f3fac..40a72e8 100644 --- a/hw/vga_int.h +++ b/hw/vga_int.h @@ -196,6 +196,7 @@ void vga_init(VGAState *s); void vga_reset(void *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); -- To unsubscribe from this list: send the line "unsubscribe kvm-commits" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html