Skip to contentSkip to conversation

arm: Enable CONFIG_USE_ARCH_MEMSET/MEMCPY globally

RFC PATCH In review Tom Rini 3 participants 5 messages Feb 3, 2015 – Oct 18, 2016 Arm (32-bit)

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

RFC PATCH 1/1 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 <[email protected]>

---
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(-)
arch/arm/lib/Makefile +2 -2
index d74e4b8..d4b0742 100644
@@ -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
arch/arm/lib/memcpy.S +1 -1
index eeaf003..ffaee74 100644
@@ -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
arch/arm/lib/memset.S +1 -1
index 7208f20..49bdff7 100644
@@ -12,7 +12,7 @@
 #include <linux/linkage.h>
 #include <asm/assembler.h>
 
-	.text
+	.section .text.memset,"ax",%progbits
 	.align	5
 
 	.syntax unified
examples/api/Makefile +2 -1
index 6cf23d1..e3c0b6e 100644
@@ -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)
include/config_fallbacks.h +5 -0
index ddfe045..dd17573 100644
@@ -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 */
include/configs/am335x_evm.h +2 -0
index f1c270c..7a87b46 100644
@@ -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
Signature · 1 line
1.7.9.5
#1 lore raw

RFC PATCH 1/1 arm: Enable CONFIG_USE_ARCH_MEMSET/MEMCPY globally

Hello Tom,

Quoted 11 lines · Tom Rini

- 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 <[email protected]>

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,

Signature · 1 line
Albert.
#2 lore raw

RFC PATCH 1/1 arm: Enable CONFIG_USE_ARCH_MEMSET/MEMCPY globally

Quoted 15 lines · Albert ARIBAUD

Hello Tom,

Quoted 11 lines · Tom Rini

- 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 <[email protected]>
Quoted 6 lines

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!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150422/6543c20b/attachment.sig>
#3 lore raw

RFC PATCH 1/1 arm: Enable CONFIG_USE_ARCH_MEMSET/MEMCPY globally

Hello Tom,

Quoted 20 lines · Tom Rini
Quoted 19 lines · Albert ARIBAUD

Hello Tom,

Quoted 11 lines · Tom Rini

- 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 <[email protected]>

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.

Quoted 9 lines
Quoted 2 lines

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!

Signature · 1 line
Tom

Applied to u-boot-arm/master, thanks!

Amicalement,

Signature · 1 line
Albert.
#4 lore raw
In reply to Tom Rini
Quoted 11 lines · Tom Rini

- 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 <[email protected]>

So, this never made it into master. I'm going to make a v2 of this that applies better to how we are today.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161017/4e136f15/attachment.sig>