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
46 */46 */
47#define VFIO_NOIOMMU_IOMMU 847#define VFIO_NOIOMMU_IOMMU 8
48 48
49/* Supports VFIO_DMA_UNMAP_FLAG_ALL */
50#define VFIO_UNMAP_ALL 9
51
49/*52/*
50 * The IOCTL interface is designed for extensibility by embedding the53 * The IOCTL interface is designed for extensibility by embedding the
51 * structure length (argsz) and flags into structures passed between54 * structure length (argsz) and flags into structures passed between
@@ -1102,6 +1105,7 @@ struct vfio_bitmap { · 1050 unmodified lines
1102 * field. No guarantee is made to the user that arbitrary unmaps of iova1105 * field. No guarantee is made to the user that arbitrary unmaps of iova
1103 * or size different from those used in the original mapping call will1106 * or size different from those used in the original mapping call will
1104 * succeed.1107 * succeed.
1108 *
1105 * VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP should be set to get the dirty bitmap1109 * VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP should be set to get the dirty bitmap
1106 * before unmapping IO virtual addresses. When this flag is set, the user must1110 * before unmapping IO virtual addresses. When this flag is set, the user must
1107 * provide a struct vfio_bitmap in data[]. User must provide zero-allocated1111 * provide a struct vfio_bitmap in data[]. User must provide zero-allocated
@@ -1111,11 +1115,15 @@ struct vfio_bitmap { · 3 unmodified lines
1111 * indicates that the page at that offset from iova is dirty. A Bitmap of the1115 * indicates that the page at that offset from iova is dirty. A Bitmap of the
1112 * pages in the range of unmapped size is returned in the user-provided1116 * pages in the range of unmapped size is returned in the user-provided
1113 * vfio_bitmap.data.1117 * 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.
1114 */1121 */
1115struct vfio_iommu_type1_dma_unmap {1122struct vfio_iommu_type1_dma_unmap {
1116 __u32 argsz;1123 __u32 argsz;
1117 __u32 flags;1124 __u32 flags;
1118#define VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP (1 << 0)1125#define VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP (1 << 0)
1126#define VFIO_DMA_UNMAP_FLAG_ALL (1 << 1)
1119 __u64 iova; /* IO virtual address */1127 __u64 iova; /* IO virtual address */
1120 __u64 size; /* Size of mapping (bytes) */1128 __u64 size; /* Size of mapping (bytes) */
1121 __u8 data[];1129 __u8 data[];