History

vfio: option to unmap all

For the UNMAP_DMA ioctl, delete all mappings if VFIO_DMA_UNMAP_FLAG_ALL is set. Define the corresponding VFIO_UNMAP_ALL extension.

Steve Sistare committed 5 years ago

Commit c98fe7c1 parent 1048ba81 file · +8 −0Browse files

Showing the changes to include/uapi (1 of 1 file). Show all

Unified · Split

include/uapi/linux/vfio.h+8−0
@@ -46,6 +46,9 @@ · 45 unmodified lines
4646 */
4747 #define VFIO_NOIOMMU_IOMMU 8
4848
49+/* Supports VFIO_DMA_UNMAP_FLAG_ALL */
50+#define VFIO_UNMAP_ALL 9
51+
4952 /*
5053 * The IOCTL interface is designed for extensibility by embedding the
5154 * structure length (argsz) and flags into structures passed between
@@ -1102,6 +1105,7 @@ struct vfio_bitmap { · 1050 unmodified lines
11021105 * field. No guarantee is made to the user that arbitrary unmaps of iova
11031106 * or size different from those used in the original mapping call will
11041107 * succeed.
1108+ *
11051109 * VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP should be set to get the dirty bitmap
11061110 * before unmapping IO virtual addresses. When this flag is set, the user must
11071111 * provide a struct vfio_bitmap in data[]. User must provide zero-allocated
@@ -1111,11 +1115,15 @@ struct vfio_bitmap { · 3 unmodified lines
11111115 * indicates that the page at that offset from iova is dirty. A Bitmap of the
11121116 * pages in the range of unmapped size is returned in the user-provided
11131117 * vfio_bitmap.data.
1118+ *
1119+ * If flags & VFIO_DMA_UNMAP_FLAG_ALL, unmap all addresses. iova and size
1120+ * must be 0. This cannot be combined with the get-dirty-bitmap flag.
11141121 */
11151122 struct vfio_iommu_type1_dma_unmap {
11161123 __u32 argsz;
11171124 __u32 flags;
11181125 #define VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP (1 << 0)
1126+#define VFIO_DMA_UNMAP_FLAG_ALL (1 << 1)
11191127 __u64 iova; /* IO virtual address */
11201128 __u64 size; /* Size of mapping (bytes) */
11211129 __u8 data[];