diff options
author | Oded Gabbay <oded.gabbay@amd.com> | 2014-12-05 03:40:34 -0500 |
---|---|---|
committer | Oded Gabbay <oded.gabbay@amd.com> | 2014-12-05 15:01:35 -0500 |
commit | a18069c132cb0d065ff23c05977d06ea0c78404f (patch) | |
tree | 0801554a71620dadf55f319e2936f17f2df049fa | |
parent | 7608867d0c4d9da30e9efe6a53ff4ee1e6c4990b (diff) |
amdkfd: Disable support for 32-bit user processes
This patch checks if the process that opens the /dev/kfd device is 32-bit
process. If so, it returns -EPERM and prints a warning message in dmesg.
This is done to prevent 32-bit user processes from using amdkfd, and hence, HSA
features.
AMD's HSA userspace stack will also support only 64-bit processes on Linux.
Reviewed-by: Alexey Skidanov <alexey.skidanov@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c index 102cd36799b1..4f7b275f2f7b 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | |||
@@ -102,15 +102,26 @@ struct device *kfd_chardev(void) | |||
102 | static int kfd_open(struct inode *inode, struct file *filep) | 102 | static int kfd_open(struct inode *inode, struct file *filep) |
103 | { | 103 | { |
104 | struct kfd_process *process; | 104 | struct kfd_process *process; |
105 | bool is_32bit_user_mode; | ||
105 | 106 | ||
106 | if (iminor(inode) != 0) | 107 | if (iminor(inode) != 0) |
107 | return -ENODEV; | 108 | return -ENODEV; |
108 | 109 | ||
110 | is_32bit_user_mode = is_compat_task(); | ||
111 | |||
112 | if (is_32bit_user_mode == true) { | ||
113 | dev_warn(kfd_device, | ||
114 | "Process %d (32-bit) failed to open /dev/kfd\n" | ||
115 | "32-bit processes are not supported by amdkfd\n", | ||
116 | current->pid); | ||
117 | return -EPERM; | ||
118 | } | ||
119 | |||
109 | process = kfd_create_process(current); | 120 | process = kfd_create_process(current); |
110 | if (IS_ERR(process)) | 121 | if (IS_ERR(process)) |
111 | return PTR_ERR(process); | 122 | return PTR_ERR(process); |
112 | 123 | ||
113 | process->is_32bit_user_mode = is_compat_task(); | 124 | process->is_32bit_user_mode = is_32bit_user_mode; |
114 | 125 | ||
115 | dev_dbg(kfd_device, "process %d opened, compat mode (32 bit) - %d\n", | 126 | dev_dbg(kfd_device, "process %d opened, compat mode (32 bit) - %d\n", |
116 | process->pasid, process->is_32bit_user_mode); | 127 | process->pasid, process->is_32bit_user_mode); |