[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v8 12/13] vfio: Add vfio_listener_log_sync to mark d
From: |
Kirti Wankhede |
Subject: |
[Qemu-devel] [PATCH v8 12/13] vfio: Add vfio_listener_log_sync to mark dirty pages |
Date: |
Tue, 27 Aug 2019 00:25:52 +0530 |
vfio_listener_log_sync gets list of dirty pages from vendor driver and mark
those pages dirty when in _SAVING state.
Return early for the RAM block section of mapped MMIO region.
Signed-off-by: Kirti Wankhede <address@hidden>
Reviewed-by: Neo Jia <address@hidden>
---
hw/vfio/common.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index c33c6684c06f..23f3d3c7c46a 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -38,6 +38,7 @@
#include "sysemu/reset.h"
#include "trace.h"
#include "qapi/error.h"
+#include "migration/migration.h"
VFIOGroupList vfio_group_list =
QLIST_HEAD_INITIALIZER(vfio_group_list);
@@ -796,9 +797,43 @@ static void vfio_listener_region_del(MemoryListener
*listener,
}
}
+static void vfio_listerner_log_sync(MemoryListener *listener,
+ MemoryRegionSection *section)
+{
+ uint64_t start_addr, size, pfn_count;
+ VFIOGroup *group;
+ VFIODevice *vbasedev;
+
+ if (memory_region_is_ram_device(section->mr)) {
+ return;
+ }
+
+ QLIST_FOREACH(group, &vfio_group_list, next) {
+ QLIST_FOREACH(vbasedev, &group->device_list, next) {
+ if (vbasedev->device_state & VFIO_DEVICE_STATE_SAVING) {
+ continue;
+ } else {
+ return;
+ }
+ }
+ }
+
+ start_addr = TARGET_PAGE_ALIGN(section->offset_within_address_space);
+ size = int128_get64(section->size);
+ pfn_count = size >> TARGET_PAGE_BITS;
+
+ QLIST_FOREACH(group, &vfio_group_list, next) {
+ QLIST_FOREACH(vbasedev, &group->device_list, next) {
+ vfio_get_dirty_page_list(vbasedev, start_addr >> TARGET_PAGE_BITS,
+ pfn_count, TARGET_PAGE_SIZE);
+ }
+ }
+}
+
static const MemoryListener vfio_memory_listener = {
.region_add = vfio_listener_region_add,
.region_del = vfio_listener_region_del,
+ .log_sync = vfio_listerner_log_sync,
};
static void vfio_listener_release(VFIOContainer *container)
--
2.7.0
- [Qemu-devel] [PATCH v8 02/13] vfio: Add function to unmap VFIO region, (continued)
- [Qemu-devel] [PATCH v8 02/13] vfio: Add function to unmap VFIO region, Kirti Wankhede, 2019/08/26
- [Qemu-devel] [PATCH v8 03/13] vfio: Add vfio_get_object callback to VFIODeviceOps, Kirti Wankhede, 2019/08/26
- [Qemu-devel] [PATCH v8 04/13] vfio: Add save and load functions for VFIO PCI devices, Kirti Wankhede, 2019/08/26
- [Qemu-devel] [PATCH v8 05/13] vfio: Add migration region initialization and finalize function, Kirti Wankhede, 2019/08/26
- [Qemu-devel] [PATCH v8 06/13] vfio: Add VM state change handler to know state of VM, Kirti Wankhede, 2019/08/26
- [Qemu-devel] [PATCH v8 07/13] vfio: Add migration state change notifier, Kirti Wankhede, 2019/08/26
- [Qemu-devel] [PATCH v8 08/13] vfio: Register SaveVMHandlers for VFIO device, Kirti Wankhede, 2019/08/26
- [Qemu-devel] [PATCH v8 09/13] vfio: Add save state functions to SaveVMHandlers, Kirti Wankhede, 2019/08/26
- [Qemu-devel] [PATCH v8 10/13] vfio: Add load state functions to SaveVMHandlers, Kirti Wankhede, 2019/08/26
- [Qemu-devel] [PATCH v8 11/13] vfio: Add function to get dirty page list, Kirti Wankhede, 2019/08/26
- [Qemu-devel] [PATCH v8 12/13] vfio: Add vfio_listener_log_sync to mark dirty pages,
Kirti Wankhede <=
- [Qemu-devel] [PATCH v8 13/13] vfio: Make vfio-pci device migration capable., Kirti Wankhede, 2019/08/26
- Re: [Qemu-devel] [PATCH v8 00/13] Add migration support for VFIO device, no-reply, 2019/08/26