From: Anthony Liguori <aliguori@us.ibm.com> To: qemu-devel@nongnu.org Cc: kvm@vger.kernel.org, Anthony Liguori <aliguori@us.ibm.com> Subject: [PATCH 1/2] Make sure to enable dirty tracking of VBE vram mapping Date: Mon, 8 Jun 2009 16:48:02 -0500 [thread overview] Message-ID: <1244497683-14391-1-git-send-email-aliguori@us.ibm.com> (raw) 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
WARNING: multiple messages have this Message-ID (diff)
From: Anthony Liguori <aliguori@us.ibm.com> To: qemu-devel@nongnu.org Cc: Anthony Liguori <aliguori@us.ibm.com>, kvm@vger.kernel.org Subject: [Qemu-devel] [PATCH 1/2] Make sure to enable dirty tracking of VBE vram mapping Date: Mon, 8 Jun 2009 16:48:02 -0500 [thread overview] Message-ID: <1244497683-14391-1-git-send-email-aliguori@us.ibm.com> (raw) 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
next reply other threads:[~2009-06-08 21:48 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2009-06-08 21:48 Anthony Liguori [this message] 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 ` [PATCH 2/2] Make sure to enable dirty log tracking for VMware VGA Anthony Liguori 2009-06-08 21:48 ` [Qemu-devel] " Anthony Liguori 2009-06-08 21:53 ` 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 2009-06-09 1:29 ` Nolan 2009-06-09 3:37 ` Avi Kivity 2009-06-09 3:37 ` [Qemu-devel] " Avi Kivity
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1244497683-14391-1-git-send-email-aliguori@us.ibm.com \ --to=aliguori@us.ibm.com \ --cc=kvm@vger.kernel.org \ --cc=qemu-devel@nongnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.