82 lines
3.4 KiB
Diff
82 lines
3.4 KiB
Diff
|
|
From b0fe5a6794c5403f4ab9859ec2ced338246690bd Mon Sep 17 00:00:00 2001
|
||
|
|
From: Joao Martins <joao.m.martins@oracle.com>
|
||
|
|
Date: Mon, 22 Jul 2024 22:13:26 +0100
|
||
|
|
Subject: [PATCH] vfio/common: Allow disabling device dirty page tracking
|
||
|
|
|
||
|
|
The property 'x-pre-copy-dirty-page-tracking' allows disabling the whole
|
||
|
|
tracking of VF pre-copy phase of dirty page tracking, though it means
|
||
|
|
that it will only be used at the start of the switchover phase.
|
||
|
|
|
||
|
|
Add an option that disables the VF dirty page tracking, and fall
|
||
|
|
back into container-based dirty page tracking. This also allows to
|
||
|
|
use IOMMU dirty tracking even on VFs with their own dirty
|
||
|
|
tracker scheme.
|
||
|
|
|
||
|
|
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
|
||
|
|
Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
|
||
|
|
---
|
||
|
|
hw/vfio/common.c | 3 +++
|
||
|
|
hw/vfio/migration.c | 4 +++-
|
||
|
|
hw/vfio/pci.c | 3 +++
|
||
|
|
include/hw/vfio/vfio-common.h | 1 +
|
||
|
|
4 files changed, 10 insertions(+), 1 deletion(-)
|
||
|
|
|
||
|
|
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
|
||
|
|
index 65e1c9f810..a8bc1c6055 100644
|
||
|
|
--- a/hw/vfio/common.c
|
||
|
|
+++ b/hw/vfio/common.c
|
||
|
|
@@ -208,6 +208,9 @@ bool vfio_devices_all_device_dirty_tracking(const VFIOContainerBase *bcontainer)
|
||
|
|
VFIODevice *vbasedev;
|
||
|
|
|
||
|
|
QLIST_FOREACH(vbasedev, &bcontainer->device_list, container_next) {
|
||
|
|
+ if (vbasedev->device_dirty_page_tracking == ON_OFF_AUTO_OFF) {
|
||
|
|
+ return false;
|
||
|
|
+ }
|
||
|
|
if (!vbasedev->dirty_pages_supported) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
|
||
|
|
index db128204af..3924beb289 100644
|
||
|
|
--- a/hw/vfio/migration.c
|
||
|
|
+++ b/hw/vfio/migration.c
|
||
|
|
@@ -945,7 +945,9 @@ bool vfio_migration_realize(VFIODevice *vbasedev, Error **errp)
|
||
|
|
return !vfio_block_migration(vbasedev, err, errp);
|
||
|
|
}
|
||
|
|
|
||
|
|
- if (!vbasedev->dirty_pages_supported && !vbasedev->iommu_dirty_tracking) {
|
||
|
|
+ if ((!vbasedev->dirty_pages_supported ||
|
||
|
|
+ vbasedev->device_dirty_page_tracking == ON_OFF_AUTO_OFF) &&
|
||
|
|
+ !vbasedev->iommu_dirty_tracking) {
|
||
|
|
if (vbasedev->enable_migration == ON_OFF_AUTO_AUTO) {
|
||
|
|
error_setg(&err,
|
||
|
|
"%s: VFIO device doesn't support device and "
|
||
|
|
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
|
||
|
|
index 19211f4368..f585f285f4 100644
|
||
|
|
--- a/hw/vfio/pci.c
|
||
|
|
+++ b/hw/vfio/pci.c
|
||
|
|
@@ -3350,6 +3350,9 @@ static Property vfio_pci_dev_properties[] = {
|
||
|
|
DEFINE_PROP_ON_OFF_AUTO("x-pre-copy-dirty-page-tracking", VFIOPCIDevice,
|
||
|
|
vbasedev.pre_copy_dirty_page_tracking,
|
||
|
|
ON_OFF_AUTO_ON),
|
||
|
|
+ DEFINE_PROP_ON_OFF_AUTO("x-device-dirty-page-tracking", VFIOPCIDevice,
|
||
|
|
+ vbasedev.device_dirty_page_tracking,
|
||
|
|
+ ON_OFF_AUTO_ON),
|
||
|
|
DEFINE_PROP_ON_OFF_AUTO("display", VFIOPCIDevice,
|
||
|
|
display, ON_OFF_AUTO_OFF),
|
||
|
|
DEFINE_PROP_UINT32("xres", VFIOPCIDevice, display_xres, 0),
|
||
|
|
diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
|
||
|
|
index 22a7386591..abae8655c4 100644
|
||
|
|
--- a/include/hw/vfio/vfio-common.h
|
||
|
|
+++ b/include/hw/vfio/vfio-common.h
|
||
|
|
@@ -147,6 +147,7 @@ typedef struct VFIODevice {
|
||
|
|
VFIOMigration *migration;
|
||
|
|
Error *migration_blocker;
|
||
|
|
OnOffAuto pre_copy_dirty_page_tracking;
|
||
|
|
+ OnOffAuto device_dirty_page_tracking;
|
||
|
|
bool dirty_pages_supported;
|
||
|
|
bool dirty_tracking;
|
||
|
|
bool iommu_dirty_tracking;
|
||
|
|
--
|
||
|
|
2.41.0.windows.1
|
||
|
|
|