Attention is currently required from: Philipp Hug, ron minnich.

Maximilian Brune has uploaded this change for review.

View Change

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
---
M src/arch/riscv/Kconfig
M src/arch/riscv/opensbi.c
2 files changed, 12 insertions(+), 0 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/48/79948/1
diff --git a/src/arch/riscv/Kconfig b/src/arch/riscv/Kconfig
index 2578b12..d3f27c7 100644
--- a/src/arch/riscv/Kconfig
+++ b/src/arch/riscv/Kconfig
@@ -66,6 +66,16 @@
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. It is not OpenSBI will again
+ figure it out itself.
+
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 48f0f2a..bf26b22 100644
--- a/src/arch/riscv/opensbi.c
+++ b/src/arch/riscv/opensbi.c
@@ -20,6 +20,8 @@
.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);

To view, visit change 79948. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: Id58bd6ae3b55a5ef3f1a5c97dfa07c79aa4c78d0
Gerrit-Change-Number: 79948
Gerrit-PatchSet: 1
Gerrit-Owner: Maximilian Brune <maximilian.brune@9elements.com>
Gerrit-Reviewer: Philipp Hug <philipp@hug.cx>
Gerrit-Reviewer: ron minnich <rminnich@gmail.com>
Gerrit-Attention: Philipp Hug <philipp@hug.cx>
Gerrit-Attention: ron minnich <rminnich@gmail.com>
Gerrit-MessageType: newchange