From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54127) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEzCj-0003fJ-Pz for qemu-devel@nongnu.org; Tue, 14 Jul 2015 08:20:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZEzCf-0001Ya-8c for qemu-devel@nongnu.org; Tue, 14 Jul 2015 08:20:57 -0400 Received: from mail-wg0-x22c.google.com ([2a00:1450:400c:c00::22c]:33723) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEzCe-0001XQ-NA for qemu-devel@nongnu.org; Tue, 14 Jul 2015 08:20:53 -0400 Received: by wgmn9 with SMTP id n9so7411455wgm.0 for ; Tue, 14 Jul 2015 05:20:51 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 14 Jul 2015 14:20:47 +0200 Message-Id: <1436876447-4206-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH RFC for-2.4] hw: set DIRTY_MEMORY_VGA on RAM that can be used for the framebuffer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org The pxa2xx_lcd, omap_lcdc, pl110 and milkymist-vgafb devices use framebuffer.c to render an image from a shared memory framebuffer. With KVM, DIRTY_MEMORY_VGA always had to be enabled explicitly on RAM memory regions that can be used for the framebuffer, and the 2.4 changes to dirty bitmap handling made that mandatory for TCG as well. If the board does not set DIRTY_MEMORY_VGA, framebuffer.c detects this (commit d55d420, framebuffer: check memory_region_is_logging, 2015-03-23) and always invalidates the screen; this is inefficient, to the point that blocking X11 calls on slow network connections can prevent the guest from making progress. Fix this by setting the flag on the boards that use the aforementioned devices. Reported-by: Peter Maydell Signed-off-by: Paolo Bonzini --- This is a layering violation, but it's the simplest patch that works. I also have worked on Peter's suggestion that framebuffer.c could manage DIRTY_MEMORY_VGA. The (prototype) patch however is a bit large, so perhaps it's better to have this in 2.4 instead. Posting this one as RFC for now. hw/arm/integratorcp.c | 1 + hw/arm/omap1.c | 2 ++ hw/arm/pxa2xx.c | 4 ++++ hw/arm/versatilepb.c | 1 + hw/display/framebuffer.c | 5 ++++- hw/lm32/milkymist.c | 1 + 6 files changed, 13 insertions(+), 1 deletion(-) diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c index 0fbbf99..30abb8c 100644 --- a/hw/arm/integratorcp.c +++ b/hw/arm/integratorcp.c @@ -569,6 +569,7 @@ static void integratorcp_init(MachineState *machine) memory_region_allocate_system_memory(ram, NULL, "integrator.ram", ram_size); + memory_region_set_log(ram, true, DIRTY_MEMORY_VGA); /* ??? On a real system the first 1Mb is mapped as SSRAM or boot flash. */ /* ??? RAM should repeat to fill physical memory space. */ /* SDRAM at address zero*/ diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c index de2b289..164b9bf 100644 --- a/hw/arm/omap1.c +++ b/hw/arm/omap1.c @@ -3880,9 +3880,11 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory, /* Memory-mapped stuff */ memory_region_allocate_system_memory(&s->emiff_ram, NULL, "omap1.dram", s->sdram_size); + memory_region_set_log(&s->emiff_ram, true, DIRTY_MEMORY_VGA); memory_region_add_subregion(system_memory, OMAP_EMIFF_BASE, &s->emiff_ram); memory_region_init_ram(&s->imif_ram, NULL, "omap1.sram", s->sram_size, &error_abort); + memory_region_set_log(&s->imif_ram, true, DIRTY_MEMORY_VGA); vmstate_register_ram_global(&s->imif_ram); memory_region_add_subregion(system_memory, OMAP_IMIF_BASE, &s->imif_ram); diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c index ec353f7..91401d7 100644 --- a/hw/arm/pxa2xx.c +++ b/hw/arm/pxa2xx.c @@ -2080,10 +2080,12 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space, /* SDRAM & Internal Memory Storage */ memory_region_init_ram(&s->sdram, NULL, "pxa270.sdram", sdram_size, &error_abort); + memory_region_set_log(&s->sdram, true, DIRTY_MEMORY_VGA); vmstate_register_ram_global(&s->sdram); memory_region_add_subregion(address_space, PXA2XX_SDRAM_BASE, &s->sdram); memory_region_init_ram(&s->internal, NULL, "pxa270.internal", 0x40000, &error_abort); + memory_region_set_log(&s->sdram, true, DIRTY_MEMORY_VGA); vmstate_register_ram_global(&s->internal); memory_region_add_subregion(address_space, PXA2XX_INTERNAL_BASE, &s->internal); @@ -2214,10 +2216,12 @@ PXA2xxState *pxa255_init(MemoryRegion *address_space, unsigned int sdram_size) /* SDRAM & Internal Memory Storage */ memory_region_init_ram(&s->sdram, NULL, "pxa255.sdram", sdram_size, &error_abort); + memory_region_set_log(&s->sdram, true, DIRTY_MEMORY_VGA); vmstate_register_ram_global(&s->sdram); memory_region_add_subregion(address_space, PXA2XX_SDRAM_BASE, &s->sdram); memory_region_init_ram(&s->internal, NULL, "pxa255.internal", PXA2XX_INTERNAL_SIZE, &error_abort); + memory_region_set_log(&s->sdram, true, DIRTY_MEMORY_VGA); vmstate_register_ram_global(&s->internal); memory_region_add_subregion(address_space, PXA2XX_INTERNAL_BASE, &s->internal); diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c index 6c69f4e..c7fbe4d 100644 --- a/hw/arm/versatilepb.c +++ b/hw/arm/versatilepb.c @@ -228,6 +228,7 @@ static void versatile_init(MachineState *machine, int board_id) memory_region_allocate_system_memory(ram, NULL, "versatile.ram", machine->ram_size); + memory_region_set_log(ram, true, DIRTY_MEMORY_VGA); /* ??? RAM should repeat to fill physical memory space. */ /* SDRAM at address zero. */ memory_region_add_subregion(sysmem, 0, ram); diff --git a/hw/display/framebuffer.c b/hw/display/framebuffer.c index 2cabced..a878ceb 100644 --- a/hw/display/framebuffer.c +++ b/hw/display/framebuffer.c @@ -21,7 +21,10 @@ #include "ui/console.h" #include "framebuffer.h" -/* Render an image from a shared memory framebuffer. */ +/* Render an image from a shared memory framebuffer. For efficiency, + * the board should enable DIRTY_MEMORY_VGA on RAM memory regions that + * can be used for the framebuffer. + */ void framebuffer_update_display( DisplaySurface *ds, diff --git a/hw/lm32/milkymist.c b/hw/lm32/milkymist.c index e755f5b..8e8de66 100644 --- a/hw/lm32/milkymist.c +++ b/hw/lm32/milkymist.c @@ -120,6 +120,7 @@ milkymist_init(MachineState *machine) memory_region_allocate_system_memory(phys_sdram, NULL, "milkymist.sdram", sdram_size); + memory_region_set_log(phys_sdram, true, DIRTY_MEMORY_VGA); memory_region_add_subregion(address_space_mem, sdram_base, phys_sdram); dinfo = drive_get(IF_PFLASH, 0, 0); -- 2.4.3