Hi Kirti,

On 2020/11/2 5:00, Alex Williamson wrote:
> From: Kirti Wankhede <kwankh...@nvidia.com>
> 
> Added helper functions to get IOMMU info capability chain.
> Added function to get migration capability information from that
> capability chain for IOMMU container.
> 
> Similar change was proposed earlier:
> https://lists.gnu.org/archive/html/qemu-devel/2018-05/msg03759.html
> 
> Disable migration for devices if IOMMU module doesn't support migration
> capability.
> 
> Signed-off-by: Kirti Wankhede <kwankh...@nvidia.com>
> Cc: Shameer Kolothum <shameerali.kolothum.th...@huawei.com>
> Cc: Eric Auger <eric.au...@redhat.com>
> Signed-off-by: Alex Williamson <alex.william...@redhat.com>
> ---
>  hw/vfio/common.c              |   90 
> +++++++++++++++++++++++++++++++++++++----
>  hw/vfio/migration.c           |    7 +++
>  include/hw/vfio/vfio-common.h |    3 +
>  3 files changed, 91 insertions(+), 9 deletions(-)
> 
> diff --git a/hw/vfio/common.c b/hw/vfio/common.c
> index c6e98b8d61be..d4959c036dd1 100644
> --- a/hw/vfio/common.c
> +++ b/hw/vfio/common.c
> @@ -1228,6 +1228,75 @@ static int vfio_init_container(VFIOContainer 
> *container, int group_fd,
>      return 0;
>  }
>  
[...]

> +
> +    /*
> +     * cpu_physical_memory_set_dirty_lebitmap() expects pages in bitmap of
> +     * TARGET_PAGE_SIZE to mark those dirty.
> +     */
> +    if (cap_mig->pgsize_bitmap & TARGET_PAGE_SIZE) {
> +        container->dirty_pages_supported = true;
> +        container->max_dirty_bitmap_size = cap_mig->max_dirty_bitmap_size;
> +        container->dirty_pgsizes = cap_mig->pgsize_bitmap;
> +    }
Maybe it's better to use qemu_real_host_page_size here, as some iommu drivers 
(such as smmu) prefer
host page size.

Thanks,
Keqian

Reply via email to