Commit ba7349cd5d69cd5f066b7e8287f85481d97d1ee4

Authored by aliguori
1 parent ee50c6bc

cirrus: stop dirty logging during remaps (Jan Kiszka)

Cleaned-up port from kvm-userspace: We have to stop any vram logging
while doing remaps. Otherwise the logger gets confused. This reward is
enormously accelerated cirrus vga in kvm mode.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6383 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 28 additions and 6 deletions
hw/cirrus_vga.c
... ... @@ -2620,12 +2620,12 @@ static CPUWriteMemoryFunc *cirrus_linear_bitblt_write[3] = {
2620 2620  
2621 2621 static void map_linear_vram(CirrusVGAState *s)
2622 2622 {
  2623 + vga_dirty_log_stop((VGAState *)s);
2623 2624  
2624 2625 if (!s->map_addr && s->lfb_addr && s->lfb_end) {
2625 2626 s->map_addr = s->lfb_addr;
2626 2627 s->map_end = s->lfb_end;
2627 2628 cpu_register_physical_memory(s->map_addr, s->map_end - s->map_addr, s->vram_offset);
2628   - vga_dirty_log_start((VGAState *)s);
2629 2629 }
2630 2630  
2631 2631 if (!s->map_addr)
... ... @@ -2644,24 +2644,26 @@ static void map_linear_vram(CirrusVGAState *s)
2644 2644 (s->vram_offset + s->cirrus_bank_base[1]) | IO_MEM_RAM);
2645 2645  
2646 2646 s->lfb_vram_mapped = 1;
2647   - vga_dirty_log_start((VGAState *)s);
2648 2647 }
2649 2648 else {
2650 2649 cpu_register_physical_memory(isa_mem_base + 0xa0000, 0x8000, s->vga_io_memory);
2651 2650 cpu_register_physical_memory(isa_mem_base + 0xa8000, 0x8000, s->vga_io_memory);
2652 2651 }
2653 2652  
  2653 + vga_dirty_log_start((VGAState *)s);
2654 2654 }
2655 2655  
2656 2656 static void unmap_linear_vram(CirrusVGAState *s)
2657 2657 {
2658   - if (s->map_addr && s->lfb_addr && s->lfb_end) {
2659   - vga_dirty_log_stop((VGAState *)s);
  2658 + vga_dirty_log_stop((VGAState *)s);
  2659 +
  2660 + if (s->map_addr && s->lfb_addr && s->lfb_end)
2660 2661 s->map_addr = s->map_end = 0;
2661   - }
2662 2662  
2663 2663 cpu_register_physical_memory(isa_mem_base + 0xa0000, 0x20000,
2664 2664 s->vga_io_memory);
  2665 +
  2666 + vga_dirty_log_start((VGAState *)s);
2665 2667 }
2666 2668  
2667 2669 /* Compute the memory access functions */
... ... @@ -3317,6 +3319,8 @@ static void cirrus_pci_lfb_map(PCIDevice *d, int region_num,
3317 3319 {
3318 3320 CirrusVGAState *s = &((PCICirrusVGAState *)d)->cirrus_vga;
3319 3321  
  3322 + vga_dirty_log_stop((VGAState *)s);
  3323 +
3320 3324 /* XXX: add byte swapping apertures */
3321 3325 cpu_register_physical_memory(addr, s->vram_size,
3322 3326 s->cirrus_linear_io_addr);
... ... @@ -3329,6 +3333,8 @@ static void cirrus_pci_lfb_map(PCIDevice *d, int region_num,
3329 3333 /* account for overflow */
3330 3334 if (s->lfb_end < addr + VGA_RAM_SIZE)
3331 3335 s->lfb_end = addr + VGA_RAM_SIZE;
  3336 +
  3337 + vga_dirty_log_start((VGAState *)s);
3332 3338 }
3333 3339  
3334 3340 static void cirrus_pci_mmio_map(PCIDevice *d, int region_num,
... ... @@ -3340,6 +3346,22 @@ static void cirrus_pci_mmio_map(PCIDevice *d, int region_num,
3340 3346 s->cirrus_mmio_io_addr);
3341 3347 }
3342 3348  
  3349 +static void pci_cirrus_write_config(PCIDevice *d,
  3350 + uint32_t address, uint32_t val, int len)
  3351 +{
  3352 + PCICirrusVGAState *pvs = container_of(d, PCICirrusVGAState, dev);
  3353 + CirrusVGAState *s = &pvs->cirrus_vga;
  3354 +
  3355 + vga_dirty_log_stop((VGAState *)s);
  3356 +
  3357 + pci_default_write_config(d, address, val, len);
  3358 + if (s->map_addr && pvs->dev.io_regions[0].addr == -1)
  3359 + s->map_addr = 0;
  3360 + cirrus_update_memory_access(s);
  3361 +
  3362 + vga_dirty_log_start((VGAState *)s);
  3363 +}
  3364 +
3343 3365 void pci_cirrus_vga_init(PCIBus *bus, uint8_t *vga_ram_base,
3344 3366 ram_addr_t vga_ram_offset, int vga_ram_size)
3345 3367 {
... ... @@ -3353,7 +3375,7 @@ void pci_cirrus_vga_init(PCIBus *bus, uint8_t *vga_ram_base,
3353 3375 /* setup PCI configuration registers */
3354 3376 d = (PCICirrusVGAState *)pci_register_device(bus, "Cirrus VGA",
3355 3377 sizeof(PCICirrusVGAState),
3356   - -1, NULL, NULL);
  3378 + -1, NULL, pci_cirrus_write_config);
3357 3379 pci_conf = d->dev.config;
3358 3380 pci_conf[0x00] = (uint8_t) (PCI_VENDOR_CIRRUS & 0xff);
3359 3381 pci_conf[0x01] = (uint8_t) (PCI_VENDOR_CIRRUS >> 8);
... ...