From: Serban Constantinescu <serban.constantinescu@arm.com>
To: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org,
kernel-team@android.com, arve@android.com,
john.stultz@linaro.org, Dave.Butcher@arm.com
Cc: Serban Constantinescu <serban.constantinescu@arm.com>
Subject: [PATCH] staging: android: ashmem: Add support for 32bit ashmem calls in a 64bit kernel
Date: Mon, 25 Feb 2013 18:44:36 +0000 [thread overview]
Message-ID: <1361817876-24747-2-git-send-email-serban.constantinescu@arm.com> (raw)
In-Reply-To: <1361817876-24747-1-git-send-email-serban.constantinescu@arm.com>
Android's shared memory subsystem, Ashmem, does not support calls from a
32bit userspace in a 64 bit kernel. This patch adds support for syscalls
coming from a 32bit userspace in a 64bit kernel.
The patch has been successfully tested on ARMv8 AEM(64bit
platform model) and Versatile Express A9(32bit platform).
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
---
drivers/staging/android/ashmem.c | 21 ++++++++++++++++++++-
drivers/staging/android/ashmem.h | 6 ++++++
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
index 72064fc..268f0b4 100644
--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -674,6 +674,23 @@ static long ashmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
return ret;
}
+/* support of 32bit userspace on 64bit platforms */
+#ifdef CONFIG_COMPAT
+static long compat_ashmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+
+ switch (cmd) {
+ case COMPAT_ASHMEM_SET_SIZE:
+ cmd = ASHMEM_SET_SIZE;
+ break;
+ case COMPAT_ASHMEM_SET_PROT_MASK:
+ cmd = ASHMEM_SET_PROT_MASK;
+ break;
+ }
+ return ashmem_ioctl(file, cmd, arg);
+}
+#endif
+
static const struct file_operations ashmem_fops = {
.owner = THIS_MODULE,
.open = ashmem_open,
@@ -682,7 +699,9 @@ static const struct file_operations ashmem_fops = {
.llseek = ashmem_llseek,
.mmap = ashmem_mmap,
.unlocked_ioctl = ashmem_ioctl,
- .compat_ioctl = ashmem_ioctl,
+#ifdef CONFIG_COMPAT
+ .compat_ioctl = compat_ashmem_ioctl,
+#endif
};
static struct miscdevice ashmem_misc = {
diff --git a/drivers/staging/android/ashmem.h b/drivers/staging/android/ashmem.h
index 1976b10..2809d31 100644
--- a/drivers/staging/android/ashmem.h
+++ b/drivers/staging/android/ashmem.h
@@ -45,4 +45,10 @@ struct ashmem_pin {
#define ASHMEM_GET_PIN_STATUS _IO(__ASHMEMIOC, 9)
#define ASHMEM_PURGE_ALL_CACHES _IO(__ASHMEMIOC, 10)
+/* support of 32bit userspace on 64bit platforms */
+#ifdef CONFIG_COMPAT
+#define COMPAT_ASHMEM_SET_SIZE _IOW(__ASHMEMIOC, 3, compat_size_t)
+#define COMPAT_ASHMEM_SET_PROT_MASK _IOW(__ASHMEMIOC, 5, unsigned int)
+#endif
+
#endif /* _LINUX_ASHMEM_H */
--
1.7.9.5
next prev parent reply other threads:[~2013-02-25 18:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <staging: android: ashmem: add 32bit compat support>
2013-02-25 18:44 ` [PATCH] staging: android: ashmem: add 32bit compat support Serban Constantinescu
2013-02-25 18:44 ` Serban Constantinescu [this message]
2013-02-25 18:55 ` [PATCH] staging: android: ashmem: Add support for 32bit ashmem calls in a 64bit kernel John Stultz
2013-02-25 22:53 ` Arve Hjønnevåg
2013-03-05 8:37 ` Greg KH
2013-03-05 10:18 ` Serban Constantinescu
2013-03-05 10:27 ` Greg KH
2013-03-05 10:38 ` Serban Constantinescu
2013-03-05 10:47 ` Greg KH
2013-03-05 10:25 ` Serban Constantinescu
2013-02-25 18:57 ` [PATCH] staging: android: ashmem: add 32bit compat support Greg KH
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=1361817876-24747-2-git-send-email-serban.constantinescu@arm.com \
--to=serban.constantinescu@arm.com \
--cc=Dave.Butcher@arm.com \
--cc=arve@android.com \
--cc=gregkh@linuxfoundation.org \
--cc=john.stultz@linaro.org \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®