aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Phillips <kim.phillips@freescale.com>2013-11-05 23:15:24 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2013-12-29 07:32:45 -0500
commit017f161a55b48807a73fc9dff0b69f081bf43ee3 (patch)
tree1c440562e87f4c394d483935486019cc9854ffe8
parent03aa6580e336c19e923372a3b6b72a300f24880c (diff)
ARM: 7877/1: use built-in byte swap function
Enable the compiler intrinsic for byte swapping on arch ARM. This allows the compiler to detect and be able to optimize out byte swappings, and has a very modest benefit on vmlinux size (Linaro gcc 4.8): text data bss dec hex filename 2840310 123932 61960 3026202 2e2d1a vmlinux-lart #orig 2840152 123932 61960 3026044 2e2c7c vmlinux-lart #builtin-bswap 6473120 314840 5616016 12403976 bd4508 vmlinux-mxs #orig 6472586 314848 5616016 12403450 bd42fa vmlinux-mxs #builtin-bswap 7419872 318372 379556 8117800 7bde28 vmlinux-imx_v6_v7 #orig 7419170 318364 379556 8117090 7bdb62 vmlinux-imx_v6_v7 #builtin-bswap Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Reviewed-by: Nicolas Pitre <nico@linaro.org> Acked-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/boot/compressed/Makefile15
-rw-r--r--arch/arm/kernel/armksyms.c4
-rw-r--r--arch/arm/lib/Makefile2
-rw-r--r--arch/arm/lib/bswapsdi2.S36
5 files changed, 53 insertions, 5 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c1f1a7eee953..75597213c5b8 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -6,6 +6,7 @@ config ARM
6 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST 6 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
7 select ARCH_HAVE_CUSTOM_GPIO_H 7 select ARCH_HAVE_CUSTOM_GPIO_H
8 select ARCH_MIGHT_HAVE_PC_PARPORT 8 select ARCH_MIGHT_HAVE_PC_PARPORT
9 select ARCH_USE_BUILTIN_BSWAP
9 select ARCH_USE_CMPXCHG_LOCKREF 10 select ARCH_USE_CMPXCHG_LOCKREF
10 select ARCH_WANT_IPC_PARSE_VERSION 11 select ARCH_WANT_IPC_PARSE_VERSION
11 select BUILDTIME_EXTABLE_SORT if MMU 12 select BUILDTIME_EXTABLE_SORT if MMU
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index e7190bb5998e..4bb86d9a749d 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -108,12 +108,12 @@ endif
108 108
109targets := vmlinux vmlinux.lds \ 109targets := vmlinux vmlinux.lds \
110 piggy.$(suffix_y) piggy.$(suffix_y).o \ 110 piggy.$(suffix_y) piggy.$(suffix_y).o \
111 lib1funcs.o lib1funcs.S ashldi3.o ashldi3.S \ 111 lib1funcs.o lib1funcs.S ashldi3.o ashldi3.S bswapsdi2.o \
112 font.o font.c head.o misc.o $(OBJS) 112 bswapsdi2.S font.o font.c head.o misc.o $(OBJS)
113 113
114# Make sure files are removed during clean 114# Make sure files are removed during clean
115extra-y += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern piggy.lz4 \ 115extra-y += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern piggy.lz4 \
116 lib1funcs.S ashldi3.S $(libfdt) $(libfdt_hdrs) \ 116 lib1funcs.S ashldi3.S bswapsdi2.S $(libfdt) $(libfdt_hdrs) \
117 hyp-stub.S 117 hyp-stub.S
118 118
119ifeq ($(CONFIG_FUNCTION_TRACER),y) 119ifeq ($(CONFIG_FUNCTION_TRACER),y)
@@ -156,6 +156,12 @@ ashldi3 = $(obj)/ashldi3.o
156$(obj)/ashldi3.S: $(srctree)/arch/$(SRCARCH)/lib/ashldi3.S 156$(obj)/ashldi3.S: $(srctree)/arch/$(SRCARCH)/lib/ashldi3.S
157 $(call cmd,shipped) 157 $(call cmd,shipped)
158 158
159# For __bswapsi2, __bswapdi2
160bswapsdi2 = $(obj)/bswapsdi2.o
161
162$(obj)/bswapsdi2.S: $(srctree)/arch/$(SRCARCH)/lib/bswapsdi2.S
163 $(call cmd,shipped)
164
159# We need to prevent any GOTOFF relocs being used with references 165# We need to prevent any GOTOFF relocs being used with references
160# to symbols in the .bss section since we cannot relocate them 166# to symbols in the .bss section since we cannot relocate them
161# independently from the rest at run time. This can be achieved by 167# independently from the rest at run time. This can be achieved by
@@ -177,7 +183,8 @@ if [ $(words $(ZRELADDR)) -gt 1 -a "$(CONFIG_AUTO_ZRELADDR)" = "" ]; then \
177fi 183fi
178 184
179$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \ 185$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \
180 $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) $(ashldi3) FORCE 186 $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) $(ashldi3) \
187 $(bswapsdi2) FORCE
181 @$(check_for_multiple_zreladdr) 188 @$(check_for_multiple_zreladdr)
182 $(call if_changed,ld) 189 $(call if_changed,ld)
183 @$(check_for_bad_syms) 190 @$(check_for_bad_syms)
diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c
index 1f031ddd0667..85e664b6a5f1 100644
--- a/arch/arm/kernel/armksyms.c
+++ b/arch/arm/kernel/armksyms.c
@@ -35,6 +35,8 @@ extern void __ucmpdi2(void);
35extern void __udivsi3(void); 35extern void __udivsi3(void);
36extern void __umodsi3(void); 36extern void __umodsi3(void);
37extern void __do_div64(void); 37extern void __do_div64(void);
38extern void __bswapsi2(void);
39extern void __bswapdi2(void);
38 40
39extern void __aeabi_idiv(void); 41extern void __aeabi_idiv(void);
40extern void __aeabi_idivmod(void); 42extern void __aeabi_idivmod(void);
@@ -114,6 +116,8 @@ EXPORT_SYMBOL(__ucmpdi2);
114EXPORT_SYMBOL(__udivsi3); 116EXPORT_SYMBOL(__udivsi3);
115EXPORT_SYMBOL(__umodsi3); 117EXPORT_SYMBOL(__umodsi3);
116EXPORT_SYMBOL(__do_div64); 118EXPORT_SYMBOL(__do_div64);
119EXPORT_SYMBOL(__bswapsi2);
120EXPORT_SYMBOL(__bswapdi2);
117 121
118#ifdef CONFIG_AEABI 122#ifdef CONFIG_AEABI
119EXPORT_SYMBOL(__aeabi_idiv); 123EXPORT_SYMBOL(__aeabi_idiv);
diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index 47d7338561de..0573faab96ad 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -13,7 +13,7 @@ lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \
13 ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \ 13 ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \
14 ucmpdi2.o lib1funcs.o div64.o \ 14 ucmpdi2.o lib1funcs.o div64.o \
15 io-readsb.o io-writesb.o io-readsl.o io-writesl.o \ 15 io-readsb.o io-writesb.o io-readsl.o io-writesl.o \
16 call_with_stack.o 16 call_with_stack.o bswapsdi2.o
17 17
18mmu-y := clear_user.o copy_page.o getuser.o putuser.o 18mmu-y := clear_user.o copy_page.o getuser.o putuser.o
19 19
diff --git a/arch/arm/lib/bswapsdi2.S b/arch/arm/lib/bswapsdi2.S
new file mode 100644
index 000000000000..9fcdd154eff9
--- /dev/null
+++ b/arch/arm/lib/bswapsdi2.S
@@ -0,0 +1,36 @@
1#include <linux/linkage.h>
2
3#if __LINUX_ARM_ARCH__ >= 6
4ENTRY(__bswapsi2)
5 rev r0, r0
6 bx lr
7ENDPROC(__bswapsi2)
8
9ENTRY(__bswapdi2)
10 rev r3, r0
11 rev r0, r1
12 mov r1, r3
13 bx lr
14ENDPROC(__bswapdi2)
15#else
16ENTRY(__bswapsi2)
17 eor r3, r0, r0, ror #16
18 mov r3, r3, lsr #8
19 bic r3, r3, #0xff00
20 eor r0, r3, r0, ror #8
21 mov pc, lr
22ENDPROC(__bswapsi2)
23
24ENTRY(__bswapdi2)
25 mov ip, r1
26 eor r3, ip, ip, ror #16
27 eor r1, r0, r0, ror #16
28 mov r1, r1, lsr #8
29 mov r3, r3, lsr #8
30 bic r3, r3, #0xff00
31 bic r1, r1, #0xff00
32 eor r1, r1, r0, ror #8
33 eor r0, r3, ip, ror #8
34 mov pc, lr
35ENDPROC(__bswapdi2)
36#endif