[Qemu-devel] [PATCH 05/10] RFC: Add memory region snapshot bitmap get function.
From: Junyan He We need to get the bitmap content of the snapshot when enable dirty log trace for nvdimm. Signed-off-by: Junyan He --- exec.c | 7 +++ include/exec/memory.h | 9 + include/exec/ram_addr.h | 2 ++ memory.c| 7 +++ 4 files changed, 25 insertions(+) diff --git a/exec.c b/exec.c index a9181e6..3d2bf0d 100644 --- a/exec.c +++ b/exec.c @@ -1235,6 +1235,13 @@ bool cpu_physical_memory_snapshot_get_dirty(DirtyBitmapSnapshot *snap, return false; } +unsigned long *cpu_physical_memory_snapshot_get_dirty_bitmap + (DirtyBitmapSnapshot *snap) +{ +assert(snap); +return snap->dirty; +} + /* Called from RCU critical section */ hwaddr memory_region_section_get_iotlb(CPUState *cpu, MemoryRegionSection *section, diff --git a/include/exec/memory.h b/include/exec/memory.h index 31eae0a..f742995 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -1179,6 +1179,15 @@ bool memory_region_snapshot_get_dirty(MemoryRegion *mr, hwaddr addr, hwaddr size); /** + * memory_region_snapshot_get_dirty_bitmap: Get the dirty bitmap data of + * snapshot. + * + * @snap: the dirty bitmap snapshot + */ +unsigned long *memory_region_snapshot_get_dirty_bitmap + (DirtyBitmapSnapshot *snap); + +/** * memory_region_reset_dirty: Mark a range of pages as clean, for a specified *client. * diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h index cf2446a..ce366c1 100644 --- a/include/exec/ram_addr.h +++ b/include/exec/ram_addr.h @@ -371,6 +371,8 @@ DirtyBitmapSnapshot *cpu_physical_memory_snapshot_and_clear_dirty bool cpu_physical_memory_snapshot_get_dirty(DirtyBitmapSnapshot *snap, ram_addr_t start, ram_addr_t length); +unsigned long *cpu_physical_memory_snapshot_get_dirty_bitmap +(DirtyBitmapSnapshot *snap); static inline void cpu_physical_memory_clear_dirty_range(ram_addr_t start, ram_addr_t length) diff --git a/memory.c b/memory.c index 4a8a2fe..68f17f0 100644 --- a/memory.c +++ b/memory.c @@ -1991,6 +1991,13 @@ DirtyBitmapSnapshot *memory_region_snapshot_and_clear_dirty(MemoryRegion *mr, memory_region_get_ram_addr(mr) + addr, size, client); } +unsigned long *memory_region_snapshot_get_dirty_bitmap + (DirtyBitmapSnapshot *snap) +{ +assert(snap); +return cpu_physical_memory_snapshot_get_dirty_bitmap(snap); +} + bool memory_region_snapshot_get_dirty(MemoryRegion *mr, DirtyBitmapSnapshot *snap, hwaddr addr, hwaddr size) { -- 2.7.4
[Qemu-devel] [PATCH 05/10] RFC: Add memory region snapshot bitmap get function.
From: Junyan He We need to get the bitmap content of the snapshot when enable dirty log trace for nvdimm. Signed-off-by: Junyan He --- exec.c | 7 +++ include/exec/memory.h | 9 + include/exec/ram_addr.h | 2 ++ memory.c| 7 +++ 4 files changed, 25 insertions(+) diff --git a/exec.c b/exec.c index a9181e6..3d2bf0d 100644 --- a/exec.c +++ b/exec.c @@ -1235,6 +1235,13 @@ bool cpu_physical_memory_snapshot_get_dirty(DirtyBitmapSnapshot *snap, return false; } +unsigned long *cpu_physical_memory_snapshot_get_dirty_bitmap + (DirtyBitmapSnapshot *snap) +{ +assert(snap); +return snap->dirty; +} + /* Called from RCU critical section */ hwaddr memory_region_section_get_iotlb(CPUState *cpu, MemoryRegionSection *section, diff --git a/include/exec/memory.h b/include/exec/memory.h index 31eae0a..f742995 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -1179,6 +1179,15 @@ bool memory_region_snapshot_get_dirty(MemoryRegion *mr, hwaddr addr, hwaddr size); /** + * memory_region_snapshot_get_dirty_bitmap: Get the dirty bitmap data of + * snapshot. + * + * @snap: the dirty bitmap snapshot + */ +unsigned long *memory_region_snapshot_get_dirty_bitmap + (DirtyBitmapSnapshot *snap); + +/** * memory_region_reset_dirty: Mark a range of pages as clean, for a specified *client. * diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h index cf2446a..ce366c1 100644 --- a/include/exec/ram_addr.h +++ b/include/exec/ram_addr.h @@ -371,6 +371,8 @@ DirtyBitmapSnapshot *cpu_physical_memory_snapshot_and_clear_dirty bool cpu_physical_memory_snapshot_get_dirty(DirtyBitmapSnapshot *snap, ram_addr_t start, ram_addr_t length); +unsigned long *cpu_physical_memory_snapshot_get_dirty_bitmap +(DirtyBitmapSnapshot *snap); static inline void cpu_physical_memory_clear_dirty_range(ram_addr_t start, ram_addr_t length) diff --git a/memory.c b/memory.c index 4a8a2fe..68f17f0 100644 --- a/memory.c +++ b/memory.c @@ -1991,6 +1991,13 @@ DirtyBitmapSnapshot *memory_region_snapshot_and_clear_dirty(MemoryRegion *mr, memory_region_get_ram_addr(mr) + addr, size, client); } +unsigned long *memory_region_snapshot_get_dirty_bitmap + (DirtyBitmapSnapshot *snap) +{ +assert(snap); +return cpu_physical_memory_snapshot_get_dirty_bitmap(snap); +} + bool memory_region_snapshot_get_dirty(MemoryRegion *mr, DirtyBitmapSnapshot *snap, hwaddr addr, hwaddr size) { -- 2.7.4