aboutsummaryrefslogtreecommitdiff
path: root/hw/vfio/container-base.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/vfio/container-base.c')
-rw-r--r--hw/vfio/container-base.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/hw/vfio/container-base.c b/hw/vfio/container-base.c
index 6f86c37..749a3fd 100644
--- a/hw/vfio/container-base.c
+++ b/hw/vfio/container-base.c
@@ -64,13 +64,23 @@ int vfio_container_set_dirty_page_tracking(VFIOContainerBase *bcontainer,
bool start, Error **errp)
{
VFIOIOMMUClass *vioc = VFIO_IOMMU_GET_CLASS(bcontainer);
+ int ret;
if (!bcontainer->dirty_pages_supported) {
return 0;
}
g_assert(vioc->set_dirty_page_tracking);
- return vioc->set_dirty_page_tracking(bcontainer, start, errp);
+ if (bcontainer->dirty_pages_started == start) {
+ return 0;
+ }
+
+ ret = vioc->set_dirty_page_tracking(bcontainer, start, errp);
+ if (!ret) {
+ bcontainer->dirty_pages_started = start;
+ }
+
+ return ret;
}
int vfio_container_query_dirty_bitmap(const VFIOContainerBase *bcontainer,