Skip to content

Commit

Permalink
drm/amdkfd: Add placeholder for deprecated CMA ioctl
Browse files Browse the repository at this point in the history
Implement a dummy ioctl to avoid undefined behaviour.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
  • Loading branch information
Felix Kuehling authored and Leslie Shi committed Aug 25, 2022
1 parent 80bbcfd commit c4c2369
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
11 changes: 10 additions & 1 deletion drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1940,6 +1940,13 @@ static int kfd_ioctl_dbg_set_debug_trap(struct file *filep,
return r;
}

/* Place holder for deprecated CMA API */
static int kfd_ioctl_cross_memory_copy_deprecated(struct file *filep,
struct kfd_process *local_p, void *data) {
dev_dbg(kfd_device, "AMDKFD_IOC_CROSS_MEMORY_COPY is deprecated.\n");
return -EINVAL;
}

/* Handle requests for watching SMI events */
static int kfd_ioctl_smi_events(struct file *filep,
struct kfd_process *p, void *data)
Expand Down Expand Up @@ -3237,9 +3244,11 @@ static const struct amdkfd_ioctl_desc amdkfd_ioctls[] = {
AMDKFD_IOCTL_DEF(AMDKFD_IOC_DBG_TRAP,
kfd_ioctl_dbg_set_debug_trap, 0),

AMDKFD_IOCTL_DEF(AMDKFD_IOC_CROSS_MEMORY_COPY_DEPRECATED,
kfd_ioctl_cross_memory_copy_deprecated, 0),

AMDKFD_IOCTL_DEF(AMDKFD_IOC_RLC_SPM,
kfd_ioctl_rlc_spm, 0),

};

static long kfd_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
Expand Down
21 changes: 20 additions & 1 deletion include/uapi/linux/kfd_ioctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,23 @@ struct kfd_ioctl_ipc_import_handle_args {
__u32 flags; /* from KFD */
};

struct kfd_ioctl_cross_memory_copy_deprecated_args {
/* to KFD: Process ID of the remote process */
__u32 pid;
/* to KFD: See above definition */
__u32 flags;
/* to KFD: Source GPU VM range */
__u64 src_mem_range_array;
/* to KFD: Size of above array */
__u64 src_mem_array_size;
/* to KFD: Destination GPU VM range */
__u64 dst_mem_range_array;
/* to KFD: Size of above array */
__u64 dst_mem_array_size;
/* from KFD: Total amount of bytes copied */
__u64 bytes_copied;
};

/* Guarantee host access to memory */
#define KFD_IOCTL_SVM_FLAG_HOST_ACCESS 0x00000001
/* Fine grained coherency between all devices with access */
Expand Down Expand Up @@ -1364,10 +1381,12 @@ struct kfd_ioctl_set_xnack_mode_args {
#define AMDKFD_IOC_DBG_TRAP \
AMDKFD_IOWR(0x82, struct kfd_ioctl_dbg_trap_args)

#define AMDKFD_IOC_CROSS_MEMORY_COPY_DEPRECATED \
AMDKFD_IOWR(0x83, struct kfd_ioctl_cross_memory_copy_deprecated_args)

#define AMDKFD_IOC_RLC_SPM \
AMDKFD_IOWR(0x84, struct kfd_ioctl_spm_args)


#define AMDKFD_COMMAND_START_2 0x80
#define AMDKFD_COMMAND_END_2 0x85

Expand Down

0 comments on commit c4c2369

Please sign in to comment.