提交 8294a64d 编写于 作者: A Avi Kivity 提交者: Anthony Liguori

vga: fix vram double-mapping with -vga std and -M pc-0.12

With pc-0.12, we map the video RAM both through the PCI BAR (the guest does
this) and through a fixed mapping at 0xe0000000.  The memory API doesn't allow
this double map, and aborts.

Fix by using an alias.
Reported-by: NMichael Tokarev <mjt@tls.msk.ru>
Signed-off-by: NAvi Kivity <avi@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 1c4ad9d2
...@@ -2357,10 +2357,15 @@ void vga_init(VGACommonState *s, MemoryRegion *address_space, ...@@ -2357,10 +2357,15 @@ void vga_init(VGACommonState *s, MemoryRegion *address_space,
void vga_init_vbe(VGACommonState *s, MemoryRegion *system_memory) void vga_init_vbe(VGACommonState *s, MemoryRegion *system_memory)
{ {
#ifdef CONFIG_BOCHS_VBE #ifdef CONFIG_BOCHS_VBE
/* With pc-0.12 and below we map both the PCI BAR and the fixed VBE region,
* so use an alias to avoid double-mapping the same region.
*/
memory_region_init_alias(&s->vram_vbe, "vram.vbe",
&s->vram, 0, memory_region_size(&s->vram));
/* XXX: use optimized standard vga accesses */ /* XXX: use optimized standard vga accesses */
memory_region_add_subregion(system_memory, memory_region_add_subregion(system_memory,
VBE_DISPI_LFB_PHYSICAL_ADDRESS, VBE_DISPI_LFB_PHYSICAL_ADDRESS,
&s->vram); &s->vram_vbe);
s->vbe_mapped = 1; s->vbe_mapped = 1;
#endif #endif
} }
......
...@@ -105,6 +105,7 @@ typedef struct VGACommonState { ...@@ -105,6 +105,7 @@ typedef struct VGACommonState {
MemoryRegion *legacy_address_space; MemoryRegion *legacy_address_space;
uint8_t *vram_ptr; uint8_t *vram_ptr;
MemoryRegion vram; MemoryRegion vram;
MemoryRegion vram_vbe;
uint32_t vram_size; uint32_t vram_size;
uint32_t latch; uint32_t latch;
MemoryRegion *chain4_alias; MemoryRegion *chain4_alias;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册