summary refs log tree commit diff stats
path: root/system/physmem.c
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2025-09-29 13:55:15 +0200
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2025-10-07 05:03:56 +0200
commit1085a44ebb55346b30888ce1b7b18565a719f78b (patch)
tree4ce8d29a2d5760bf036f6c201974e6a1bf3a74c4 /system/physmem.c
parent57f3d859bf947cdef418dec14445b1f8935f2d20 (diff)
downloadfocaccia-qemu-1085a44ebb55346b30888ce1b7b18565a719f78b.tar.gz
focaccia-qemu-1085a44ebb55346b30888ce1b7b18565a719f78b.zip
system/physmem: Reduce cpu_physical_memory_clear_dirty_range() scope
cpu_physical_memory_clear_dirty_range() is now only called within
system/physmem.c, by qemu_ram_resize(). Reduce its scope by making
it internal to this file. Since it doesn't involve any CPU, remove
the 'cpu_' prefix. As it operates on a range, rename @start as @addr.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20251001175448.18933-16-philmd@linaro.org>
Diffstat (limited to 'system/physmem.c')
-rw-r--r--system/physmem.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/system/physmem.c b/system/physmem.c
index 24b654fb3f..079bdbff30 100644
--- a/system/physmem.c
+++ b/system/physmem.c
@@ -1137,6 +1137,13 @@ bool cpu_physical_memory_test_and_clear_dirty(ram_addr_t start,
     return dirty;
 }
 
+static void physical_memory_clear_dirty_range(ram_addr_t addr, ram_addr_t length)
+{
+    cpu_physical_memory_test_and_clear_dirty(addr, length, DIRTY_MEMORY_MIGRATION);
+    cpu_physical_memory_test_and_clear_dirty(addr, length, DIRTY_MEMORY_VGA);
+    cpu_physical_memory_test_and_clear_dirty(addr, length, DIRTY_MEMORY_CODE);
+}
+
 DirtyBitmapSnapshot *cpu_physical_memory_snapshot_and_clear_dirty
     (MemoryRegion *mr, hwaddr offset, hwaddr length, unsigned client)
 {
@@ -2071,7 +2078,7 @@ int qemu_ram_resize(RAMBlock *block, ram_addr_t newsize, Error **errp)
         ram_block_notify_resize(block->host, oldsize, newsize);
     }
 
-    cpu_physical_memory_clear_dirty_range(block->offset, block->used_length);
+    physical_memory_clear_dirty_range(block->offset, block->used_length);
     block->used_length = newsize;
     cpu_physical_memory_set_dirty_range(block->offset, block->used_length,
                                         DIRTY_CLIENTS_ALL);