mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/4] ARM: add ARM32/ARM64 symbols for use in generic code
@ 2024-08-09 14:17 Ahmad Fatoum
  2024-08-09 14:17 ` [PATCH 2/4] efi: payload: force PBL_FULLY_PIC for ARM64 Ahmad Fatoum
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Ahmad Fatoum @ 2024-08-09 14:17 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

The CPU_32 and CPU_64 symbols are only defined for ARM, but they are
still confusing to encounter in common code, because they have no
explicit reference to ARM. Add ARM32/ARM64 symbols that can be used
instead.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 MAKEALL                | 2 +-
 arch/arm/Kconfig       | 6 ++++++
 commands/Kconfig       | 4 ++--
 commands/smc.c         | 2 +-
 efi/Kconfig            | 4 ++--
 include/image.h        | 2 +-
 lib/decompress_unxz.c  | 2 +-
 pbl/Kconfig            | 2 +-
 scripts/Makefile.kasan | 9 ++++-----
 scripts/Makefile.pic   | 6 ++----
 test/self/digest.c     | 2 +-
 11 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/MAKEALL b/MAKEALL
index 70e0f6f1740e..861d397814d9 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -97,7 +97,7 @@ do_build_target() {
 	${MAKE} ${target} &>/dev/null
 
 	if [ ${arch} = "arm" ]; then
-		grep -q "CONFIG_CPU_64=y" ${BUILDDIR}/.config
+		grep -q "CONFIG_ARM64=y" ${BUILDDIR}/.config
 		if [ $? = 0 ]; then
 			arch=arm64
 		fi
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 89125ca576ea..a998b18442b5 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -15,6 +15,12 @@ config ARM
 	select PBL_RELOCATABLE
 	default y
 
+config ARM32
+	def_bool CPU_32
+
+config ARM64
+	def_bool CPU_64
+
 config ARCH_TEXT_BASE
 	hex
 	default 0x00000000
diff --git a/commands/Kconfig b/commands/Kconfig
index 0c1de7606ea1..4a0486861186 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -463,7 +463,7 @@ config CMD_BOOTM
 config CMD_BOOTU
 	tristate
 	default y
-	depends on ARM && !CPU_64v8
+	depends on ARM32
 	prompt "bootu"
 	help
 	  Boot into already loaded Linux kernel, which must be raw (uncompressed).
@@ -472,7 +472,7 @@ config CMD_BOOTU
 
 config CMD_BOOTZ
 	tristate
-	depends on ARM && !CPU_64v8
+	depends on ARM32
 	prompt "bootz"
 	help
 	  Boot Linux zImage
diff --git a/commands/smc.c b/commands/smc.c
index 31430655829a..4d9426323520 100644
--- a/commands/smc.c
+++ b/commands/smc.c
@@ -111,7 +111,7 @@ static int do_smc(int argc, char *argv[])
 			printf("found psci version %ld.%ld\n", res.a0 >> 16, res.a0 & 0xffff);
 			break;
 		case 'c':
-			if (IS_ENABLED(CONFIG_CPU_64)) {
+			if (IS_ENABLED(CONFIG_ARM64)) {
 				printf("CPU bootstrap test not supported for ARMv8\n");
 				return COMMAND_ERROR;
 			}
diff --git a/efi/Kconfig b/efi/Kconfig
index dfe4d7327084..dc43addd60ec 100644
--- a/efi/Kconfig
+++ b/efi/Kconfig
@@ -39,8 +39,8 @@ config EFI_DEVICEPATH
 
 config EFI_PAYLOAD_DEFAULT_PATH
 	string
-	default "EFI/BOOT/BOOTARM.EFI"		if CPU_32
-	default "EFI/BOOT/BOOTAA64.EFI"		if CPU_64
+	default "EFI/BOOT/BOOTARM.EFI"		if ARM32
+	default "EFI/BOOT/BOOTAA64.EFI"		if ARM64
 	default "EFI/BOOT/BOOTIA32.EFI"		if X86_32
 	default "EFI/BOOT/BOOTx64.EFI"		if X86_64
 	default "EFI/BOOT/BOOTRISCV32.EFI"	if ARCH_RV32I
diff --git a/include/image.h b/include/image.h
index 277a546c8500..d9a1b8f3ee02 100644
--- a/include/image.h
+++ b/include/image.h
@@ -104,7 +104,7 @@ enum {
 #if defined(__PPC__)
 #define IH_ARCH IH_ARCH_PPC
 #elif defined(__ARM__)
-#ifdef CONFIG_CPU_64v8
+#ifdef CONFIG_ARM64
 #define IH_ARCH IH_ARCH_ARM64
 #else
 #define IH_ARCH IH_ARCH_ARM
diff --git a/lib/decompress_unxz.c b/lib/decompress_unxz.c
index 7b8a9cd33158..e97fca022a15 100644
--- a/lib/decompress_unxz.c
+++ b/lib/decompress_unxz.c
@@ -131,7 +131,7 @@
 #	define XZ_DEC_POWERPC
 #endif
 #ifdef CONFIG_ARM
-#	ifdef CONFIG_CPU_64
+#	ifdef CONFIG_ARM64
 #		define XZ_DEC_ARM64
 #	elif defined CONFIG_THUMB2_BAREBOX
 #		define XZ_DEC_ARMTHUMB
diff --git a/pbl/Kconfig b/pbl/Kconfig
index 5ff2a6ad3c3c..98d71791454b 100644
--- a/pbl/Kconfig
+++ b/pbl/Kconfig
@@ -48,7 +48,7 @@ config PBL_RELOCATABLE
 
 config PBL_FULLY_PIC
 	bool "fully position-independent pbl image"
-	depends on PBL_RELOCATABLE && ARM && CPU_64
+	depends on PBL_RELOCATABLE && ARM64
 	help
 	  Compared to CONFIG_PBL_RELOCATABLE, this image has no relocations in
 	  the code sections.
diff --git a/scripts/Makefile.kasan b/scripts/Makefile.kasan
index 83f6aa543d01..f8759cb8bf73 100644
--- a/scripts/Makefile.kasan
+++ b/scripts/Makefile.kasan
@@ -8,10 +8,9 @@ CFLAGS_KASAN_MINIMAL := -fsanitize=kernel-address
 
 cc-param = $(call cc-option, -mllvm -$(1), $(call cc-option, --param $(1)))
 
+CFLAGS_KASAN-$(CONFIG_ARM32) += $(call cc-param,asan-stack=1)
+
 CFLAGS_KASAN := $(CFLAGS_KASAN_MINIMAL) \
 	$(call cc-param,asan-globals=1) \
-	$(call cc-param,asan-instrument-allocas=1)
-
-ifndef CONFIG_CPU_64
-CFLAGS_KASAN += $(call cc-param,asan-stack=1)
-endif
+	$(call cc-param,asan-instrument-allocas=1) \
+	$(CFLAGS_KASAN-y)
diff --git a/scripts/Makefile.pic b/scripts/Makefile.pic
index c30894ba98d9..a08ee67f4a3e 100644
--- a/scripts/Makefile.pic
+++ b/scripts/Makefile.pic
@@ -8,10 +8,8 @@
 picflags-$(CONFIG_X86_64)	:= -mcmodel=small
 picflags-$(CONFIG_X86)		+= -fPIC -fno-asynchronous-unwind-tables
 
-ifeq ($(CONFIG_ARM),y)
-picflags-$(CONFIG_CPU_32)	:= -fpic -mno-single-pic-base
-picflags-$(CONFIG_CPU_64)	:= -fpie
-endif
+picflags-$(CONFIG_ARM32)	:= -fpic -mno-single-pic-base
+picflags-$(CONFIG_ARM64)	:= -fpie
 
 picflags-y			+= -include $(srctree)/include/linux/hidden.h \
 				   -D__fully_pic__ \
diff --git a/test/self/digest.c b/test/self/digest.c
index 32815c85ba70..8d38f2be9377 100644
--- a/test/self/digest.c
+++ b/test/self/digest.c
@@ -206,7 +206,7 @@ static void test_digests(void)
 	test_digest_md5("generic");
 
 	test_digests_sha12("generic");
-	if (IS_ENABLED(CONFIG_CPU_32))
+	if (IS_ENABLED(CONFIG_ARM32))
 		test_digests_sha12("asm");
 
 	test_digests_sha35("generic");
-- 
2.39.2




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

end of thread, other threads:[~2024-08-14  9:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-09 14:17 [PATCH 1/4] ARM: add ARM32/ARM64 symbols for use in generic code Ahmad Fatoum
2024-08-09 14:17 ` [PATCH 2/4] efi: payload: force PBL_FULLY_PIC for ARM64 Ahmad Fatoum
2024-08-09 14:17 ` [PATCH 3/4] efi: payload: alert user if CONFIG_FS_EFI is missing Ahmad Fatoum
2024-08-09 14:17 ` [PATCH 4/4] ARM: i.MX8M: neuter initcalls when EFI booted Ahmad Fatoum
2024-08-14  9:14   ` Ahmad Fatoum
2024-08-14  9:13 ` (subset) [PATCH 1/4] ARM: add ARM32/ARM64 symbols for use in generic code Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox