diff mbox series

[RFC,v1,21/26] migration/ram: Add a wrapper for fixed-ram shadow bitmap

Message ID 20230330180336.2791-22-farosas@suse.de (mailing list archive)
State New, archived
Headers show
Series migration: File based migration with multifd and fixed-ram | expand

Commit Message

Fabiano Rosas March 30, 2023, 6:03 p.m. UTC
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 <farosas@suse.de>
---
 migration/ram.c | 9 +++++++++
 migration/ram.h | 1 +
 2 files changed, 10 insertions(+)
diff mbox series

Patch

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);