Skip to content

Commit 40d5534

Browse files
committed
ARM: Default to using optimized memset and memcpy routines
We have long had available optimized versions of the memset and memcpy functions that are borrowed from the Linux kernel. We should use these in normal conditions as the speed wins in many workflows outweigh the relatively minor size increase. However, we have a number of places where we're simply too close to size limits in SPL and must be able to make the size vs performance trade-off in those cases. Cc: Philippe Reynes <tremyfr@yahoo.fr> Cc: Eric Jarrige <eric.jarrige@armadeus.org> Cc: Heiko Schocher <hs@denx.de> Cc: Magnus Lilja <lilja.magnus@gmail.com> Cc: Lokesh Vutla <lokeshvutla@ti.com> Cc: Chander Kashyap <k.chander@samsung.com> Cc: Akshay Saraswat <akshay.s@samsung.com> Cc: Simon Glass <sjg@chromium.org> Cc: Stefan Roese <sr@denx.de> Signed-off-by: Tom Rini <trini@konsulko.com> Acked-by: Stefan Roese <sr@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
1 parent a4a3593 commit 40d5534

File tree

15 files changed

+48
-6
lines changed

15 files changed

+48
-6
lines changed

arch/arm/Kconfig

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,16 @@ config ENABLE_ARM_SOC_BOOT0_HOOK
128128

129129
config USE_ARCH_MEMCPY
130130
bool "Use an assembly optimized implementation of memcpy"
131-
default y if CPU_V7
131+
default y
132+
depends on !ARM64
133+
help
134+
Enable the generation of an optimized version of memcpy.
135+
Such implementation may be faster under some conditions
136+
but may increase the binary size.
137+
138+
config SPL_USE_ARCH_MEMCPY
139+
bool "Use an assembly optimized implementation of memcpy"
140+
default y if USE_ARCH_MEMCPY
132141
depends on !ARM64
133142
help
134143
Enable the generation of an optimized version of memcpy.
@@ -137,7 +146,16 @@ config USE_ARCH_MEMCPY
137146

138147
config USE_ARCH_MEMSET
139148
bool "Use an assembly optimized implementation of memset"
140-
default y if CPU_V7
149+
default y
150+
depends on !ARM64
151+
help
152+
Enable the generation of an optimized version of memset.
153+
Such implementation may be faster under some conditions
154+
but may increase the binary size.
155+
156+
config SPL_USE_ARCH_MEMSET
157+
bool "Use an assembly optimized implementation of memset"
158+
default y if USE_ARCH_MEMSET
141159
depends on !ARM64
142160
help
143161
Enable the generation of an optimized version of memset.

arch/arm/lib/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ obj-$(CONFIG_CMD_BOOTI) += bootm.o
3030
obj-$(CONFIG_CMD_BOOTM) += bootm.o
3131
obj-$(CONFIG_CMD_BOOTZ) += bootm.o zimage.o
3232
obj-$(CONFIG_SYS_L2_PL310) += cache-pl310.o
33-
obj-$(CONFIG_USE_ARCH_MEMSET) += memset.o
34-
obj-$(CONFIG_USE_ARCH_MEMCPY) += memcpy.o
3533
else
3634
obj-$(CONFIG_SPL_FRAMEWORK) += spl.o
3735
obj-$(CONFIG_SPL_FRAMEWORK) += zimage.o
3836
endif
37+
obj-$(CONFIG_$(SPL_)USE_ARCH_MEMSET) += memset.o
38+
obj-$(CONFIG_$(SPL_)USE_ARCH_MEMCPY) += memcpy.o
3939
obj-$(CONFIG_SEMIHOSTING) += semihosting.o
4040

4141
obj-y += sections.o

common/init/board_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ DECLARE_GLOBAL_DATA_PTR;
1717
*/
1818
#if !defined(CONFIG_SPL_BUILD) || \
1919
(defined(CONFIG_SPL_LIBGENERIC_SUPPORT) && \
20-
!defined(CONFIG_USE_ARCH_MEMSET))
20+
!defined(CONFIG_SPL_USE_ARCH_MEMCPY))
2121
#define _USE_MEMCPY
2222
#endif
2323

configs/apf27_defconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
CONFIG_ARM=y
2+
# CONFIG_SPL_USE_ARCH_MEMCPY is not set
23
CONFIG_TARGET_APF27=y
34
CONFIG_SPL_NAND_SUPPORT=y
45
CONFIG_SPL_SERIAL_SUPPORT=y

configs/axm_defconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
CONFIG_ARM=y
2+
# CONFIG_SPL_USE_ARCH_MEMCPY is not set
3+
# CONFIG_SPL_USE_ARCH_MEMSET is not set
24
CONFIG_ARCH_AT91=y
35
CONFIG_TARGET_TAURUS=y
46
CONFIG_SPL_GPIO_SUPPORT=y

configs/corvus_defconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
CONFIG_ARM=y
2+
# CONFIG_SPL_USE_ARCH_MEMCPY is not set
3+
# CONFIG_SPL_USE_ARCH_MEMSET is not set
24
CONFIG_ARCH_AT91=y
35
CONFIG_TARGET_CORVUS=y
46
CONFIG_SPL_GPIO_SUPPORT=y

configs/mx31pdk_defconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
CONFIG_ARM=y
2+
# CONFIG_SPL_USE_ARCH_MEMCPY is not set
3+
# CONFIG_SPL_USE_ARCH_MEMSET is not set
24
CONFIG_TARGET_MX31PDK=y
35
CONFIG_SPL_LIBGENERIC_SUPPORT=y
46
CONFIG_SPL_NAND_SUPPORT=y

configs/omap4_sdp4430_defconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
CONFIG_ARM=y
2+
# CONFIG_SPL_USE_ARCH_MEMCPY is not set
3+
# CONFIG_SPL_USE_ARCH_MEMSET is not set
24
CONFIG_OMAP44XX=y
35
# CONFIG_SPL_I2C_SUPPORT is not set
46
# CONFIG_SPL_NAND_SUPPORT is not set

configs/smartweb_defconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
CONFIG_ARM=y
2+
# CONFIG_SPL_USE_ARCH_MEMCPY is not set
3+
# CONFIG_SPL_USE_ARCH_MEMSET is not set
24
CONFIG_ARCH_AT91=y
35
CONFIG_TARGET_SMARTWEB=y
46
CONFIG_SPL_GPIO_SUPPORT=y

configs/smdk5250_defconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
CONFIG_ARM=y
2+
# CONFIG_SPL_USE_ARCH_MEMCPY is not set
3+
# CONFIG_SPL_USE_ARCH_MEMSET is not set
24
CONFIG_ARCH_EXYNOS=y
35
CONFIG_ARCH_EXYNOS5=y
46
CONFIG_TARGET_SMDK5250=y

0 commit comments

Comments
 (0)