[U-Boot] [RFC PATCH] arm: Enable CONFIG_USE_ARCH_MEMSET/MEMCPY globally

- Move the obj- lines for memset.S/memcpy.S to outside of an SPL check so that SPL can use them as well. - Make sure memset() / memcpy() end up in a text.fn section for garbage collection in SPL. - Update examples/api/Makefile to get memset() again on ARM. - Drop Y-MODEM SPL from am335x_evm and USB SPL so that it fits within size constraints again. - Always set CONFIG_USE_ARCH_MEMSET/MEMCPY on ARM && !ARM64
Cc: Albert Aribaud albert.u.boot@aribaud.net Signed-off-by: Tom Rini trini@ti.com
--- Aside from needing to split at least the am335x_evm change out (it's fine to do today, and unused in the usecase am335x_evm_usbspl is for), the setting of MEMSET/MEMCPY should be done in Kconfig. This will make opting out easier if we need that long-term. The problems today are: - Lack of arm64 memset/memcpy (Exist in kernel, could be synced over) - A thumb1? problem on platforms such as taurus that I hope would be resolved with a re-sync to the kernel again as there's some minor differences between our implementations.
If we're good with the notion of always switching over to the asm versions of these functions (and keeping it selectable or not?) I can address some of these problems and of course other feedback. --- arch/arm/lib/Makefile | 4 ++-- arch/arm/lib/memcpy.S | 2 +- arch/arm/lib/memset.S | 2 +- examples/api/Makefile | 3 ++- include/config_fallbacks.h | 5 +++++ include/configs/am335x_evm.h | 2 ++ 6 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile index d74e4b8..d4b0742 100644 --- a/arch/arm/lib/Makefile +++ b/arch/arm/lib/Makefile @@ -27,11 +27,11 @@ endif obj-$(CONFIG_OF_LIBFDT) += bootm-fdt.o obj-$(CONFIG_CMD_BOOTM) += bootm.o obj-$(CONFIG_SYS_L2_PL310) += cache-pl310.o -obj-$(CONFIG_USE_ARCH_MEMSET) += memset.o -obj-$(CONFIG_USE_ARCH_MEMCPY) += memcpy.o else obj-$(CONFIG_SPL_FRAMEWORK) += spl.o endif +obj-$(CONFIG_USE_ARCH_MEMSET) += memset.o +obj-$(CONFIG_USE_ARCH_MEMCPY) += memcpy.o obj-$(CONFIG_SEMIHOSTING) += semihosting.o
obj-y += sections.o diff --git a/arch/arm/lib/memcpy.S b/arch/arm/lib/memcpy.S index eeaf003..ffaee74 100644 --- a/arch/arm/lib/memcpy.S +++ b/arch/arm/lib/memcpy.S @@ -58,7 +58,7 @@ ldmfd sp!, {r0, \reg1, \reg2} .endm
- .text + .section .text.memcpy,"ax",%progbits
/* Prototype: void *memcpy(void *dest, const void *src, size_t n); */ .syntax unified diff --git a/arch/arm/lib/memset.S b/arch/arm/lib/memset.S index 7208f20..49bdff7 100644 --- a/arch/arm/lib/memset.S +++ b/arch/arm/lib/memset.S @@ -12,7 +12,7 @@ #include <linux/linkage.h> #include <asm/assembler.h>
- .text + .section .text.memset,"ax",%progbits .align 5
.syntax unified diff --git a/examples/api/Makefile b/examples/api/Makefile index 6cf23d1..e3c0b6e 100644 --- a/examples/api/Makefile +++ b/examples/api/Makefile @@ -28,6 +28,7 @@ EXT_COBJ-y += lib/string.o EXT_COBJ-y += lib/time.o EXT_COBJ-y += lib/vsprintf.o EXT_SOBJ-$(CONFIG_PPC) += arch/powerpc/lib/ppcstring.o +EXT_SOBJ-$(CONFIG_USE_ARCH_MEMSET) += arch/arm/lib/memset.o
# Create a list of object files to be compiled OBJS := $(OBJ-y) $(notdir $(EXT_COBJ-y) $(EXT_SOBJ-y)) @@ -53,5 +54,5 @@ $(addprefix $(obj)/,$(notdir $(EXT_COBJ-y))): $(obj)/%.o: lib/%.c FORCE $(call if_changed_rule,cc_o_c)
# Rule to build architecture-specific library assembly files -$(addprefix $(obj)/,$(notdir $(EXT_SOBJ-y))): $(obj)/%.o: arch/powerpc/lib/%.S FORCE +$(addprefix $(obj)/,$(notdir $(EXT_SOBJ-y))): $(obj)/%.o: arch/$(ARCH)/lib/%.S FORCE $(call if_changed_dep,as_o_S) diff --git a/include/config_fallbacks.h b/include/config_fallbacks.h index ddfe045..dd17573 100644 --- a/include/config_fallbacks.h +++ b/include/config_fallbacks.h @@ -97,4 +97,9 @@ # endif #endif
+#if defined(CONFIG_ARM) && !defined(CONFIG_ARM64) +#define CONFIG_USE_ARCH_MEMSET +#define CONFIG_USE_ARCH_MEMCPY +#endif + #endif /* __CONFIG_FALLBACKS_H */ diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h index f1c270c..7a87b46 100644 --- a/include/configs/am335x_evm.h +++ b/include/configs/am335x_evm.h @@ -345,6 +345,8 @@ /* disable EFI partitions and partition UUID support */ #undef CONFIG_PARTITION_UUIDS #undef CONFIG_EFI_PARTITION +/* Reclaim more space */ +#undef CONFIG_SPL_YMODEM_SUPPORT /* General network SPL */ #define CONFIG_SPL_NET_SUPPORT #define CONFIG_SPL_ENV_SUPPORT

Hello Tom,
On Tue, 3 Feb 2015 15:21:53 -0500, Tom Rini trini@ti.com wrote:
- Move the obj- lines for memset.S/memcpy.S to outside of an SPL check so that SPL can use them as well.
- Make sure memset() / memcpy() end up in a text.fn section for garbage collection in SPL.
- Update examples/api/Makefile to get memset() again on ARM.
- Drop Y-MODEM SPL from am335x_evm and USB SPL so that it fits within size constraints again.
- Always set CONFIG_USE_ARCH_MEMSET/MEMCPY on ARM && !ARM64
Cc: Albert Aribaud albert.u.boot@aribaud.net Signed-off-by: Tom Rini trini@ti.com
Really small nitpick: the comment before the YMODEM undef is not that informative, and possibly unneeded if all space-saving undefs can be grouped under a single global comment.
If there are no comments apart from mine, maybe we don't need this to be reposted as non-RFC, and I can directly apply it?
Amicalement,

On Thu, Apr 16, 2015 at 09:30:14AM +0200, Albert ARIBAUD wrote:
Hello Tom,
On Tue, 3 Feb 2015 15:21:53 -0500, Tom Rini trini@ti.com wrote:
- Move the obj- lines for memset.S/memcpy.S to outside of an SPL check so that SPL can use them as well.
- Make sure memset() / memcpy() end up in a text.fn section for garbage collection in SPL.
- Update examples/api/Makefile to get memset() again on ARM.
- Drop Y-MODEM SPL from am335x_evm and USB SPL so that it fits within size constraints again.
- Always set CONFIG_USE_ARCH_MEMSET/MEMCPY on ARM && !ARM64
Cc: Albert Aribaud albert.u.boot@aribaud.net Signed-off-by: Tom Rini trini@ti.com
Really small nitpick: the comment before the YMODEM undef is not that informative, and possibly unneeded if all space-saving undefs can be grouped under a single global comment.
If there are no comments apart from mine, maybe we don't need this to be reposted as non-RFC, and I can directly apply it?
Yes, if you'd be so kind as to re-word the commit message (and note that I applied the fix for am335x_evm_usbspl build size already for other reasons) that would be great!

Hello Tom,
On Wed, 22 Apr 2015 09:49:55 -0400, Tom Rini trini@konsulko.com wrote:
On Thu, Apr 16, 2015 at 09:30:14AM +0200, Albert ARIBAUD wrote:
Hello Tom,
On Tue, 3 Feb 2015 15:21:53 -0500, Tom Rini trini@ti.com wrote:
- Move the obj- lines for memset.S/memcpy.S to outside of an SPL check so that SPL can use them as well.
- Make sure memset() / memcpy() end up in a text.fn section for garbage collection in SPL.
- Update examples/api/Makefile to get memset() again on ARM.
- Drop Y-MODEM SPL from am335x_evm and USB SPL so that it fits within size constraints again.
- Always set CONFIG_USE_ARCH_MEMSET/MEMCPY on ARM && !ARM64
Cc: Albert Aribaud albert.u.boot@aribaud.net Signed-off-by: Tom Rini trini@ti.com
Really small nitpick: the comment before the YMODEM undef is not that informative, and possibly unneeded if all space-saving undefs can be grouped under a single global comment.
If there are no comments apart from mine, maybe we don't need this to be reposted as non-RFC, and I can directly apply it?
Yes, if you'd be so kind as to re-word the commit message (and note that I applied the fix for am335x_evm_usbspl build size already for other reasons) that would be great!
-- Tom
Applied to u-boot-arm/master, thanks!
Amicalement,

On Tue, Feb 03, 2015 at 03:21:53PM -0500, Tom Rini wrote:
- Move the obj- lines for memset.S/memcpy.S to outside of an SPL check so that SPL can use them as well.
- Make sure memset() / memcpy() end up in a text.fn section for garbage collection in SPL.
- Update examples/api/Makefile to get memset() again on ARM.
- Drop Y-MODEM SPL from am335x_evm and USB SPL so that it fits within size constraints again.
- Always set CONFIG_USE_ARCH_MEMSET/MEMCPY on ARM && !ARM64
Cc: Albert Aribaud albert.u.boot@aribaud.net Signed-off-by: Tom Rini trini@ti.com
So, this never made it into master. I'm going to make a v2 of this that applies better to how we are today.
participants (3)
-
Albert ARIBAUD
-
Tom Rini
-
Tom Rini