* [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
* [PATCH 2/4] efi: payload: force PBL_FULLY_PIC for ARM64
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 ` Ahmad Fatoum
2024-08-09 14:17 ` [PATCH 3/4] efi: payload: alert user if CONFIG_FS_EFI is missing Ahmad Fatoum
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Ahmad Fatoum @ 2024-08-09 14:17 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The PBL_FULLY_PIC option was primarily added for ARM64 EFI payload:
Tianocore/EDK-II may take great offence on barebox rewriting its own code
to relocate and PBL_FULLY_PIC eliminates these unnecessary relocations.
We should thus enable it unconditionally when EFI_PAYLOAD, so the
resulting barebox binary is more universally usable.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
efi/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/efi/Kconfig b/efi/Kconfig
index dc43addd60ec..84f670fd23d3 100644
--- a/efi/Kconfig
+++ b/efi/Kconfig
@@ -8,6 +8,7 @@ config HAVE_EFI_PAYLOAD
config EFI_PAYLOAD
bool "Build as EFI payload" if COMPILE_TEST
depends on HAVE_EFI_PAYLOAD
+ select PBL_FULLY_PIC if ARM64
select EFI
select EFI_GUID
select EFI_DEVICEPATH
--
2.39.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/4] efi: payload: alert user if CONFIG_FS_EFI is missing
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 ` Ahmad Fatoum
2024-08-09 14:17 ` [PATCH 4/4] ARM: i.MX8M: neuter initcalls when EFI booted Ahmad Fatoum
2024-08-14 9:13 ` (subset) [PATCH 1/4] ARM: add ARM32/ARM64 symbols for use in generic code Sascha Hauer
3 siblings, 0 replies; 6+ messages in thread
From: Ahmad Fatoum @ 2024-08-09 14:17 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The /boot mount point is created by the EFI file system support when it
detects the ESP. Rework the error message to point this out.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
efi/payload/init.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/efi/payload/init.c b/efi/payload/init.c
index 5701d7ad6dcf..35cd8fc71661 100644
--- a/efi/payload/init.c
+++ b/efi/payload/init.c
@@ -370,7 +370,8 @@ static int efi_late_init(void)
return 0;
if (!get_mounted_path("/boot")) {
- pr_warn("boot device couldn't be determined\n");
+ pr_warn("boot device couldn't be determined%s\n",
+ IS_ENABLED(CONFIG_FS_EFI) ? " without CONFIG_FS_EFI" : "");
return 0;
}
--
2.39.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 4/4] ARM: i.MX8M: neuter initcalls when EFI booted
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 ` 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
3 siblings, 1 reply; 6+ messages in thread
From: Ahmad Fatoum @ 2024-08-09 14:17 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
When enabling EFI payload support in a build that has i.MX boards
enabled, booting the EFI payload reports some failed initcalls.
Disable them if we don't probe from device tree or aren't on an
i.MX system.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm/mach-imx/imx.c | 11 ++++++-----
arch/arm/mach-imx/scratch.c | 4 ++++
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/arch/arm/mach-imx/imx.c b/arch/arm/mach-imx/imx.c
index f3491c6df7fa..2522ce04e6f5 100644
--- a/arch/arm/mach-imx/imx.c
+++ b/arch/arm/mach-imx/imx.c
@@ -89,11 +89,12 @@ static int imx_init(void)
struct device_node *root;
root = of_get_root_node();
- if (root) {
- __imx_cpu_type = imx_soc_from_dt();
- if (!__imx_cpu_type)
- return 0;
- }
+ if (!root)
+ return 0;
+
+ __imx_cpu_type = imx_soc_from_dt();
+ if (!__imx_cpu_type)
+ return 0;
/*
* Don't add new SoCs to this list, instead use the new
diff --git a/arch/arm/mach-imx/scratch.c b/arch/arm/mach-imx/scratch.c
index b7280ff60952..e12d3401a854 100644
--- a/arch/arm/mach-imx/scratch.c
+++ b/arch/arm/mach-imx/scratch.c
@@ -8,6 +8,7 @@
#include <mach/imx/imx9-regs.h>
#include <mach/imx/esdctl.h>
#include <mach/imx/scratch.h>
+#include <mach/imx/generic.h>
#include <memory.h>
#include <tee/optee.h>
#include <pbl.h>
@@ -95,6 +96,9 @@ const struct optee_header *imx_scratch_get_optee_hdr(void)
static int imx8m_reserve_scratch_area(void)
{
+ if (!__imx_cpu_type)
+ return 0;
+
return request_barebox_region("scratch area",
(ulong)arm_mem_scratch_get(),
sizeof(struct imx_scratch_space)) ? 0 : -EINVAL;
--
2.39.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 4/4] ARM: i.MX8M: neuter initcalls when EFI booted
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
0 siblings, 0 replies; 6+ messages in thread
From: Ahmad Fatoum @ 2024-08-14 9:14 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox
On 09.08.24 16:17, Ahmad Fatoum wrote:
> When enabling EFI payload support in a build that has i.MX boards
> enabled, booting the EFI payload reports some failed initcalls.
>
> Disable them if we don't probe from device tree or aren't on an
> i.MX system.
>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> arch/arm/mach-imx/imx.c | 11 ++++++-----
> arch/arm/mach-imx/scratch.c | 4 ++++
> 2 files changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm/mach-imx/imx.c b/arch/arm/mach-imx/imx.c
> index f3491c6df7fa..2522ce04e6f5 100644
> --- a/arch/arm/mach-imx/imx.c
> +++ b/arch/arm/mach-imx/imx.c
> @@ -89,11 +89,12 @@ static int imx_init(void)
> struct device_node *root;
>
> root = of_get_root_node();
> - if (root) {
> - __imx_cpu_type = imx_soc_from_dt();
> - if (!__imx_cpu_type)
> - return 0;
> - }
> + if (!root)
> + return 0;
> +
> + __imx_cpu_type = imx_soc_from_dt();
> + if (!__imx_cpu_type)
> + return 0;
>
> /*
> * Don't add new SoCs to this list, instead use the new
> diff --git a/arch/arm/mach-imx/scratch.c b/arch/arm/mach-imx/scratch.c
> index b7280ff60952..e12d3401a854 100644
> --- a/arch/arm/mach-imx/scratch.c
> +++ b/arch/arm/mach-imx/scratch.c
> @@ -8,6 +8,7 @@
> #include <mach/imx/imx9-regs.h>
> #include <mach/imx/esdctl.h>
> #include <mach/imx/scratch.h>
> +#include <mach/imx/generic.h>
> #include <memory.h>
> #include <tee/optee.h>
> #include <pbl.h>
> @@ -95,6 +96,9 @@ const struct optee_header *imx_scratch_get_optee_hdr(void)
>
> static int imx8m_reserve_scratch_area(void)
> {
> + if (!__imx_cpu_type)
> + return 0;
> +
> return request_barebox_region("scratch area",
> (ulong)arm_mem_scratch_get(),
> sizeof(struct imx_scratch_space)) ? 0 : -EINVAL;
Will remove this hunk in v2. We reserve the whole barebox memory region now,
so this can be dropped.
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: (subset) [PATCH 1/4] ARM: add ARM32/ARM64 symbols for use in generic code
2024-08-09 14:17 [PATCH 1/4] ARM: add ARM32/ARM64 symbols for use in generic code Ahmad Fatoum
` (2 preceding siblings ...)
2024-08-09 14:17 ` [PATCH 4/4] ARM: i.MX8M: neuter initcalls when EFI booted Ahmad Fatoum
@ 2024-08-14 9:13 ` Sascha Hauer
3 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2024-08-14 9:13 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Fri, 09 Aug 2024 16:17:52 +0200, Ahmad Fatoum wrote:
> 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.
>
>
Applied, thanks!
[1/4] ARM: add ARM32/ARM64 symbols for use in generic code
https://git.pengutronix.de/cgit/barebox/commit/?id=e490bb32045f (link may not be stable)
[2/4] efi: payload: force PBL_FULLY_PIC for ARM64
https://git.pengutronix.de/cgit/barebox/commit/?id=95c7524fd756 (link may not be stable)
[3/4] efi: payload: alert user if CONFIG_FS_EFI is missing
https://git.pengutronix.de/cgit/barebox/commit/?id=12a4d57229ae (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ 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