[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 14/17] vfio/migration: Query device dirty page tracking support
From: |
Alex Williamson |
Subject: |
[PULL 14/17] vfio/migration: Query device dirty page tracking support |
Date: |
Tue, 07 Mar 2023 11:53:39 -0700 |
User-agent: |
StGit/1.5.dev2+g9ce680a52bd9 |
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: Avihai Horon <avihaih@nvidia.com>
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link:
20230307125450.62409-15-joao.m.martins@oracle.com">https://lore.kernel.org/r/20230307125450.62409-15-joao.m.martins@oracle.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
hw/vfio/migration.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index 776fd2d7cdf3..5d1e66f69194 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -555,6 +555,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;
@@ -589,6 +602,8 @@ static int vfio_migration_init(VFIODevice *vbasedev)
migration->device_state = VFIO_DEVICE_STATE_RUNNING;
migration->data_fd = -1;
+ 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);
- [PULL 04/17] vfio/common: Add VFIOBitmap and alloc function, (continued)
- [PULL 04/17] vfio/common: Add VFIOBitmap and alloc function, Alex Williamson, 2023/03/07
- [PULL 05/17] vfio/common: Add helper to validate iova/end against hostwin, Alex Williamson, 2023/03/07
- [PULL 06/17] vfio/common: Use a single tracepoint for skipped sections, Alex Williamson, 2023/03/07
- [PULL 07/17] vfio/common: Consolidate skip/invalid section into helper, Alex Williamson, 2023/03/07
- [PULL 08/17] vfio/common: Add helper to consolidate iova/end calculation, Alex Williamson, 2023/03/07
- [PULL 09/17] vfio/common: Record DMA mapped IOVA ranges, Alex Williamson, 2023/03/07
- [PULL 10/17] vfio/common: Add device dirty page tracking start/stop, Alex Williamson, 2023/03/07
- [PULL 11/17] vfio/common: Extract code from vfio_get_dirty_bitmap() to new function, Alex Williamson, 2023/03/07
- [PULL 12/17] vfio/common: Add device dirty page bitmap sync, Alex Williamson, 2023/03/07
- [PULL 13/17] vfio/migration: Block migration with vIOMMU, Alex Williamson, 2023/03/07
- [PULL 14/17] vfio/migration: Query device dirty page tracking support,
Alex Williamson <=
- [PULL 15/17] docs/devel: Document VFIO device dirty page tracking, Alex Williamson, 2023/03/07
- [PULL 16/17] vfio/migration: Rename entry points, Alex Williamson, 2023/03/07
- [PULL 17/17] vfio: Fix vfio_get_dev_region() trace event, Alex Williamson, 2023/03/07
- Re: [PULL 00/17] VFIO updates for 8.0, Peter Maydell, 2023/03/09