This adds ioctl for userspace to bind device cdev fd to iommufd. VFIO_DEVICE_BIND_IOMMUFD: bind device to an iommufd, hence gain DMA control provided by the iommufd. open_device op is called after bind_iommufd op.
Showing the changes to include/uapi (1 of 5 files). Show all
Unified · Split
| @@ -897,6 +897,33 @@ struct vfio_device_feature { · 896 unmodified lines | |||
| 897 | 897 | ||
| 898 | #define VFIO_DEVICE_FEATURE _IO(VFIO_TYPE, VFIO_BASE + 17) | 898 | #define VFIO_DEVICE_FEATURE _IO(VFIO_TYPE, VFIO_BASE + 17) |
| 899 | 899 | ||
| 900 | /* | ||
| 901 | * VFIO_DEVICE_BIND_IOMMUFD - _IOR(VFIO_TYPE, VFIO_BASE + 18, | ||
| 902 | * struct vfio_device_bind_iommufd) | ||
| 903 | * @argsz: User filled size of this data. | ||
| 904 | * @flags: Must be 0. | ||
| 905 | * @iommufd: iommufd to bind. | ||
| 906 | * @out_devid: The device id generated by this bind. devid is a handle for | ||
| 907 | * this device/iommufd bond and can be used in IOMMUFD commands. | ||
| 908 | * | ||
| 909 | * Bind a vfio_device to the specified iommufd. | ||
| 910 | * | ||
| 911 | * User is restricted from accessing the device before the binding operation | ||
| 912 | * is completed. Only allowed on cdev fds. | ||
| 913 | * | ||
| 914 | * Unbind is automatically conducted when device fd is closed. | ||
| 915 | * | ||
| 916 | * Return: 0 on success, -errno on failure. | ||
| 917 | */ | ||
| 918 | struct vfio_device_bind_iommufd { | ||
| 919 | __u32 argsz; | ||
| 920 | __u32 flags; | ||
| 921 | __s32 iommufd; | ||
| 922 | __u32 out_devid; | ||
| 923 | }; | ||
| 924 | |||
| 925 | #define VFIO_DEVICE_BIND_IOMMUFD _IO(VFIO_TYPE, VFIO_BASE + 18) | ||
| 926 | |||
| 900 | /* | 927 | /* |
| 901 | * Provide support for setting a PCI VF Token, which is used as a shared | 928 | * Provide support for setting a PCI VF Token, which is used as a shared |
| 902 | * secret between PF and VF drivers. This feature may only be set on a | 929 | * secret between PF and VF drivers. This feature may only be set on a |