diff options
author | Alex Williamson <alex.williamson@redhat.com> | 2012-07-31 10:16:23 -0400 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2012-07-31 10:16:23 -0400 |
commit | 73fa0d10d077d9521ee2dace2307ae2c9a965336 (patch) | |
tree | 2c820b194dd8ea00f23d85c382e86ea6c3beb498 /include/linux/vfio.h | |
parent | 4a5b2a20ec87384eeb19e70991e7e15a00cad87b (diff) |
vfio: Type1 IOMMU implementation
This VFIO IOMMU backend is designed primarily for AMD-Vi and Intel
VT-d hardware, but is potentially usable by anything supporting
similar mapping functionality. We arbitrarily call this a Type1
backend for lack of a better name. This backend has no IOVA
or host memory mapping restrictions for the user and is optimized
for relatively static mappings. Mapped areas are pinned into system
memory.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
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 */ |