Commit f7a60e7d authored by Stefano Garzarella's avatar Stefano Garzarella Committed by jiangdongxu
Browse files

vdpa: add bind_mm/unbind_mm callbacks

mainline inclusion
from mainline-v6.4-rc1
commit 9067de47
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I86ITO
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9067de4725a299bc1baf11de9f5040fdd0bd05c3



----------------------------------------------------------------------

These new optional callbacks is used to bind/unbind the device to
a specific address space so the vDPA framework can use VA when
these callbacks are implemented.

Suggested-by: default avatarJason Wang <jasowang@redhat.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>
Signed-off-by: default avatarStefano Garzarella <sgarzare@redhat.com>
Message-Id: <20230404131326.44403-2-sgarzare@redhat.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarjiangdongxu <jiangdongxu1@huawei.com>
parent 44b974a9
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -282,6 +282,14 @@ struct vdpa_map_file {
 *				@iova: iova to be unmapped
 *				@size: size of the area
 *				Returns integer: success (0) or error (< 0)
 * @bind_mm:			Bind the device to a specific address space
 *				so the vDPA framework can use VA when this
 *				callback is implemented. (optional)
 *				@vdev: vdpa device
 *				@mm: address space to bind
 * @unbind_mm:			Unbind the device from the address space
 *				bound using the bind_mm callback. (optional)
 *				@vdev: vdpa device
 * @free:			Free resources that belongs to vDPA (optional)
 *				@vdev: vdpa device
 */
@@ -342,6 +350,8 @@ struct vdpa_config_ops {
			 u64 iova, u64 size);
	int (*set_group_asid)(struct vdpa_device *vdev, unsigned int group,
			      unsigned int asid);
	int (*bind_mm)(struct vdpa_device *vdev, struct mm_struct *mm);
	void (*unbind_mm)(struct vdpa_device *vdev);

	/* Free device resources */
	void (*free)(struct vdpa_device *vdev);