We'll need to set the shadow_bmap bits from outside ram.c soon and
TARGET_PAGE_BITS is poisoned, so add a wrapper to it.

Signed-off-by: Fabiano Rosas <faro...@suse.de>
---
 migration/ram.c | 9 +++++++++
 migration/ram.h | 1 +
 2 files changed, 10 insertions(+)

diff --git a/migration/ram.c b/migration/ram.c
index 1666ce6d5f..e9b28c16da 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -3359,6 +3359,15 @@ static void ram_save_shadow_bmap(QEMUFile *f)
     }
 }
 
+void ramblock_set_shadow_bmap(RAMBlock *block, ram_addr_t offset, bool set)
+{
+    if (set) {
+        set_bit(offset >> TARGET_PAGE_BITS, block->shadow_bmap);
+    } else {
+        clear_bit(offset >> TARGET_PAGE_BITS, block->shadow_bmap);
+    }
+}
+
 /**
  * ram_save_iterate: iterative stage for migration
  *
diff --git a/migration/ram.h b/migration/ram.h
index 81cbb0947c..8d8258fee1 100644
--- a/migration/ram.h
+++ b/migration/ram.h
@@ -98,6 +98,7 @@ int ram_dirty_bitmap_reload(MigrationState *s, RAMBlock *rb);
 bool ramblock_page_is_discarded(RAMBlock *rb, ram_addr_t start);
 void postcopy_preempt_shutdown_file(MigrationState *s);
 void *postcopy_preempt_thread(void *opaque);
+void ramblock_set_shadow_bmap(RAMBlock *block, ram_addr_t offset, bool set);
 
 /* ram cache */
 int colo_init_ram_cache(void);
-- 
2.35.3


Reply via email to