aboutsummaryrefslogtreecommitdiff
path: root/memory.c
diff options
context:
space:
mode:
authorBeata Michalska <beata.michalska@linaro.org>2019-11-21 00:08:41 +0000
committerPeter Maydell <peter.maydell@linaro.org>2019-12-16 10:46:35 +0000
commit61c490e25e081af39ff40556f6c1229b8b011585 (patch)
treea05523934595b80768e7060a982fbc89041bfa08 /memory.c
parent9e70492b4389d4355ae9c9ee2ba6286cfdadc257 (diff)
Memory: Enable writeback for given memory region
Add an option to trigger memory writeback to sync given memory region with the corresponding backing store, case one is available. This extends the support for persistent memory, allowing syncing on-demand. Signed-off-by: Beata Michalska <beata.michalska@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20191121000843.24844-3-beata.michalska@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'memory.c')
-rw-r--r--memory.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/memory.c b/memory.c
index 06484c2bff..0228cad38d 100644
--- a/memory.c
+++ b/memory.c
@@ -2207,6 +2207,18 @@ void memory_region_ram_resize(MemoryRegion *mr, ram_addr_t newsize, Error **errp
qemu_ram_resize(mr->ram_block, newsize, errp);
}
+
+void memory_region_do_writeback(MemoryRegion *mr, hwaddr addr, hwaddr size)
+{
+ /*
+ * Might be extended case needed to cover
+ * different types of memory regions
+ */
+ if (mr->ram_block && mr->dirty_log_mask) {
+ qemu_ram_writeback(mr->ram_block, addr, size);
+ }
+}
+
/*
* Call proper memory listeners about the change on the newly
* added/removed CoalescedMemoryRange.