@@ -67,6 +67,7 @@ struct vfio_device {
67
67
struct inode * inode ;
68
68
#if IS_ENABLED (CONFIG_IOMMUFD )
69
69
struct iommufd_device * iommufd_device ;
70
+ struct ida pasids ;
70
71
u8 iommufd_attached :1 ;
71
72
#endif
72
73
u8 cdev_opened :1 ;
@@ -91,6 +92,8 @@ struct vfio_device {
91
92
* bound iommufd. Undo in unbind_iommufd if @detach_ioas is not
92
93
* called.
93
94
* @detach_ioas: Opposite of attach_ioas
95
+ * @pasid_attach_ioas: The pasid variation of attach_ioas
96
+ * @pasid_detach_ioas: Opposite of pasid_attach_ioas
94
97
* @open_device: Called when the first file descriptor is opened for this device
95
98
* @close_device: Opposite of open_device
96
99
* @read: Perform read(2) on device file descriptor
@@ -115,6 +118,9 @@ struct vfio_device_ops {
115
118
void (* unbind_iommufd )(struct vfio_device * vdev );
116
119
int (* attach_ioas )(struct vfio_device * vdev , u32 * pt_id );
117
120
void (* detach_ioas )(struct vfio_device * vdev );
121
+ int (* pasid_attach_ioas )(struct vfio_device * vdev , u32 pasid ,
122
+ u32 * pt_id );
123
+ void (* pasid_detach_ioas )(struct vfio_device * vdev , u32 pasid );
118
124
int (* open_device )(struct vfio_device * vdev );
119
125
void (* close_device )(struct vfio_device * vdev );
120
126
ssize_t (* read )(struct vfio_device * vdev , char __user * buf ,
@@ -139,6 +145,10 @@ int vfio_iommufd_physical_bind(struct vfio_device *vdev,
139
145
void vfio_iommufd_physical_unbind (struct vfio_device * vdev );
140
146
int vfio_iommufd_physical_attach_ioas (struct vfio_device * vdev , u32 * pt_id );
141
147
void vfio_iommufd_physical_detach_ioas (struct vfio_device * vdev );
148
+ int vfio_iommufd_physical_pasid_attach_ioas (struct vfio_device * vdev ,
149
+ u32 pasid , u32 * pt_id );
150
+ void vfio_iommufd_physical_pasid_detach_ioas (struct vfio_device * vdev ,
151
+ u32 pasid );
142
152
int vfio_iommufd_emulated_bind (struct vfio_device * vdev ,
143
153
struct iommufd_ctx * ictx , u32 * out_device_id );
144
154
void vfio_iommufd_emulated_unbind (struct vfio_device * vdev );
@@ -166,6 +176,10 @@ vfio_iommufd_get_dev_id(struct vfio_device *vdev, struct iommufd_ctx *ictx)
166
176
((int (*)(struct vfio_device *vdev, u32 *pt_id)) NULL)
167
177
#define vfio_iommufd_physical_detach_ioas \
168
178
((void (*)(struct vfio_device *vdev)) NULL)
179
+ #define vfio_iommufd_physical_pasid_attach_ioas \
180
+ ((int (*)(struct vfio_device *vdev, u32 pasid, u32 *pt_id)) NULL)
181
+ #define vfio_iommufd_physical_pasid_detach_ioas \
182
+ ((void (*)(struct vfio_device *vdev, u32 pasid)) NULL)
169
183
#define vfio_iommufd_emulated_bind \
170
184
((int (*)(struct vfio_device *vdev, struct iommufd_ctx *ictx, \
171
185
u32 *out_device_id)) NULL)
0 commit comments