From 9ed077601004c5c72665010b893ace6d8709e244 Mon Sep 17 00:00:00 2001 From: John Levon Date: Tue, 1 Jun 2021 11:53:25 +0100 Subject: fixes for VFIO_USER_DIRTY_PAGES (#537) - we should only accept one range, not multiple ones - clearly define and implement argsz behaviour - we need to check if migration is configured - add proper test coverage; move existing testing to python Signed-off-by: John Levon Reviewed-by: Thanos Makatos --- include/vfio-user.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/vfio-user.h b/include/vfio-user.h index ef3159a..71112ef 100644 --- a/include/vfio-user.h +++ b/include/vfio-user.h @@ -155,7 +155,18 @@ struct vfio_user_irq_info { uint32_t subindex; } __attribute__((packed)); -/* based on struct vfio_iommu_type1_dirty_bitmap_get */ +/* Analogous to vfio_iommu_type1_dirty_bitmap. */ +struct vfio_user_dirty_pages { + uint32_t argsz; +#ifndef VFIO_IOMMU_DIRTY_PAGES_FLAG_START +#define VFIO_IOMMU_DIRTY_PAGES_FLAG_START (1 << 0) +#define VFIO_IOMMU_DIRTY_PAGES_FLAG_STOP (1 << 1) +#define VFIO_IOMMU_DIRTY_PAGES_FLAG_GET_BITMAP (1 << 2) +#endif + uint32_t flags; +} __attribute__((packed)); + +/* Analogous to struct vfio_iommu_type1_dirty_bitmap_get. */ struct vfio_user_bitmap_range { uint64_t iova; uint64_t size; @@ -200,15 +211,6 @@ struct vfio_device_migration_info { }; #endif /* not a RHEL kernel */ -struct vfio_iommu_type1_dirty_bitmap { - __u32 argsz; - __u32 flags; -#define VFIO_IOMMU_DIRTY_PAGES_FLAG_START (1 << 0) -#define VFIO_IOMMU_DIRTY_PAGES_FLAG_STOP (1 << 1) -#define VFIO_IOMMU_DIRTY_PAGES_FLAG_GET_BITMAP (1 << 2) - __u8 data[]; -}; - #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5,8,0) */ #ifdef __cplusplus -- cgit v1.1