@@ -931,29 +931,34 @@ struct vfio_device_bind_iommufd {
931
931
* VFIO_DEVICE_ATTACH_IOMMUFD_PT - _IOW(VFIO_TYPE, VFIO_BASE + 19,
932
932
* struct vfio_device_attach_iommufd_pt)
933
933
* @argsz: User filled size of this data.
934
- * @flags: Must be 0 .
934
+ * @flags: Flags for attach .
935
935
* @pt_id: Input the target id which can represent an ioas or a hwpt
936
936
* allocated via iommufd subsystem.
937
937
* Output the input ioas id or the attached hwpt id which could
938
938
* be the specified hwpt itself or a hwpt automatically created
939
939
* for the specified ioas by kernel during the attachment.
940
+ * @pasid: The pasid to be attached, only meaningful when
941
+ * VFIO_DEVICE_ATTACH_PASID is set in @flags
940
942
*
941
943
* Associate the device with an address space within the bound iommufd.
942
944
* Undo by VFIO_DEVICE_DETACH_IOMMUFD_PT or device fd close. This is only
943
945
* allowed on cdev fds.
944
946
*
945
- * If a vfio device is currently attached to a valid hw_pagetable, without doing
946
- * a VFIO_DEVICE_DETACH_IOMMUFD_PT, a second VFIO_DEVICE_ATTACH_IOMMUFD_PT ioctl
947
- * passing in another hw_pagetable (hwpt) id is allowed. This action, also known
948
- * as a hw_pagetable replacement, will replace the device's currently attached
949
- * hw_pagetable with a new hw_pagetable corresponding to the given pt_id.
947
+ * If a vfio device or a pasid of this device is currently attached to a valid
948
+ * hw_pagetable (hwpt), without doing a VFIO_DEVICE_DETACH_IOMMUFD_PT, a second
949
+ * VFIO_DEVICE_ATTACH_IOMMUFD_PT ioctl passing in another hwpt id is allowed.
950
+ * This action, also known as a hw_pagetable replacement, will replace the
951
+ * currently attached hwpt of the device or the pasid of this device with a new
952
+ * hwpt corresponding to the given pt_id.
950
953
*
951
954
* Return: 0 on success, -errno on failure.
952
955
*/
953
956
struct vfio_device_attach_iommufd_pt {
954
957
__u32 argsz ;
955
958
__u32 flags ;
959
+ #define VFIO_DEVICE_ATTACH_PASID (1 << 0)
956
960
__u32 pt_id ;
961
+ __u32 pasid ;
957
962
};
958
963
959
964
#define VFIO_DEVICE_ATTACH_IOMMUFD_PT _IO(VFIO_TYPE, VFIO_BASE + 19)
@@ -962,17 +967,21 @@ struct vfio_device_attach_iommufd_pt {
962
967
* VFIO_DEVICE_DETACH_IOMMUFD_PT - _IOW(VFIO_TYPE, VFIO_BASE + 20,
963
968
* struct vfio_device_detach_iommufd_pt)
964
969
* @argsz: User filled size of this data.
965
- * @flags: Must be 0.
970
+ * @flags: Flags for detach.
971
+ * @pasid: The pasid to be detached, only meaningful when
972
+ * VFIO_DEVICE_DETACH_PASID is set in @flags
966
973
*
967
- * Remove the association of the device and its current associated address
968
- * space. After it, the device should be in a blocking DMA state. This is only
969
- * allowed on cdev fds.
974
+ * Remove the association of the device or a pasid of the device and its current
975
+ * associated address space. After it, the device or the pasid should be in a
976
+ * blocking DMA state. This is only allowed on cdev fds.
970
977
*
971
978
* Return: 0 on success, -errno on failure.
972
979
*/
973
980
struct vfio_device_detach_iommufd_pt {
974
981
__u32 argsz ;
975
982
__u32 flags ;
983
+ #define VFIO_DEVICE_DETACH_PASID (1 << 0)
984
+ __u32 pasid ;
976
985
};
977
986
978
987
#define VFIO_DEVICE_DETACH_IOMMUFD_PT _IO(VFIO_TYPE, VFIO_BASE + 20)
0 commit comments