summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Skidanov <Alexey.Skidanov@amd.com>2014-04-03 10:06:07 +0300
committerOded Gabbay <oded.gabbay@amd.com>2014-04-03 14:08:01 +0300
commit1c0db0c7975261aebe896f7ea910f2f89ac13642 (patch)
tree7a0ba0d8aceaf2c933c4f3c888edc73984c69933
parentb093b9c1d73659b41b7b5e381743d9932680251f (diff)
hsa/radeon: 32-bit processes support
Initializing compat_ioctl properly. All ioctls args are packed. Signed-off-by: Alexey Skidanov <Alexey.Skidanov@amd.com> Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
-rw-r--r--drivers/gpu/hsa/radeon/kfd_chardev.c6
-rw-r--r--drivers/gpu/hsa/radeon/kfd_priv.h4
-rw-r--r--include/uapi/linux/kfd_ioctl.h2
3 files changed, 9 insertions, 3 deletions
diff --git a/drivers/gpu/hsa/radeon/kfd_chardev.c b/drivers/gpu/hsa/radeon/kfd_chardev.c
index 30f171593615..f4b822ae52a8 100644
--- a/drivers/gpu/hsa/radeon/kfd_chardev.c
+++ b/drivers/gpu/hsa/radeon/kfd_chardev.c
@@ -27,6 +27,7 @@
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
+#include <linux/compat.h>
#include <uapi/linux/kfd_ioctl.h>
#include <linux/time.h>
#include "kfd_priv.h"
@@ -41,6 +42,7 @@ static const char kfd_dev_name[] = "kfd";
static const struct file_operations kfd_fops = {
.owner = THIS_MODULE,
.unlocked_ioctl = kfd_ioctl,
+ .compat_ioctl = kfd_ioctl,
.open = kfd_open,
.mmap = kfd_mmap,
};
@@ -105,8 +107,8 @@ kfd_open(struct inode *inode, struct file *filep)
process = radeon_kfd_create_process(current);
if (IS_ERR(process))
return PTR_ERR(process);
-
- pr_debug("\nkfd: process %d opened dev/kfd", process->pasid);
+ process->is_32bit_user_mode = is_compat_task();
+ dev_info(kfd_device, "process %d opened, compat mode (32 bit) - %d\n", process->pasid, process->is_32bit_user_mode);
return 0;
}
diff --git a/drivers/gpu/hsa/radeon/kfd_priv.h b/drivers/gpu/hsa/radeon/kfd_priv.h
index 4b22e3dedef7..c788c2af71b3 100644
--- a/drivers/gpu/hsa/radeon/kfd_priv.h
+++ b/drivers/gpu/hsa/radeon/kfd_priv.h
@@ -184,6 +184,10 @@ struct kfd_process {
size_t queue_array_size;
struct kfd_queue **queues; /* Size is queue_array_size, up to MAX_PROCESS_QUEUES. */
unsigned long allocated_queue_bitmap[DIV_ROUND_UP(MAX_PROCESS_QUEUES, BITS_PER_LONG)];
+
+ /*Is the user space process 32 bit?*/
+ bool is_32bit_user_mode;
+
};
struct kfd_process *radeon_kfd_create_process(const struct task_struct *);
diff --git a/include/uapi/linux/kfd_ioctl.h b/include/uapi/linux/kfd_ioctl.h
index 5b9517ed2e4e..a7c3abd78056 100644
--- a/include/uapi/linux/kfd_ioctl.h
+++ b/include/uapi/linux/kfd_ioctl.h
@@ -29,7 +29,7 @@
#define KFD_IOCTL_CURRENT_VERSION 1
/* The 64-bit ABI is the authoritative version. */
-#pragma pack(push, 8)
+#pragma pack(push, 1)
struct kfd_ioctl_get_version_args {
uint32_t min_supported_version; /* from KFD */