This allows the user-space to retrieve the supported IOVA range(s), excluding any non-relaxable reserved regions. The implementation is based on capability chains, added to VFIO_IOMMU_GET_INFO ioctl.
Showing the changes to include/uapi/linux (1 of 2 files). Show all
Unified · Split
| @@ -714,7 +714,31 @@ struct vfio_iommu_type1_info { · 713 unmodified lines | ||
| 714 | 714 | __u32 argsz; |
| 715 | 715 | __u32 flags; |
| 716 | 716 | #define VFIO_IOMMU_INFO_PGSIZES (1 << 0) /* supported page sizes info */ |
| 717 | − __u64 iova_pgsizes; /* Bitmap of supported page sizes */ | |
| 717 | +#define VFIO_IOMMU_INFO_CAPS (1 << 1) /* Info supports caps */ | |
| 718 | + __u64 iova_pgsizes; /* Bitmap of supported page sizes */ | |
| 719 | + __u32 cap_offset; /* Offset within info struct of first cap */ | |
| 720 | +}; | |
| 721 | + | |
| 722 | +/* | |
| 723 | + * The IOVA capability allows to report the valid IOVA range(s) | |
| 724 | + * excluding any non-relaxable reserved regions exposed by | |
| 725 | + * devices attached to the container. Any DMA map attempt | |
| 726 | + * outside the valid iova range will return error. | |
| 727 | + * | |
| 728 | + * The structures below define version 1 of this capability. | |
| 729 | + */ | |
| 730 | +#define VFIO_IOMMU_TYPE1_INFO_CAP_IOVA_RANGE 1 | |
| 731 | + | |
| 732 | +struct vfio_iova_range { | |
| 733 | + __u64 start; | |
| 734 | + __u64 end; | |
| 735 | +}; | |
| 736 | + | |
| 737 | +struct vfio_iommu_type1_info_cap_iova_range { | |
| 738 | + struct vfio_info_cap_header header; | |
| 739 | + __u32 nr_iovas; | |
| 740 | + __u32 reserved; | |
| 741 | + struct vfio_iova_range iova_ranges[]; | |
| 718 | 742 | }; |
| 719 | 743 | |
| 720 | 744 | #define VFIO_IOMMU_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12) |