mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-02-16 21:15:10 -05:00
drm/msm: Add VM_BIND ioctl
Add a VM_BIND ioctl for binding/unbinding buffers into a VM. This is only supported if userspace has opted in to MSM_PARAM_EN_VM_BIND. Signed-off-by: Rob Clark <robdclark@chromium.org> Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com> Tested-by: Antonino Maniscalco <antomani103@gmail.com> Reviewed-by: Antonino Maniscalco <antomani103@gmail.com> Patchwork: https://patchwork.freedesktop.org/patch/661524/
This commit is contained in:
@@ -272,7 +272,10 @@ struct drm_msm_gem_submit_cmd {
|
||||
__u32 size; /* in, cmdstream size */
|
||||
__u32 pad;
|
||||
__u32 nr_relocs; /* in, number of submit_reloc's */
|
||||
__u64 relocs; /* in, ptr to array of submit_reloc's */
|
||||
union {
|
||||
__u64 relocs; /* in, ptr to array of submit_reloc's */
|
||||
__u64 iova; /* cmdstream address (for VM_BIND contexts) */
|
||||
};
|
||||
};
|
||||
|
||||
/* Each buffer referenced elsewhere in the cmdstream submit (ie. the
|
||||
@@ -339,7 +342,74 @@ struct drm_msm_gem_submit {
|
||||
__u32 nr_out_syncobjs; /* in, number of entries in out_syncobj. */
|
||||
__u32 syncobj_stride; /* in, stride of syncobj arrays. */
|
||||
__u32 pad; /*in, reserved for future use, always 0. */
|
||||
};
|
||||
|
||||
#define MSM_VM_BIND_OP_UNMAP 0
|
||||
#define MSM_VM_BIND_OP_MAP 1
|
||||
#define MSM_VM_BIND_OP_MAP_NULL 2
|
||||
|
||||
#define MSM_VM_BIND_OP_DUMP 1
|
||||
#define MSM_VM_BIND_OP_FLAGS ( \
|
||||
MSM_VM_BIND_OP_DUMP | \
|
||||
0)
|
||||
|
||||
/**
|
||||
* struct drm_msm_vm_bind_op - bind/unbind op to run
|
||||
*/
|
||||
struct drm_msm_vm_bind_op {
|
||||
/** @op: one of MSM_VM_BIND_OP_x */
|
||||
__u32 op;
|
||||
/** @handle: GEM object handle, MBZ for UNMAP or MAP_NULL */
|
||||
__u32 handle;
|
||||
/** @obj_offset: Offset into GEM object, MBZ for UNMAP or MAP_NULL */
|
||||
__u64 obj_offset;
|
||||
/** @iova: Address to operate on */
|
||||
__u64 iova;
|
||||
/** @range: Number of bites to to map/unmap */
|
||||
__u64 range;
|
||||
/** @flags: Bitmask of MSM_VM_BIND_OP_FLAG_x */
|
||||
__u32 flags;
|
||||
/** @pad: MBZ */
|
||||
__u32 pad;
|
||||
};
|
||||
|
||||
#define MSM_VM_BIND_FENCE_FD_IN 0x00000001
|
||||
#define MSM_VM_BIND_FENCE_FD_OUT 0x00000002
|
||||
#define MSM_VM_BIND_FLAGS ( \
|
||||
MSM_VM_BIND_FENCE_FD_IN | \
|
||||
MSM_VM_BIND_FENCE_FD_OUT | \
|
||||
0)
|
||||
|
||||
/**
|
||||
* struct drm_msm_vm_bind - Input of &DRM_IOCTL_MSM_VM_BIND
|
||||
*/
|
||||
struct drm_msm_vm_bind {
|
||||
/** @flags: in, bitmask of MSM_VM_BIND_x */
|
||||
__u32 flags;
|
||||
/** @nr_ops: the number of bind ops in this ioctl */
|
||||
__u32 nr_ops;
|
||||
/** @fence_fd: in/out fence fd (see MSM_VM_BIND_FENCE_FD_IN/OUT) */
|
||||
__s32 fence_fd;
|
||||
/** @queue_id: in, submitqueue id */
|
||||
__u32 queue_id;
|
||||
/** @in_syncobjs: in, ptr to array of drm_msm_gem_syncobj */
|
||||
__u64 in_syncobjs;
|
||||
/** @out_syncobjs: in, ptr to array of drm_msm_gem_syncobj */
|
||||
__u64 out_syncobjs;
|
||||
/** @nr_in_syncobjs: in, number of entries in in_syncobj */
|
||||
__u32 nr_in_syncobjs;
|
||||
/** @nr_out_syncobjs: in, number of entries in out_syncobj */
|
||||
__u32 nr_out_syncobjs;
|
||||
/** @syncobj_stride: in, stride of syncobj arrays */
|
||||
__u32 syncobj_stride;
|
||||
/** @op_stride: sizeof each struct drm_msm_vm_bind_op in @ops */
|
||||
__u32 op_stride;
|
||||
union {
|
||||
/** @op: used if num_ops == 1 */
|
||||
struct drm_msm_vm_bind_op op;
|
||||
/** @ops: userptr to array of drm_msm_vm_bind_op if num_ops > 1 */
|
||||
__u64 ops;
|
||||
};
|
||||
};
|
||||
|
||||
#define MSM_WAIT_FENCE_BOOST 0x00000001
|
||||
@@ -435,6 +505,7 @@ struct drm_msm_submitqueue_query {
|
||||
#define DRM_MSM_SUBMITQUEUE_NEW 0x0A
|
||||
#define DRM_MSM_SUBMITQUEUE_CLOSE 0x0B
|
||||
#define DRM_MSM_SUBMITQUEUE_QUERY 0x0C
|
||||
#define DRM_MSM_VM_BIND 0x0D
|
||||
|
||||
#define DRM_IOCTL_MSM_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GET_PARAM, struct drm_msm_param)
|
||||
#define DRM_IOCTL_MSM_SET_PARAM DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_SET_PARAM, struct drm_msm_param)
|
||||
@@ -448,6 +519,7 @@ struct drm_msm_submitqueue_query {
|
||||
#define DRM_IOCTL_MSM_SUBMITQUEUE_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_SUBMITQUEUE_NEW, struct drm_msm_submitqueue)
|
||||
#define DRM_IOCTL_MSM_SUBMITQUEUE_CLOSE DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_SUBMITQUEUE_CLOSE, __u32)
|
||||
#define DRM_IOCTL_MSM_SUBMITQUEUE_QUERY DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_SUBMITQUEUE_QUERY, struct drm_msm_submitqueue_query)
|
||||
#define DRM_IOCTL_MSM_VM_BIND DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_VM_BIND, struct drm_msm_vm_bind)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user