Commit c98fe7c2 authored by Steve Sistare's avatar Steve Sistare Committed by Alex Williamson

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.
Signed-off-by: default avatarSteve Sistare <steven.sistare@oracle.com>
Reviewed-by: default avatarCornelia Huck <cohuck@redhat.com>
Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
parent 1048ba83
...@@ -46,6 +46,9 @@ ...@@ -46,6 +46,9 @@
*/ */
#define VFIO_NOIOMMU_IOMMU 8 #define VFIO_NOIOMMU_IOMMU 8
/* Supports VFIO_DMA_UNMAP_FLAG_ALL */
#define VFIO_UNMAP_ALL 9
/* /*
* The IOCTL interface is designed for extensibility by embedding the * The IOCTL interface is designed for extensibility by embedding the
* structure length (argsz) and flags into structures passed between * structure length (argsz) and flags into structures passed between
...@@ -1102,6 +1105,7 @@ struct vfio_bitmap { ...@@ -1102,6 +1105,7 @@ struct vfio_bitmap {
* field. No guarantee is made to the user that arbitrary unmaps of iova * field. No guarantee is made to the user that arbitrary unmaps of iova
* or size different from those used in the original mapping call will * or size different from those used in the original mapping call will
* succeed. * succeed.
*
* VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP should be set to get the dirty bitmap * VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP should be set to get the dirty bitmap
* before unmapping IO virtual addresses. When this flag is set, the user must * before unmapping IO virtual addresses. When this flag is set, the user must
* provide a struct vfio_bitmap in data[]. User must provide zero-allocated * provide a struct vfio_bitmap in data[]. User must provide zero-allocated
...@@ -1111,11 +1115,15 @@ struct vfio_bitmap { ...@@ -1111,11 +1115,15 @@ struct vfio_bitmap {
* indicates that the page at that offset from iova is dirty. A Bitmap of the * indicates that the page at that offset from iova is dirty. A Bitmap of the
* pages in the range of unmapped size is returned in the user-provided * pages in the range of unmapped size is returned in the user-provided
* vfio_bitmap.data. * vfio_bitmap.data.
*
* If flags & VFIO_DMA_UNMAP_FLAG_ALL, unmap all addresses. iova and size
* must be 0. This cannot be combined with the get-dirty-bitmap flag.
*/ */
struct vfio_iommu_type1_dma_unmap { struct vfio_iommu_type1_dma_unmap {
__u32 argsz; __u32 argsz;
__u32 flags; __u32 flags;
#define VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP (1 << 0) #define VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP (1 << 0)
#define VFIO_DMA_UNMAP_FLAG_ALL (1 << 1)
__u64 iova; /* IO virtual address */ __u64 iova; /* IO virtual address */
__u64 size; /* Size of mapping (bytes) */ __u64 size; /* Size of mapping (bytes) */
__u8 data[]; __u8 data[];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment