diff options
Diffstat (limited to 'include/linux/vfio.h')
| -rw-r--r-- | include/linux/vfio.h | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/include/linux/vfio.h b/include/linux/vfio.h index 03e56a5154b6..acb046fd5b70 100644 --- a/include/linux/vfio.h +++ b/include/linux/vfio.h | |||
| @@ -98,7 +98,7 @@ extern void vfio_unregister_iommu_driver( | |||
| 98 | 98 | ||
| 99 | /* Extensions */ | 99 | /* Extensions */ |
| 100 | 100 | ||
| 101 | /* None yet */ | 101 | #define VFIO_TYPE1_IOMMU 1 |
| 102 | 102 | ||
| 103 | /* | 103 | /* |
| 104 | * The IOCTL interface is designed for extensibility by embedding the | 104 | * The IOCTL interface is designed for extensibility by embedding the |
| @@ -364,4 +364,56 @@ struct vfio_irq_set { | |||
| 364 | */ | 364 | */ |
| 365 | #define VFIO_DEVICE_RESET _IO(VFIO_TYPE, VFIO_BASE + 11) | 365 | #define VFIO_DEVICE_RESET _IO(VFIO_TYPE, VFIO_BASE + 11) |
| 366 | 366 | ||
| 367 | /* -------- API for Type1 VFIO IOMMU -------- */ | ||
| 368 | |||
| 369 | /** | ||
| 370 | * VFIO_IOMMU_GET_INFO - _IOR(VFIO_TYPE, VFIO_BASE + 12, struct vfio_iommu_info) | ||
| 371 | * | ||
| 372 | * Retrieve information about the IOMMU object. Fills in provided | ||
| 373 | * struct vfio_iommu_info. Caller sets argsz. | ||
| 374 | * | ||
| 375 | * XXX Should we do these by CHECK_EXTENSION too? | ||
| 376 | */ | ||
| 377 | struct vfio_iommu_type1_info { | ||
| 378 | __u32 argsz; | ||
| 379 | __u32 flags; | ||
| 380 | #define VFIO_IOMMU_INFO_PGSIZES (1 << 0) /* supported page sizes info */ | ||
| 381 | __u64 iova_pgsizes; /* Bitmap of supported page sizes */ | ||
| 382 | }; | ||
| 383 | |||
| 384 | #define VFIO_IOMMU_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12) | ||
| 385 | |||
| 386 | /** | ||
| 387 | * VFIO_IOMMU_MAP_DMA - _IOW(VFIO_TYPE, VFIO_BASE + 13, struct vfio_dma_map) | ||
| 388 | * | ||
| 389 | * Map process virtual addresses to IO virtual addresses using the | ||
| 390 | * provided struct vfio_dma_map. Caller sets argsz. READ &/ WRITE required. | ||
| 391 | */ | ||
| 392 | struct vfio_iommu_type1_dma_map { | ||
| 393 | __u32 argsz; | ||
| 394 | __u32 flags; | ||
| 395 | #define VFIO_DMA_MAP_FLAG_READ (1 << 0) /* readable from device */ | ||
| 396 | #define VFIO_DMA_MAP_FLAG_WRITE (1 << 1) /* writable from device */ | ||
| 397 | __u64 vaddr; /* Process virtual address */ | ||
| 398 | __u64 iova; /* IO virtual address */ | ||
| 399 | __u64 size; /* Size of mapping (bytes) */ | ||
| 400 | }; | ||
| 401 | |||
| 402 | #define VFIO_IOMMU_MAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 13) | ||
| 403 | |||
| 404 | /** | ||
| 405 | * VFIO_IOMMU_UNMAP_DMA - _IOW(VFIO_TYPE, VFIO_BASE + 14, struct vfio_dma_unmap) | ||
| 406 | * | ||
| 407 | * Unmap IO virtual addresses using the provided struct vfio_dma_unmap. | ||
| 408 | * Caller sets argsz. | ||
| 409 | */ | ||
| 410 | struct vfio_iommu_type1_dma_unmap { | ||
| 411 | __u32 argsz; | ||
| 412 | __u32 flags; | ||
| 413 | __u64 iova; /* IO virtual address */ | ||
| 414 | __u64 size; /* Size of mapping (bytes) */ | ||
| 415 | }; | ||
| 416 | |||
| 417 | #define VFIO_IOMMU_UNMAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 14) | ||
| 418 | |||
| 367 | #endif /* VFIO_H */ | 419 | #endif /* VFIO_H */ |
