Pull VFIO updatesfrom Alex Williamson: - Virtual address update handling (Steve Sistare) - s390/zpci fixes and cleanups (Max Gurtovoy) - Fixes for dirty bitmap handling, non-mdev page pinning, and improved pinned dirty scope tracking (Keqian Zhu) - Batched page pinning enhancement (Daniel Jordan) - Page access permission fix (Alex Williamson) * tag 'vfio-v5.12-rc1' of git://github.com/awilliam/linux-vfio: (21 commits) vfio/type1: Batch page pinning vfio/type1: Prepare for batched pinning with struct vfio_batch vfio/type1: Change success value of vaddr_get_pfn() vfio/type1: Use follow_pte() vfio/pci: remove CONFIG_VFIO_PCI_ZDEV from Kconfig vfio/iommu_type1: Fix duplicate included kthread.h vfio-pci/zdev: fix possible segmentation fault issue vfio-pci/zdev: remove unused vdev argument vfio/pci: Fix handling of pci use accessor return codes vfio/iommu_type1: Mantain a counter for non_pinned_groups vfio/iommu_type1: Fix some sanity checks in detach group vfio/iommu_type1: Populate full dirty when detach non-pinned group vfio/type1: block on invalid vaddr vfio/type1: implement notify callback vfio: iommu driver notify callback vfio/type1: implement interfaces to update vaddr vfio/type1: massage unmap iteration vfio: interfaces to update vaddr vfio/type1: implement unmap all vfio/type1: unmap cleanup ...
Showing the changes to include/uapi (1 of 10 files). Show all
Unified · Split
| @@ -46,6 +46,12 @@ · 45 unmodified lines | ||
| 46 | 46 | */ |
| 47 | 47 | #define VFIO_NOIOMMU_IOMMU 8 |
| 48 | 48 | |
| 49 | +/* Supports VFIO_DMA_UNMAP_FLAG_ALL */ | |
| 50 | +#define VFIO_UNMAP_ALL 9 | |
| 51 | + | |
| 52 | +/* Supports the vaddr flag for DMA map and unmap */ | |
| 53 | +#define VFIO_UPDATE_VADDR 10 | |
| 54 | + | |
| 49 | 55 | /* |
| 50 | 56 | * The IOCTL interface is designed for extensibility by embedding the |
| 51 | 57 | * structure length (argsz) and flags into structures passed between |
| @@ -1074,12 +1080,22 @@ struct vfio_iommu_type1_info_dma_avail { · 1022 unmodified lines | ||
| 1074 | 1080 | * |
| 1075 | 1081 | * Map process virtual addresses to IO virtual addresses using the |
| 1076 | 1082 | * provided struct vfio_dma_map. Caller sets argsz. READ &/ WRITE required. |
| 1083 | + * | |
| 1084 | + * If flags & VFIO_DMA_MAP_FLAG_VADDR, update the base vaddr for iova, and | |
| 1085 | + * unblock translation of host virtual addresses in the iova range. The vaddr | |
| 1086 | + * must have previously been invalidated with VFIO_DMA_UNMAP_FLAG_VADDR. To | |
| 1087 | + * maintain memory consistency within the user application, the updated vaddr | |
| 1088 | + * must address the same memory object as originally mapped. Failure to do so | |
| 1089 | + * will result in user memory corruption and/or device misbehavior. iova and | |
| 1090 | + * size must match those in the original MAP_DMA call. Protection is not | |
| 1091 | + * changed, and the READ & WRITE flags must be 0. | |
| 1077 | 1092 | */ |
| 1078 | 1093 | struct vfio_iommu_type1_dma_map { |
| 1079 | 1094 | __u32 argsz; |
| 1080 | 1095 | __u32 flags; |
| 1081 | 1096 | #define VFIO_DMA_MAP_FLAG_READ (1 << 0) /* readable from device */ |
| 1082 | 1097 | #define VFIO_DMA_MAP_FLAG_WRITE (1 << 1) /* writable from device */ |
| 1098 | +#define VFIO_DMA_MAP_FLAG_VADDR (1 << 2) | |
| 1083 | 1099 | __u64 vaddr; /* Process virtual address */ |
| 1084 | 1100 | __u64 iova; /* IO virtual address */ |
| 1085 | 1101 | __u64 size; /* Size of mapping (bytes) */ |
| @@ -1102,6 +1118,7 @@ struct vfio_bitmap { · 16 unmodified lines | ||
| 1102 | 1118 | * field. No guarantee is made to the user that arbitrary unmaps of iova |
| 1103 | 1119 | * or size different from those used in the original mapping call will |
| 1104 | 1120 | * succeed. |
| 1121 | + * | |
| 1105 | 1122 | * VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP should be set to get the dirty bitmap |
| 1106 | 1123 | * before unmapping IO virtual addresses. When this flag is set, the user must |
| 1107 | 1124 | * provide a struct vfio_bitmap in data[]. User must provide zero-allocated |
| @@ -1111,11 +1128,21 @@ struct vfio_bitmap { · 3 unmodified lines | ||
| 1111 | 1128 | * indicates that the page at that offset from iova is dirty. A Bitmap of the |
| 1112 | 1129 | * pages in the range of unmapped size is returned in the user-provided |
| 1113 | 1130 | * vfio_bitmap.data. |
| 1131 | + * | |
| 1132 | + * If flags & VFIO_DMA_UNMAP_FLAG_ALL, unmap all addresses. iova and size | |
| 1133 | + * must be 0. This cannot be combined with the get-dirty-bitmap flag. | |
| 1134 | + * | |
| 1135 | + * If flags & VFIO_DMA_UNMAP_FLAG_VADDR, do not unmap, but invalidate host | |
| 1136 | + * virtual addresses in the iova range. Tasks that attempt to translate an | |
| 1137 | + * iova's vaddr will block. DMA to already-mapped pages continues. This | |
| 1138 | + * cannot be combined with the get-dirty-bitmap flag. | |
| 1114 | 1139 | */ |
| 1115 | 1140 | struct vfio_iommu_type1_dma_unmap { |
| 1116 | 1141 | __u32 argsz; |
| 1117 | 1142 | __u32 flags; |
| 1118 | 1143 | #define VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP (1 << 0) |
| 1144 | +#define VFIO_DMA_UNMAP_FLAG_ALL (1 << 1) | |
| 1145 | +#define VFIO_DMA_UNMAP_FLAG_VADDR (1 << 2) | |
| 1119 | 1146 | __u64 iova; /* IO virtual address */ |
| 1120 | 1147 | __u64 size; /* Size of mapping (bytes) */ |
| 1121 | 1148 | __u8 data[]; |