[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 19/20] vfio/migration: Query device dirty page tracking suppor
From: |
Avihai Horon |
Subject: |
[PATCH v2 19/20] vfio/migration: Query device dirty page tracking support |
Date: |
Wed, 22 Feb 2023 19:49:14 +0200 |
From: Joao Martins <joao.m.martins@oracle.com>
Now that everything has been set up for device dirty page tracking,
query the device for device dirty page tracking support.
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
Signed-off-by: Avihai Horon <avihaih@nvidia.com>
---
hw/vfio/migration.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index 307983d57d..ae2be3dd3a 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -713,6 +713,19 @@ static int vfio_migration_query_flags(VFIODevice
*vbasedev, uint64_t *mig_flags)
return 0;
}
+static bool vfio_dma_logging_supported(VFIODevice *vbasedev)
+{
+ uint64_t buf[DIV_ROUND_UP(sizeof(struct vfio_device_feature),
+ sizeof(uint64_t))] = {};
+ struct vfio_device_feature *feature = (struct vfio_device_feature *)buf;
+
+ feature->argsz = sizeof(buf);
+ feature->flags =
+ VFIO_DEVICE_FEATURE_PROBE | VFIO_DEVICE_FEATURE_DMA_LOGGING_START;
+
+ return !ioctl(vbasedev->fd, VFIO_DEVICE_FEATURE, feature);
+}
+
static int vfio_migration_init(VFIODevice *vbasedev)
{
int ret;
@@ -748,6 +761,8 @@ static int vfio_migration_init(VFIODevice *vbasedev)
migration->data_fd = -1;
migration->mig_flags = mig_flags;
+ vbasedev->dirty_pages_supported = vfio_dma_logging_supported(vbasedev);
+
oid = vmstate_if_get_id(VMSTATE_IF(DEVICE(obj)));
if (oid) {
path = g_strdup_printf("%s/vfio", oid);
--
2.26.3
- Re: [PATCH v2 17/20] vfio/common: Support device dirty page tracking with vIOMMU, (continued)
- Re: [PATCH v2 17/20] vfio/common: Support device dirty page tracking with vIOMMU, Jason Gunthorpe, 2023/02/23
- Re: [PATCH v2 17/20] vfio/common: Support device dirty page tracking with vIOMMU, Joao Martins, 2023/02/23
- Re: [PATCH v2 17/20] vfio/common: Support device dirty page tracking with vIOMMU, Alex Williamson, 2023/02/23
- Re: [PATCH v2 17/20] vfio/common: Support device dirty page tracking with vIOMMU, Jason Gunthorpe, 2023/02/23
- Re: [PATCH v2 17/20] vfio/common: Support device dirty page tracking with vIOMMU, Joao Martins, 2023/02/24
- Re: [PATCH v2 17/20] vfio/common: Support device dirty page tracking with vIOMMU, Joao Martins, 2023/02/24
- Re: [PATCH v2 17/20] vfio/common: Support device dirty page tracking with vIOMMU, Jason Gunthorpe, 2023/02/24
- Re: [PATCH v2 17/20] vfio/common: Support device dirty page tracking with vIOMMU, Alex Williamson, 2023/02/24
- Re: [PATCH v2 17/20] vfio/common: Support device dirty page tracking with vIOMMU, Joao Martins, 2023/02/24
[PATCH v2 18/20] vfio/common: Optimize device dirty page tracking with vIOMMU, Avihai Horon, 2023/02/22
[PATCH v2 19/20] vfio/migration: Query device dirty page tracking support,
Avihai Horon <=
[PATCH v2 20/20] docs/devel: Document VFIO device dirty page tracking, Avihai Horon, 2023/02/22
Re: [PATCH v2 00/20] vfio: Add migration pre-copy support and device dirty tracking, Avihai Horon, 2023/02/22
Re: [PATCH v2 00/20] vfio: Add migration pre-copy support and device dirty tracking, Alex Williamson, 2023/02/22
Re: [PATCH v2 00/20] vfio: Add migration pre-copy support and device dirty tracking, Avihai Horon, 2023/02/23