linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oded Gabbay <oded.gabbay@gmail.com>
To: David Airlie <airlied@linux.ie>,
	Alex Deucher <alexander.deucher@amd.com>,
	Jerome Glisse <j.glisse@gmail.com>
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	John Bridgman <John.Bridgman@amd.com>,
	Andrew Lewycky <Andrew.Lewycky@amd.com>,
	Joerg Roedel <joro@8bytes.org>,
	Alexey Skidanov <Alexey.Skidanov@amd.com>,
	Oded Gabbay <oded.gabbay@amd.com>, Ben Goz <ben.goz@amd.com>,
	Evgeny Pinchuk <evgeny.pinchuk@amd.com>,
	linux-api@vger.kernel.org
Subject: [PATCH 42/83] hsa/radeon: 32-bit processes support
Date: Fri, 11 Jul 2014 00:53:58 +0300	[thread overview]
Message-ID: <1405029279-6894-14-git-send-email-oded.gabbay@amd.com> (raw)
In-Reply-To: <1405029279-6894-1-git-send-email-oded.gabbay@amd.com>

From: Alexey Skidanov <Alexey.Skidanov@amd.com>

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>
---
 drivers/gpu/hsa/radeon/kfd_chardev.c | 7 +++++--
 drivers/gpu/hsa/radeon/kfd_priv.h    | 4 ++++
 include/uapi/linux/kfd_ioctl.h       | 2 +-
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/hsa/radeon/kfd_chardev.c b/drivers/gpu/hsa/radeon/kfd_chardev.c
index 75fe11f..e95d597 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,9 @@ 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 8b877ca..9d3b1fc 100644
--- a/drivers/gpu/hsa/radeon/kfd_priv.h
+++ b/drivers/gpu/hsa/radeon/kfd_priv.h
@@ -194,6 +194,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 5b9517e..a7c3abd 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 */
-- 
1.9.1

  parent reply	other threads:[~2014-07-10 21:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1405029279-6894-1-git-send-email-oded.gabbay@amd.com>
     [not found] ` <1405029279-6894-1-git-send-email-oded.gabbay-5C7GfCeVMHo@public.gmane.org>
2014-07-10 21:53   ` [PATCH 32/83] hsa/radeon: implementing IOCTL for clock counters Oded Gabbay
2014-07-11 20:34     ` Jerome Glisse
2014-07-10 21:53 ` Oded Gabbay [this message]
2014-07-10 21:54 ` [PATCH 44/83] hsa/radeon: HSA64/HSA32 modes support Oded Gabbay
     [not found]   ` <1405029279-6894-16-git-send-email-oded.gabbay-5C7GfCeVMHo@public.gmane.org>
2014-07-11 20:41     ` Jerome Glisse
2014-07-10 21:54 ` [PATCH 54/83] hsa/radeon: Switch to new queue scheduler Oded Gabbay
2014-07-10 21:54 ` [PATCH 55/83] hsa/radeon: Add IOCTL for update queue Oded Gabbay
2014-07-10 21:54 ` [PATCH 59/83] hsa/radeon: Exclusive access for perf. counters Oded Gabbay
2014-07-10 21:54 ` [PATCH 60/83] hsa/radeon: Rearrange structures in kfd_ioctl.h Oded Gabbay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1405029279-6894-14-git-send-email-oded.gabbay@amd.com \
    --to=oded.gabbay@gmail.com \
    --cc=Alexey.Skidanov@amd.com \
    --cc=Andrew.Lewycky@amd.com \
    --cc=John.Bridgman@amd.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=ben.goz@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=evgeny.pinchuk@amd.com \
    --cc=j.glisse@gmail.com \
    --cc=joro@8bytes.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oded.gabbay@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).