From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH master 2/3] ARMv7: hyp: allow disabling support for invoking barebox in HYP mode
Date: Tue, 20 Jan 2026 13:24:45 +0100 [thread overview]
Message-ID: <20260120122453.627239-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20260120122453.627239-1-a.fatoum@pengutronix.de>
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@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
next prev parent reply other threads:[~2026-01-20 12:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-20 12:24 [PATCH 0/3] ARM: socfpga: shrink socfpga-xload configs in size Ahmad Fatoum
2026-01-20 12:24 ` [PATCH master 1/3] include: asm-generic/bug.h: allow disabling CONFIG_DEBUG_BUGVERBOSE Ahmad Fatoum
2026-01-20 12:24 ` Ahmad Fatoum [this message]
2026-01-20 12:24 ` [PATCH master 3/3] ARM: socfpga: shrink socfpga-xload configs in size Ahmad Fatoum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260120122453.627239-3-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox