linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: add appropriate asm/unaligned.h
@ 2014-03-27 13:39 Ard Biesheuvel
  2014-03-27 14:15 ` Rob Herring
  0 siblings, 1 reply; 3+ messages in thread
From: Ard Biesheuvel @ 2014-03-27 13:39 UTC (permalink / raw)
  To: linux-arm-kernel

The generic asm/unaligned.h does not allow unaligned accesses, resulting in all
invocations of get_unaligned_xxx() and put_unaligned_xxx() to be expanded into
byte size accesses. On arm64, this is unnecessary, so provide a more permissive
asm/unaligned.h instead.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 arch/arm64/include/asm/Kbuild      |  1 -
 arch/arm64/include/asm/unaligned.h | 17 +++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm64/include/asm/unaligned.h

diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild
index 43a2c9d2d6f4..f88986a0c1dd 100644
--- a/arch/arm64/include/asm/Kbuild
+++ b/arch/arm64/include/asm/Kbuild
@@ -46,7 +46,6 @@ generic-y += termios.h
 generic-y += topology.h
 generic-y += trace_clock.h
 generic-y += types.h
-generic-y += unaligned.h
 generic-y += user.h
 generic-y += vga.h
 generic-y += xor.h
diff --git a/arch/arm64/include/asm/unaligned.h b/arch/arm64/include/asm/unaligned.h
new file mode 100644
index 000000000000..00c4a4e02fd1
--- /dev/null
+++ b/arch/arm64/include/asm/unaligned.h
@@ -0,0 +1,17 @@
+#ifndef __ASM_UNALIGNED_H
+#define __ASM_UNALIGNED_H
+
+#include <linux/unaligned/access_ok.h>
+#include <linux/unaligned/generic.h>
+
+#if defined(__LITTLE_ENDIAN)
+#define get_unaligned		__get_unaligned_le
+#define put_unaligned		__put_unaligned_le
+#elif defined(__BIG_ENDIAN)
+#define get_unaligned		__get_unaligned_be
+#define put_unaligned		__put_unaligned_be
+#else
+#error need to define endianess
+#endif
+
+#endif /* __ASM_UNALIGNED_H */
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] arm64: add appropriate asm/unaligned.h
  2014-03-27 13:39 [PATCH] arm64: add appropriate asm/unaligned.h Ard Biesheuvel
@ 2014-03-27 14:15 ` Rob Herring
  2014-03-27 14:20   ` Ard Biesheuvel
  0 siblings, 1 reply; 3+ messages in thread
From: Rob Herring @ 2014-03-27 14:15 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Mar 27, 2014 at 8:39 AM, Ard Biesheuvel
<ard.biesheuvel@linaro.org> wrote:
> The generic asm/unaligned.h does not allow unaligned accesses, resulting in all
> invocations of get_unaligned_xxx() and put_unaligned_xxx() to be expanded into
> byte size accesses. On arm64, this is unnecessary, so provide a more permissive
> asm/unaligned.h instead.

Couldn't the generic version learn to use
CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS on arches that enable it?

Rob

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] arm64: add appropriate asm/unaligned.h
  2014-03-27 14:15 ` Rob Herring
@ 2014-03-27 14:20   ` Ard Biesheuvel
  0 siblings, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2014-03-27 14:20 UTC (permalink / raw)
  To: linux-arm-kernel

On 27 March 2014 15:15, Rob Herring <robherring2@gmail.com> wrote:
> On Thu, Mar 27, 2014 at 8:39 AM, Ard Biesheuvel
> <ard.biesheuvel@linaro.org> wrote:
>> The generic asm/unaligned.h does not allow unaligned accesses, resulting in all
>> invocations of get_unaligned_xxx() and put_unaligned_xxx() to be expanded into
>> byte size accesses. On arm64, this is unnecessary, so provide a more permissive
>> asm/unaligned.h instead.
>
> Couldn't the generic version learn to use
> CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS on arches that enable it?
>

I wasn't aware of that option, but I agree that it seems reasonable to
test for that in the asm-generic version.

-- 
Ard.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-03-27 14:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-27 13:39 [PATCH] arm64: add appropriate asm/unaligned.h Ard Biesheuvel
2014-03-27 14:15 ` Rob Herring
2014-03-27 14:20   ` Ard Biesheuvel

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).