[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 12/13] vfio: Add vfio_listerner_log_sync to mark
From: |
Kirti Wankhede |
Subject: |
[Qemu-devel] [PATCH v5 12/13] vfio: Add vfio_listerner_log_sync to mark dirty pages |
Date: |
Tue, 9 Jul 2019 00:47:31 +0530 |
vfio_listerner_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 de74dae8d6a6..d5ee35c95e76 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -36,6 +36,7 @@
#include "sysemu/kvm.h"
#include "trace.h"
#include "qapi/error.h"
+#include "migration/migration.h"
VFIOGroupList vfio_group_list =
QLIST_HEAD_INITIALIZER(vfio_group_list);
@@ -794,9 +795,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 v5 02/13] vfio: Add function to unmap VFIO region, (continued)
- [Qemu-devel] [PATCH v5 02/13] vfio: Add function to unmap VFIO region, Kirti Wankhede, 2019/07/08
- [Qemu-devel] [PATCH v5 03/13] vfio: Add vfio_get_object callback to VFIODeviceOps, Kirti Wankhede, 2019/07/08
- [Qemu-devel] [PATCH v5 04/13] vfio: Add save and load functions for VFIO PCI devices, Kirti Wankhede, 2019/07/08
- [Qemu-devel] [PATCH v5 06/13] vfio: Add VM state change handler to know state of VM, Kirti Wankhede, 2019/07/08
- [Qemu-devel] [PATCH v5 07/13] vfio: Add migration state change notifier, Kirti Wankhede, 2019/07/08
- [Qemu-devel] [PATCH v5 08/13] vfio: Register SaveVMHandlers for VFIO device, Kirti Wankhede, 2019/07/08
- [Qemu-devel] [PATCH v5 05/13] vfio: Add migration region initialization and finalize function, Kirti Wankhede, 2019/07/08
- [Qemu-devel] [PATCH v5 09/13] vfio: Add save state functions to SaveVMHandlers, Kirti Wankhede, 2019/07/08
- [Qemu-devel] [PATCH v5 10/13] vfio: Add load state functions to SaveVMHandlers, Kirti Wankhede, 2019/07/08
- [Qemu-devel] [PATCH v5 11/13] vfio: Add function to get dirty page list, Kirti Wankhede, 2019/07/08
- [Qemu-devel] [PATCH v5 12/13] vfio: Add vfio_listerner_log_sync to mark dirty pages,
Kirti Wankhede <=
- [Qemu-devel] [PATCH v5 13/13] vfio: Make vfio-pci device migration capable., Kirti Wankhede, 2019/07/08
- Re: [Qemu-devel] [PATCH v5 00/13] Add migration support for VFIO device, no-reply, 2019/07/08
- Re: [Qemu-devel] [PATCH v5 00/13] Add migration support for VFIO device, no-reply, 2019/07/08