From: buenocalvachejoel@gmail.com
To: opensbi@lists.infradead.org
Cc: anup@brainfault.org, Joel Bueno <buenocalvachejoel@gmail.com>
Subject: [PATCH] firmware: fw_base: make stack guard setup conditional on Zkr
Date: Tue, 31 Mar 2026 11:59:43 +0200 [thread overview]
Message-ID: <20260331095943.133791-1-buenocalvachejoel@gmail.com> (raw)
From: Joel Bueno <buenocalvachejoel@gmail.com>
Zkr isn't explicitly selected as a mandatory extension to run OpenSBI
as per: docs/platform_requirements.md
Since this happens very early on the boot flow of OpenSBI where the
dynamic extension checks haven't yet happened, we must guard the Zkr
stack setup behind an ifdef block so that it only gets compiled for
targets that do actually have the extension.
Signed-off-by: Joel Bueno <buenocalvachejoel@gmail.com>
---
firmware/fw_base.S | 2 ++
1 file changed, 2 insertions(+)
diff --git a/firmware/fw_base.S b/firmware/fw_base.S
index 63bb4473..9ea93907 100644
--- a/firmware/fw_base.S
+++ b/firmware/fw_base.S
@@ -107,6 +107,7 @@ _bss_zero:
add s4, s4, __SIZEOF_POINTER__
blt s4, s5, _bss_zero
+#if defined(__riscv_zkr)
/* Trying to initialize the stack guard via the Zkr extension */
lla t0, __stack_chk_guard_done
csrw CSR_MTVEC, t0
@@ -130,6 +131,7 @@ __stack_chk_guard_loop:
j __stack_chk_guard_done
.align 3
__stack_chk_guard_done:
+#endif
/* Setup temporary trap handler */
lla s4, _start_hang
--
2.43.0
--
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
next reply other threads:[~2026-03-31 10:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-31 9:59 buenocalvachejoel [this message]
2026-04-01 2:07 ` [PATCH] firmware: fw_base: make stack guard setup conditional on Zkr Yu-Chine Peter Lin
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=20260331095943.133791-1-buenocalvachejoel@gmail.com \
--to=buenocalvachejoel@gmail.com \
--cc=anup@brainfault.org \
--cc=opensbi@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