From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MDmhP-00017R-FC for qemu-devel@nongnu.org; Mon, 08 Jun 2009 17:48:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MDmhM-00016n-86 for qemu-devel@nongnu.org; Mon, 08 Jun 2009 17:48:11 -0400 Received: from [199.232.76.173] (port=51361 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MDmhL-00016j-Pd for qemu-devel@nongnu.org; Mon, 08 Jun 2009 17:48:07 -0400 Received: from e32.co.us.ibm.com ([32.97.110.150]:57040) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MDmhL-0004hh-AS for qemu-devel@nongnu.org; Mon, 08 Jun 2009 17:48:07 -0400 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by e32.co.us.ibm.com (8.13.1/8.13.1) with ESMTP id n58LiOON004775 for ; Mon, 8 Jun 2009 15:44:24 -0600 Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n58Lm47v224588 for ; Mon, 8 Jun 2009 15:48:04 -0600 Received: from d03av03.boulder.ibm.com (loopback [127.0.0.1]) by d03av03.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n58Lm4WF007486 for ; Mon, 8 Jun 2009 15:48:04 -0600 From: Anthony Liguori Date: Mon, 8 Jun 2009 16:48:02 -0500 Message-Id: <1244497683-14391-1-git-send-email-aliguori@us.ibm.com> Subject: [Qemu-devel] [PATCH 1/2] Make sure to enable dirty tracking of VBE vram mapping List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori , kvm@vger.kernel.org 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 --- 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