summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorMaximilian Brune <maximilian.brune@9elements.com>2024-01-14 09:20:17 +0600
committerFelix Held <felix-coreboot@felixheld.de>2024-02-07 12:17:47 +0000
commita122041be15baf7e212c4b9dee63f6b0a9cf1edb (patch)
tree73c2b52818d28b9d20da6ca3f0509d3541fb30e0 /src/arch
parentf6a7809de8ea8f13ed3641ed14e9ed2a889a17d2 (diff)
arch/riscv: Add OPENSBI_FW_DYNAMIC_BOOT_HART option
This adds another option to tell OpenSBI which hart to use for booting. Test: Start hifive-unmatched board and see that Hart 1 (instead of 0) is used for running OpenSBI. Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com> Change-Id: Id58bd6ae3b55a5ef3f1a5c97dfa07c79aa4c78d0 Reviewed-on: https://review.coreboot.org/c/coreboot/+/79948 Reviewed-by: Philipp Hug <philipp@hug.cx> Reviewed-by: Felix Held <felix-coreboot@felixheld.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/riscv/Kconfig10
-rw-r--r--src/arch/riscv/opensbi.c2
2 files changed, 12 insertions, 0 deletions
diff --git a/src/arch/riscv/Kconfig b/src/arch/riscv/Kconfig
index 2578b1250c..e4668049f5 100644
--- a/src/arch/riscv/Kconfig
+++ b/src/arch/riscv/Kconfig
@@ -66,6 +66,16 @@ config OPENSBI_TEXT_START
help
The linking address used to build opensbi.
+config OPENSBI_FW_DYNAMIC_BOOT_HART
+ int
+ default RISCV_WORKING_HARTID
+ help
+ This specifies the hart that OpenSBI will use to boot the payload. If set to
+ value -1, OpenSBI will use a 'lottery' scheme to figure it out itself.
+ This hart must be able to execute in the Supervisor priviledged mode, since
+ that is the mode usually used for the payload. If the hart does not support
+ Supervisor mode OpenSBI will again look for a hart that does support it.
+
config ARCH_RISCV_U
# U (user) mode is for programs.
bool
diff --git a/src/arch/riscv/opensbi.c b/src/arch/riscv/opensbi.c
index 48f0f2a9cd..bf26b2279e 100644
--- a/src/arch/riscv/opensbi.c
+++ b/src/arch/riscv/opensbi.c
@@ -20,6 +20,8 @@ void run_opensbi(const int hart_id,
.version = FW_DYNAMIC_INFO_VERSION_MAX,
.next_mode = payload_mode,
.next_addr = (uintptr_t)payload,
+ .options = 0,
+ .boot_hart = CONFIG_OPENSBI_FW_DYNAMIC_BOOT_HART,
};
csr_write(mepc, opensbi);