physmem: Factor cpu_physical_memory_dirty_bits_cleared() out

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20240219061731.232570-1-npiggin@gmail.com>
[PMD: Split patch in 2: part 1/2]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Link: https://lore.kernel.org/r/20240312201458.79532-3-philmd@linaro.org
Signed-off-by: Peter Xu <peterx@redhat.com>
This commit is contained in:
Nicholas Piggin 2024-03-12 21:14:57 +01:00 committed by Peter Xu
parent 7e8ccf99ed
commit 86a9ae80cc
2 changed files with 12 additions and 5 deletions

View file

@ -881,8 +881,8 @@ bool cpu_physical_memory_test_and_clear_dirty(ram_addr_t start,
memory_region_clear_dirty_bitmap(ramblock->mr, mr_offset, mr_size);
}
if (dirty && tcg_enabled()) {
tlb_reset_dirty_range_all(start, length);
if (dirty) {
cpu_physical_memory_dirty_bits_cleared(start, length);
}
return dirty;
@ -929,9 +929,7 @@ DirtyBitmapSnapshot *cpu_physical_memory_snapshot_and_clear_dirty
}
}
if (tcg_enabled()) {
tlb_reset_dirty_range_all(start, length);
}
cpu_physical_memory_dirty_bits_cleared(start, length);
memory_region_clear_dirty_bitmap(mr, offset, length);