* [PATCH] staging: android: ashmem: add 32bit compat support
[not found] <staging: android: ashmem: add 32bit compat support>
@ 2013-02-25 18:44 ` Serban Constantinescu
2013-02-25 18:44 ` [PATCH] staging: android: ashmem: Add support for 32bit ashmem calls in a 64bit kernel Serban Constantinescu
2013-02-25 18:57 ` [PATCH] staging: android: ashmem: add 32bit compat support Greg KH
0 siblings, 2 replies; 11+ messages in thread
From: Serban Constantinescu @ 2013-02-25 18:44 UTC (permalink / raw)
To: linux-kernel, gregkh, kernel-team, arve, john.stultz,
Dave.Butcher
Cc: Serban Constantinescu
Hi all,
As disussed with the Android kernel team I am resubmitting this patch
without any modifications to the structure exchanged between kernel and
userspace.
The patch has been tested on 32(VExpress 4xA9) and 64bit platforms(RTSMv8)
running 32bit Android userspace and 64bit Linux + ashmem unit tests.
Thanks for your help,
Serban Constantinescu
PDSW Engineer ARM Ltd.
Serban Constantinescu (1):
staging: android: ashmem: Add support for 32bit ashmem calls in a
64bit kernel
drivers/staging/android/ashmem.c | 21 ++++++++++++++++++++-
drivers/staging/android/ashmem.h | 6 ++++++
2 files changed, 26 insertions(+), 1 deletion(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] staging: android: ashmem: Add support for 32bit ashmem calls in a 64bit kernel
2013-02-25 18:44 ` [PATCH] staging: android: ashmem: add 32bit compat support Serban Constantinescu
@ 2013-02-25 18:44 ` Serban Constantinescu
2013-02-25 18:55 ` John Stultz
` (2 more replies)
2013-02-25 18:57 ` [PATCH] staging: android: ashmem: add 32bit compat support Greg KH
1 sibling, 3 replies; 11+ messages in thread
From: Serban Constantinescu @ 2013-02-25 18:44 UTC (permalink / raw)
To: linux-kernel, gregkh, kernel-team, arve, john.stultz,
Dave.Butcher
Cc: Serban Constantinescu
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
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] staging: android: ashmem: Add support for 32bit ashmem calls in a 64bit kernel
2013-02-25 18:44 ` [PATCH] staging: android: ashmem: Add support for 32bit ashmem calls in a 64bit kernel Serban Constantinescu
@ 2013-02-25 18:55 ` John Stultz
2013-02-25 22:53 ` Arve Hjønnevåg
2013-03-05 8:37 ` Greg KH
2 siblings, 0 replies; 11+ messages in thread
From: John Stultz @ 2013-02-25 18:55 UTC (permalink / raw)
To: Serban Constantinescu
Cc: linux-kernel, gregkh, kernel-team, arve, Dave.Butcher
On 02/25/2013 10:44 AM, Serban Constantinescu wrote:
> 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>
Acked-by: John Stultz <john.stultz@linaro.org>
thanks
-john
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] 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 ` [PATCH] staging: android: ashmem: Add support for 32bit ashmem calls in a 64bit kernel Serban Constantinescu
@ 2013-02-25 18:57 ` Greg KH
1 sibling, 0 replies; 11+ messages in thread
From: Greg KH @ 2013-02-25 18:57 UTC (permalink / raw)
To: Serban Constantinescu
Cc: linux-kernel, kernel-team, arve, john.stultz, Dave.Butcher
On Mon, Feb 25, 2013 at 06:44:35PM +0000, Serban Constantinescu wrote:
> Hi all,
>
> As disussed with the Android kernel team I am resubmitting this patch
> without any modifications to the structure exchanged between kernel and
> userspace.
I'll need some acks or signed-off-by: on the patch from them, before I
can take this patch, thanks.
Oh, it's also too late for 3.9, 3.10 is the soonest this can go in, just
to set your expectations properly.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] staging: android: ashmem: Add support for 32bit ashmem calls in a 64bit kernel
2013-02-25 18:44 ` [PATCH] staging: android: ashmem: Add support for 32bit ashmem calls in a 64bit kernel Serban Constantinescu
2013-02-25 18:55 ` John Stultz
@ 2013-02-25 22:53 ` Arve Hjønnevåg
2013-03-05 8:37 ` Greg KH
2 siblings, 0 replies; 11+ messages in thread
From: Arve Hjønnevåg @ 2013-02-25 22:53 UTC (permalink / raw)
To: Serban Constantinescu
Cc: linux-kernel, gregkh, kernel-team, john.stultz, Dave.Butcher
On Mon, Feb 25, 2013 at 10:44 AM, Serban Constantinescu
<serban.constantinescu@arm.com> wrote:
> 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>
Acked-by: Arve Hjønnevåg <arve@android.com>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] staging: android: ashmem: Add support for 32bit ashmem calls in a 64bit kernel
2013-02-25 18:44 ` [PATCH] staging: android: ashmem: Add support for 32bit ashmem calls in a 64bit kernel Serban Constantinescu
2013-02-25 18:55 ` 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:25 ` Serban Constantinescu
2 siblings, 2 replies; 11+ messages in thread
From: Greg KH @ 2013-03-05 8:37 UTC (permalink / raw)
To: Serban Constantinescu
Cc: linux-kernel, kernel-team, arve, john.stultz, Dave.Butcher
On Mon, Feb 25, 2013 at 06:44:36PM +0000, Serban Constantinescu wrote:
> 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>
> Acked-by: Arve Hjønnevåg <arve@android.com>
> Acked-by: John Stultz <john.stultz@linaro.org>
This patch breaks the build on my machine:
drivers/staging/android/ashmem.c: In function ‘compat_ashmem_ioctl’:
drivers/staging/android/ashmem.c:711:7: error: ‘compat_size_t’ undeclared (first use in this function)
drivers/staging/android/ashmem.c:711:7: note: each undeclared identifier is reported only once for each function it appears in
so of course, I can't take it :(
greg k-h
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] staging: android: ashmem: Add support for 32bit ashmem calls in a 64bit kernel
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:25 ` Serban Constantinescu
1 sibling, 1 reply; 11+ messages in thread
From: Serban Constantinescu @ 2013-03-05 10:18 UTC (permalink / raw)
To: gregkh, linux-kernel, kernel-team, arve, john.stultz,
Dave.Butcher
Cc: Serban Constantinescu
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 | 22 +++++++++++++++++++++-
drivers/staging/android/ashmem.h | 6 ++++++
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
index 72064fc..e96f381 100644
--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -31,6 +31,7 @@
#include <linux/bitops.h>
#include <linux/mutex.h>
#include <linux/shmem_fs.h>
+#include <linux/compat.h>
#include "ashmem.h"
#define ASHMEM_NAME_PREFIX "dev/ashmem/"
@@ -674,6 +675,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 +700,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
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] staging: android: ashmem: Add support for 32bit ashmem calls in a 64bit kernel
2013-03-05 8:37 ` Greg KH
2013-03-05 10:18 ` Serban Constantinescu
@ 2013-03-05 10:25 ` Serban Constantinescu
1 sibling, 0 replies; 11+ messages in thread
From: Serban Constantinescu @ 2013-03-05 10:25 UTC (permalink / raw)
To: Greg KH
Cc: linux-kernel@vger.kernel.org, kernel-team@android.com,
arve@android.com, john.stultz@linaro.org, Dave Butcher
On 05/03/13 08:37, Greg KH wrote:
> On Mon, Feb 25, 2013 at 06:44:36PM +0000, Serban Constantinescu wrote:
>> 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>
>> Acked-by: Arve Hjønnevåg <arve@android.com>
>> Acked-by: John Stultz <john.stultz@linaro.org>
>
> This patch breaks the build on my machine:
> drivers/staging/android/ashmem.c: In function ‘compat_ashmem_ioctl’:
> drivers/staging/android/ashmem.c:711:7: error: ‘compat_size_t’ undeclared (first use in this function)
> drivers/staging/android/ashmem.c:711:7: note: each undeclared identifier is reported only once for each function it appears in
When building for x86_64 we need <linux/compat.h>. Sorry I forgot it,
should build fine now.
>
> so of course, I can't take it :(
Thanks,
Serban
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] staging: android: ashmem: Add support for 32bit ashmem calls in a 64bit kernel
2013-03-05 10:18 ` Serban Constantinescu
@ 2013-03-05 10:27 ` Greg KH
2013-03-05 10:38 ` Serban Constantinescu
0 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2013-03-05 10:27 UTC (permalink / raw)
To: Serban Constantinescu
Cc: linux-kernel, kernel-team, arve, john.stultz, Dave.Butcher
On Tue, Mar 05, 2013 at 10:18:27AM +0000, Serban Constantinescu wrote:
> 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 | 22 +++++++++++++++++++++-
> drivers/staging/android/ashmem.h | 6 ++++++
> 2 files changed, 27 insertions(+), 1 deletion(-)
Ok, what has changed from your previous version that I rejected that is
going to actually allow this to build?
Hint, you gotta tell me what version of the patch this is, and what
changed, otherwise I'll just assume this is a resend of the previous
patch and go ahead and delete it from my queue.
In fact, I might as well do that, now deleted :)
greg k-h
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] staging: android: ashmem: Add support for 32bit ashmem calls in a 64bit kernel
2013-03-05 10:27 ` Greg KH
@ 2013-03-05 10:38 ` Serban Constantinescu
2013-03-05 10:47 ` Greg KH
0 siblings, 1 reply; 11+ messages in thread
From: Serban Constantinescu @ 2013-03-05 10:38 UTC (permalink / raw)
To: Greg KH
Cc: linux-kernel@vger.kernel.org, kernel-team@android.com,
arve@android.com, john.stultz@linaro.org, Dave Butcher
On 05/03/13 10:27, Greg KH wrote:
> On Tue, Mar 05, 2013 at 10:18:27AM +0000, Serban Constantinescu wrote:
>> 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 | 22 +++++++++++++++++++++-
>> drivers/staging/android/ashmem.h | 6 ++++++
>> 2 files changed, 27 insertions(+), 1 deletion(-)
>
> Ok, what has changed from your previous version that I rejected that is
> going to actually allow this to build?
I had to add <linux/compat.h> for a successful build on x86_64. The
attached hunk is the only change added.
> diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
> index 72064fc..e96f381 100644
> --- a/drivers/staging/android/ashmem.c
> +++ b/drivers/staging/android/ashmem.c
> @@ -31,6 +31,7 @@
> #include <linux/bitops.h>
> #include <linux/mutex.h>
> #include <linux/shmem_fs.h>
> +#include <linux/compat.h>
> #include "ashmem.h"
>
> #define ASHMEM_NAME_PREFIX "dev/ashmem/"
>
> Hint, you gotta tell me what version of the patch this is, and what
> changed, otherwise I'll just assume this is a resend of the previous
> patch and go ahead and delete it from my queue.
Sorry - same patch as before, the one that had John and Arve's ack, plus
the above hunk.
>
> In fact, I might as well do that, now deleted :)
>
> greg k-h
>
Thanks,
Serban
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] staging: android: ashmem: Add support for 32bit ashmem calls in a 64bit kernel
2013-03-05 10:38 ` Serban Constantinescu
@ 2013-03-05 10:47 ` Greg KH
0 siblings, 0 replies; 11+ messages in thread
From: Greg KH @ 2013-03-05 10:47 UTC (permalink / raw)
To: Serban Constantinescu
Cc: linux-kernel@vger.kernel.org, kernel-team@android.com,
arve@android.com, john.stultz@linaro.org, Dave Butcher
On Tue, Mar 05, 2013 at 10:38:48AM +0000, Serban Constantinescu wrote:
> On 05/03/13 10:27, Greg KH wrote:
> >On Tue, Mar 05, 2013 at 10:18:27AM +0000, Serban Constantinescu wrote:
> >>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 | 22 +++++++++++++++++++++-
> >> drivers/staging/android/ashmem.h | 6 ++++++
> >> 2 files changed, 27 insertions(+), 1 deletion(-)
> >
> >Ok, what has changed from your previous version that I rejected that is
> >going to actually allow this to build?
>
> I had to add <linux/compat.h> for a successful build on x86_64. The
> attached hunk is the only change added.
Ok, please say that. I deal with over 7000 patches a year, there is no
way I can remember what the difference is between this one, and the
previous one I rejected. Especially as I reviewed about 30 patches
inbetween the time I rejected it and you sent this update.
> >diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
> >index 72064fc..e96f381 100644
> >--- a/drivers/staging/android/ashmem.c
> >+++ b/drivers/staging/android/ashmem.c
> >@@ -31,6 +31,7 @@
> > #include <linux/bitops.h>
> > #include <linux/mutex.h>
> > #include <linux/shmem_fs.h>
> >+#include <linux/compat.h>
> > #include "ashmem.h"
> >
> > #define ASHMEM_NAME_PREFIX "dev/ashmem/"
>
>
> >
> >Hint, you gotta tell me what version of the patch this is, and what
> >changed, otherwise I'll just assume this is a resend of the previous
> >patch and go ahead and delete it from my queue.
>
> Sorry - same patch as before, the one that had John and Arve's ack,
> plus the above hunk.
That is not what I meant, please go read Section 2 of the
Documentation/SubmittingPatches file for what I need to see here.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2013-03-05 10:47 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[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 ` [PATCH] staging: android: ashmem: Add support for 32bit ashmem calls in a 64bit kernel Serban Constantinescu
2013-02-25 18:55 ` 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox