diff options
author | Joao Martins <joao.m.martins@oracle.com> | 2023-03-07 12:54:49 +0000 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2023-03-07 10:21:22 -0700 |
commit | 95b29658b60786a4b0631d82698e13483b2c2b94 (patch) | |
tree | 8f270691f34fe393440d48d6c6fc92949c4a6bba /hw/vfio | |
parent | e46883204c384f992088f8c3ea713f7e1c2d5a6d (diff) | |
download | qemu-95b29658b60786a4b0631d82698e13483b2c2b94.zip qemu-95b29658b60786a4b0631d82698e13483b2c2b94.tar.gz qemu-95b29658b60786a4b0631d82698e13483b2c2b94.tar.bz2 |
vfio/migration: Query device dirty page tracking support
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: https://lore.kernel.org/r/20230307125450.62409-15-joao.m.martins@oracle.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'hw/vfio')
-rw-r--r-- | hw/vfio/migration.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c index 776fd2d..5d1e66f 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); |