[PATCH master 2/3] ARMv7: hyp: allow disabling support for invoking barebox in HYP mode
Ahmad Fatoum
a.fatoum at pengutronix.de
Tue Jan 20 04:24:45 PST 2026
Older SoCs like the Cortex-A9 don't need this handling and disabling
it allows us to save about 500 bytes.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
arch/arm/cpu/Kconfig | 10 ++++++++++
arch/arm/cpu/lowlevel_32.S | 2 +-
arch/arm/cpu/start.c | 2 +-
arch/arm/cpu/uncompress.c | 2 +-
4 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/arch/arm/cpu/Kconfig b/arch/arm/cpu/Kconfig
index 04b1585679f3..47c116ea98c5 100644
--- a/arch/arm/cpu/Kconfig
+++ b/arch/arm/cpu/Kconfig
@@ -83,6 +83,16 @@ config CPU_V7
depends on 32BIT
select CPU_32v7
+config CPU_V7VE
+ bool "ARMv7 Virtualization Extensions Support"
+ depends on CPU_V7
+ default y
+ help
+ Say y here if it's possible for your CPU to be in HYP (hypervisor)
+ mode when entering barebox.
+
+ If unsure, say y.
+
# ARMv8
config CPU_V8
bool "Generic ARMv8 support"
diff --git a/arch/arm/cpu/lowlevel_32.S b/arch/arm/cpu/lowlevel_32.S
index 5d524faf9cff..3b1dea5c67c0 100644
--- a/arch/arm/cpu/lowlevel_32.S
+++ b/arch/arm/cpu/lowlevel_32.S
@@ -12,7 +12,7 @@ ENTRY(arm_cpu_lowlevel_init)
/* save sp, because possible HYP -> SVC transition below clobbers it */
mov r3, sp
-#ifdef CONFIG_CPU_32v7
+#ifdef CONFIG_CPU_V7VE
/* careful: the hyp install corrupts r0 and r1 */
bl __hyp_install
#endif
diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c
index c2f14736dac5..bbcf465be4db 100644
--- a/arch/arm/cpu/start.c
+++ b/arch/arm/cpu/start.c
@@ -137,7 +137,7 @@ __noreturn void barebox_non_pbl_start(unsigned long membase,
barebox_image_size,
hd);
- if (IS_ENABLED(CONFIG_CPU_V7))
+ if (IS_ENABLED(CONFIG_CPU_V7VE))
armv7_hyp_install();
pbl_barebox_break();
diff --git a/arch/arm/cpu/uncompress.c b/arch/arm/cpu/uncompress.c
index 9a9f391022c1..dffdd2c81232 100644
--- a/arch/arm/cpu/uncompress.c
+++ b/arch/arm/cpu/uncompress.c
@@ -121,7 +121,7 @@ void __noreturn barebox_pbl_start(unsigned long membase, unsigned long memsize,
pr_debug("jumping to ELF entry point at 0x%p\n", barebox);
- if (IS_ENABLED(CONFIG_CPU_V7) && boot_cpu_mode() == HYP_MODE)
+ if (IS_ENABLED(CONFIG_CPU_V7VE) && boot_cpu_mode() == HYP_MODE)
armv7_switch_to_hyp();
barebox(membase, memsize, handoff_data);
--
2.47.3
More information about the barebox
mailing list