From 5255bbf4ec16bb352265d9ce131076212730a621 Mon Sep 17 00:00:00 2001 From: Joao Martins Date: Tue, 7 Mar 2023 12:54:45 +0000 Subject: vfio/common: Add device dirty page tracking start/stop Add device dirty page tracking start/stop functionality. This uses the device DMA logging uAPI to start and stop dirty page tracking by device. Device dirty page tracking is used only if all devices within a container support device dirty page tracking. Signed-off-by: Avihai Horon Signed-off-by: Joao Martins Link: https://lore.kernel.org/r/20230307125450.62409-11-joao.m.martins@oracle.com Signed-off-by: Alex Williamson --- include/hw/vfio/vfio-common.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/hw') diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h index 87524c64a4..9551d2d430 100644 --- a/include/hw/vfio/vfio-common.h +++ b/include/hw/vfio/vfio-common.h @@ -143,6 +143,8 @@ typedef struct VFIODevice { VFIOMigration *migration; Error *migration_blocker; OnOffAuto pre_copy_dirty_page_tracking; + bool dirty_pages_supported; + bool dirty_tracking; } VFIODevice; struct VFIODeviceOps { -- cgit v1.2.3 From e46883204c384f992088f8c3ea713f7e1c2d5a6d Mon Sep 17 00:00:00 2001 From: Joao Martins Date: Tue, 7 Mar 2023 12:54:48 +0000 Subject: vfio/migration: Block migration with vIOMMU MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Migrating with vIOMMU will require either tracking maximum IOMMU supported address space (e.g. 39/48 address width on Intel) or range-track current mappings and dirty track the new ones post starting dirty tracking. This will be done as a separate series, so add a live migration blocker until that is fixed. Signed-off-by: Joao Martins Reviewed-by: Cédric Le Goater Link: https://lore.kernel.org/r/20230307125450.62409-14-joao.m.martins@oracle.com Signed-off-by: Alex Williamson --- include/hw/vfio/vfio-common.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/hw') diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h index 9551d2d430..009bec34c4 100644 --- a/include/hw/vfio/vfio-common.h +++ b/include/hw/vfio/vfio-common.h @@ -222,6 +222,8 @@ extern VFIOGroupList vfio_group_list; bool vfio_mig_active(void); int vfio_block_multiple_devices_migration(Error **errp); void vfio_unblock_multiple_devices_migration(void); +int vfio_block_giommu_migration(Error **errp); +void vfio_unblock_giommu_migration(void); int64_t vfio_mig_bytes_transferred(void); #ifdef CONFIG_LINUX -- cgit v1.2.3 From 8249cffc626d0661d6c109aa0653cd9bb67cd676 Mon Sep 17 00:00:00 2001 From: Alex Williamson Date: Tue, 7 Mar 2023 09:53:46 -0700 Subject: vfio/migration: Rename entry points MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pick names that align with the section drivers should use them from, avoiding the confusion of calling a _finalize() function from _exit() and generalizing the actual _finalize() to handle removing the viommu blocker. Reviewed-by: Cédric Le Goater Reviewed-by: Joao Martins Link: https://lore.kernel.org/r/167820912978.606734.12740287349119694623.stgit@omen Signed-off-by: Alex Williamson --- include/hw/vfio/vfio-common.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include/hw') diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h index 009bec34c4..eed244f25f 100644 --- a/include/hw/vfio/vfio-common.h +++ b/include/hw/vfio/vfio-common.h @@ -223,7 +223,6 @@ bool vfio_mig_active(void); int vfio_block_multiple_devices_migration(Error **errp); void vfio_unblock_multiple_devices_migration(void); int vfio_block_giommu_migration(Error **errp); -void vfio_unblock_giommu_migration(void); int64_t vfio_mig_bytes_transferred(void); #ifdef CONFIG_LINUX @@ -247,7 +246,8 @@ int vfio_spapr_create_window(VFIOContainer *container, int vfio_spapr_remove_window(VFIOContainer *container, hwaddr offset_within_address_space); -int vfio_migration_probe(VFIODevice *vbasedev, Error **errp); -void vfio_migration_finalize(VFIODevice *vbasedev); +int vfio_migration_realize(VFIODevice *vbasedev, Error **errp); +void vfio_migration_exit(VFIODevice *vbasedev); +void vfio_migration_finalize(void); #endif /* HW_VFIO_VFIO_COMMON_H */ -- cgit v1.2.3