From nobody Mon Feb 9 17:59:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1518526401691998.8591281742873; Tue, 13 Feb 2018 04:53:21 -0800 (PST) Received: from localhost ([::1]:53635 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ela5I-0005w5-HE for importer@patchew.org; Tue, 13 Feb 2018 07:53:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42194) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elZI3-0004hF-Tl for qemu-devel@nongnu.org; Tue, 13 Feb 2018 07:02:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1elZI0-0007tr-Pt for qemu-devel@nongnu.org; Tue, 13 Feb 2018 07:02:27 -0500 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:33691) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1elZI0-0007tW-G9 for qemu-devel@nongnu.org; Tue, 13 Feb 2018 07:02:24 -0500 Received: by mail-wr0-x244.google.com with SMTP id s5so18383028wra.0 for ; Tue, 13 Feb 2018 04:02:24 -0800 (PST) Received: from 640k.lan ([82.84.102.245]) by smtp.gmail.com with ESMTPSA id f9sm6870298wmf.12.2018.02.13.04.02.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Feb 2018 04:02:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=OC2DmAUUIhE4h/+C+zO+3FOYrGJqeYTnKg2S903QCqE=; b=bCNuV/1VTL7nehOmUSZYdH+bC8K4l1Nna6z6RZY55XmyLmOXsQQXt/f+w2MC+6/YHQ yfcKe0T5QOM7cOH9p6r7T7HTu0dc/DdFewRojDXvJ1jLPRnc7PS/laHjDzoM9nszUmh9 uGDC6iWtJO1ay8qDlsTxt/6HulZGP0HCCCO56YOGJcZDkQOB2rdAnr+AsgAA5p6MlvpG VwQuVb7icdoqowZ7gAxa6zlKxNzDIY3YxSF2sOUHP33dcbILKy8Lun8Ge9AC+REbwZqY /tnXZeOPWuvtIWa8fjx0mPIOR8XOgS8C/YVFhA9Z34gpxbTFn8Bu2e0UnmXe2sdXpxGl Kevw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=OC2DmAUUIhE4h/+C+zO+3FOYrGJqeYTnKg2S903QCqE=; b=NX4QLyFcEdlEtnBU1VZE00E4Mk3r4yjWkzf6BwRPH8a98Sa4Kk8/PlZndlIi5l3D7n bBXSnfrFxSzBms1LlLBC3IGavULVtoIZe69fMFRoAckKosGACbAL1BevuUanHtVV3rlr S+a1TDnaeAcIbxYcor5p+wacwBf0nOECstX/zqKTNoY18s6iwWh5Ha/UCMo2u7HIXVW4 a4dfguqdLhe6JsE95hrrGdct+Plmr+XphrAL1TbiZpuL4qFkyX9KnKIHGcqL2AHvAM2t jT5pPU5x946cQ00dxDipXuK1rmfPLIztpVOeOwMS9foJ7D7iypQfzKxfYGXaCYr9/pUE Rf7Q== X-Gm-Message-State: APf1xPAaL/5FoYwQHGAQ+AjMaTakcawUHgM2KidAnPlcYPut4ceRF19b gTs0YaU5XUkWMRmL7HHhZpMk5zCf X-Google-Smtp-Source: AH8x227kkuTLx1a5SpIAI6OQSefWte8kz3XqXghzqeuniuwhaYdSnyhuK2M2xM1BkTkkVd5lhk3HMA== X-Received: by 10.223.184.17 with SMTP id h17mr1127796wrf.9.1518523343065; Tue, 13 Feb 2018 04:02:23 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Feb 2018 13:00:50 +0100 Message-Id: <1518523252-49106-47-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1518523252-49106-1-git-send-email-pbonzini@redhat.com> References: <1518523252-49106-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PULL 46/48] memory: hide memory_region_sync_dirty_bitmap behind DirtyBitmapSnapshot X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Simplify the users of memory_region_snapshot_and_clear_dirty, so that they do not have to call memory_region_sync_dirty_bitmap explicitly. Signed-off-by: Paolo Bonzini --- hw/display/cg3.c | 1 - hw/display/exynos4210_fimd.c | 1 - hw/display/framebuffer.c | 1 - hw/display/g364fb.c | 1 - hw/display/sm501.c | 1 - hw/display/tcx.c | 2 -- hw/display/vga.c | 6 ------ include/exec/memory.h | 11 ----------- memory.c | 39 ++++++++++++++++++++------------------- 9 files changed, 20 insertions(+), 43 deletions(-) diff --git a/hw/display/cg3.c b/hw/display/cg3.c index cafd9f4..6fff485 100644 --- a/hw/display/cg3.c +++ b/hw/display/cg3.c @@ -108,7 +108,6 @@ static void cg3_update_display(void *opaque) data =3D (uint32_t *)surface_data(surface); =20 if (!s->full_update) { - memory_region_sync_dirty_bitmap(&s->vram_mem); snap =3D memory_region_snapshot_and_clear_dirty(&s->vram_mem, 0x0, memory_region_size(&s->vram_= mem), DIRTY_MEMORY_VGA); diff --git a/hw/display/exynos4210_fimd.c b/hw/display/exynos4210_fimd.c index 86e37e9..f011ea5 100644 --- a/hw/display/exynos4210_fimd.c +++ b/hw/display/exynos4210_fimd.c @@ -1289,7 +1289,6 @@ static void exynos4210_fimd_update(void *opaque) scrn_width =3D w->virtpage_width; /* Total width of virtual screen page in bytes */ inc_size =3D scrn_width + w->virtpage_offsize; - memory_region_sync_dirty_bitmap(w->mem_section.mr); host_fb_addr =3D w->host_fb_addr; fb_line_addr =3D w->mem_section.offset_within_region; snap =3D memory_region_snapshot_and_clear_dirty(w->mem_section= .mr, diff --git a/hw/display/framebuffer.c b/hw/display/framebuffer.c index d7310d2..36e3db1 100644 --- a/hw/display/framebuffer.c +++ b/hw/display/framebuffer.c @@ -83,7 +83,6 @@ void framebuffer_update_display( if (!mem) { return; } - memory_region_sync_dirty_bitmap(mem); =20 addr =3D mem_section->offset_within_region; src =3D memory_region_get_ram_ptr(mem) + addr; diff --git a/hw/display/g364fb.c b/hw/display/g364fb.c index 86452de..819f8be 100644 --- a/hw/display/g364fb.c +++ b/hw/display/g364fb.c @@ -246,7 +246,6 @@ static void g364fb_update_display(void *opaque) qemu_console_resize(s->con, s->width, s->height); } =20 - memory_region_sync_dirty_bitmap(&s->mem_vram); if (s->ctla & CTLA_FORCE_BLANK) { g364fb_draw_blank(s); } else if (s->depth =3D=3D 8) { diff --git a/hw/display/sm501.c b/hw/display/sm501.c index 134cbed..f4bb33c 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -1508,7 +1508,6 @@ static void sm501_update_display(void *opaque) } =20 /* draw each line according to conditions */ - memory_region_sync_dirty_bitmap(&s->local_mem_region); snap =3D memory_region_snapshot_and_clear_dirty(&s->local_mem_region, offset, width * height * src_bpp, DIRTY_MEMORY_VGA); for (y =3D 0, offset =3D 0; y < height; y++, offset +=3D width * src_b= pp) { diff --git a/hw/display/tcx.c b/hw/display/tcx.c index daa93e0..b2786ee 100644 --- a/hw/display/tcx.c +++ b/hw/display/tcx.c @@ -236,7 +236,6 @@ static void tcx_update_display(void *opaque) dd =3D surface_stride(surface); ds =3D 1024; =20 - memory_region_sync_dirty_bitmap(&ts->vram_mem); snap =3D memory_region_snapshot_and_clear_dirty(&ts->vram_mem, 0x0, memory_region_size(&ts->vram_= mem), DIRTY_MEMORY_VGA); @@ -292,7 +291,6 @@ static void tcx24_update_display(void *opaque) dd =3D surface_stride(surface); ds =3D 1024; =20 - memory_region_sync_dirty_bitmap(&ts->vram_mem); snap =3D memory_region_snapshot_and_clear_dirty(&ts->vram_mem, 0x0, memory_region_size(&ts->vram_= mem), DIRTY_MEMORY_VGA); diff --git a/hw/display/vga.c b/hw/display/vga.c index 6e78a4e..28f298b 100644 --- a/hw/display/vga.c +++ b/hw/display/vga.c @@ -1444,11 +1444,6 @@ static bool vga_scanline_invalidated(VGACommonState = *s, int y) return s->invalidated_y_table[y >> 5] & (1 << (y & 0x1f)); } =20 -void vga_sync_dirty_bitmap(VGACommonState *s) -{ - memory_region_sync_dirty_bitmap(&s->vram); -} - void vga_dirty_log_start(VGACommonState *s) { memory_region_set_log(&s->vram, true, DIRTY_MEMORY_VGA); @@ -1638,7 +1633,6 @@ static void vga_draw_graphic(VGACommonState *s, int f= ull_update) y1 =3D 0; =20 if (!full_update) { - vga_sync_dirty_bitmap(s); if (s->line_compare < height) { /* split screen mode */ region_start =3D 0; diff --git a/include/exec/memory.h b/include/exec/memory.h index 6779d14..fff9b1d 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -1136,17 +1136,6 @@ bool memory_region_snapshot_get_dirty(MemoryRegion *= mr, hwaddr addr, hwaddr size); =20 /** - * memory_region_sync_dirty_bitmap: Synchronize a region's dirty bitmap wi= th - * any external TLBs (e.g. kvm) - * - * Flushes dirty information from accelerators such as kvm and vhost-net - * and makes it available to users of the memory API. - * - * @mr: the region being flushed. - */ -void memory_region_sync_dirty_bitmap(MemoryRegion *mr); - -/** * memory_region_reset_dirty: Mark a range of pages as clean, for a specif= ied * client. * diff --git a/memory.c b/memory.c index 9e75bb9..8ed809c 100644 --- a/memory.c +++ b/memory.c @@ -1971,25 +1971,7 @@ void memory_region_set_dirty(MemoryRegion *mr, hwadd= r addr, memory_region_get_dirty_log_mask(m= r)); } =20 -DirtyBitmapSnapshot *memory_region_snapshot_and_clear_dirty(MemoryRegion *= mr, - hwaddr addr, - hwaddr size, - unsigned clien= t) -{ - assert(mr->ram_block); - return cpu_physical_memory_snapshot_and_clear_dirty( - memory_region_get_ram_addr(mr) + addr, size, client); -} - -bool memory_region_snapshot_get_dirty(MemoryRegion *mr, DirtyBitmapSnapsho= t *snap, - hwaddr addr, hwaddr size) -{ - assert(mr->ram_block); - return cpu_physical_memory_snapshot_get_dirty(snap, - memory_region_get_ram_addr(mr) + addr, size); -} - -void memory_region_sync_dirty_bitmap(MemoryRegion *mr) +static void memory_region_sync_dirty_bitmap(MemoryRegion *mr) { MemoryListener *listener; AddressSpace *as; @@ -2017,6 +1999,25 @@ void memory_region_sync_dirty_bitmap(MemoryRegion *m= r) } } =20 +DirtyBitmapSnapshot *memory_region_snapshot_and_clear_dirty(MemoryRegion *= mr, + hwaddr addr, + hwaddr size, + unsigned clien= t) +{ + assert(mr->ram_block); + memory_region_sync_dirty_bitmap(mr); + return cpu_physical_memory_snapshot_and_clear_dirty( + memory_region_get_ram_addr(mr) + addr, size, client); +} + +bool memory_region_snapshot_get_dirty(MemoryRegion *mr, DirtyBitmapSnapsho= t *snap, + hwaddr addr, hwaddr size) +{ + assert(mr->ram_block); + return cpu_physical_memory_snapshot_get_dirty(snap, + memory_region_get_ram_addr(mr) + addr, size); +} + void memory_region_set_readonly(MemoryRegion *mr, bool readonly) { if (mr->readonly !=3D readonly) { --=20 1.8.3.1