forked from zephyrproject-rtos/zephyr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
arch: riscv: core: run zephyr completely in user/supervisor mode
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Defined new board type qemu_riscv32/qemu_virt_riscv32/opensbi Drivers for running zephyr in supervisor with qemu included. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <s.ginka@sensry.de> Signed-off-by: Sven Ginka <sven.ginka@gmail.com>
- Loading branch information
Showing
39 changed files
with
1,040 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ board: | |
- name: qemu_virt_riscv32 | ||
variants: | ||
- name: smp | ||
- name: opensbi |
40 changes: 40 additions & 0 deletions
40
boards/qemu/riscv32/qemu_riscv32_qemu_virt_riscv32_opensbi.dts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) 2024 sensry.io | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/dts-v1/; | ||
|
||
#include <qemu/virt-riscv32.dtsi> | ||
|
||
/ { | ||
console0: console { | ||
compatible = "opensbi,console-uart"; | ||
foo = "abc"; | ||
status = "okay"; | ||
}; | ||
|
||
chosen { | ||
zephyr,console = &console0; | ||
zephyr,shell-uart = &console0; | ||
zephyr,sram = &ram0; | ||
}; | ||
}; | ||
|
||
&ram0 { | ||
device_type = "memory"; | ||
reg = < 0x80400000 0x100000 >; | ||
}; | ||
|
||
&uart0 { | ||
status = "disabled"; | ||
}; | ||
|
||
&plic { | ||
status = "disabled"; | ||
}; | ||
|
||
&clint{ | ||
status = "disabled"; | ||
}; |
15 changes: 15 additions & 0 deletions
15
boards/qemu/riscv32/qemu_riscv32_qemu_virt_riscv32_opensbi.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
identifier: qemu_riscv32/qemu_virt_riscv32/opensbi | ||
name: QEMU Emulation for RISC-V 32-bit openSBI | ||
type: qemu | ||
simulation: qemu | ||
arch: riscv | ||
toolchain: | ||
- zephyr | ||
- xtools | ||
supported: | ||
- netif | ||
testing: | ||
default: true | ||
ignore_tags: | ||
- net | ||
- bluetooth |
32 changes: 32 additions & 0 deletions
32
boards/qemu/riscv32/qemu_riscv32_qemu_virt_riscv32_opensbi_defconfig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Copyright (c) 2024 sensry.io | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
CONFIG_CONSOLE=y | ||
CONFIG_SERIAL=y | ||
CONFIG_UART_CONSOLE=y | ||
CONFIG_STACK_SENTINEL=y | ||
CONFIG_XIP=n | ||
CONFIG_RISCV_PMP=y | ||
CONFIG_SMP=y | ||
CONFIG_MP_MAX_NUM_CPUS=1 | ||
CONFIG_IDLE_STACK_SIZE=1024 | ||
CONFIG_QEMU_ICOUNT=n | ||
|
||
# enable the openSBI support, requires a compiled version of openSBI binary in machine mode | ||
CONFIG_RISCV_OPENSBI=y | ||
|
||
# we run zephyr in supervisor mode | ||
CONFIG_RISCV_KERNEL_IN_SUPERVISOR_MODE=y | ||
CONFIG_RISCV_MACHINE_TIMER=n | ||
|
||
# options that have to be disabled by now | ||
CONFIG_USERSPACE=n | ||
CONFIG_RISCV_HAS_HART_ID=n | ||
CONFIG_SMP=n | ||
CONFIG_RISCV_PMP=n | ||
|
||
# build output for qemu | ||
CONFIG_BUILD_OUTPUT_BIN=y | ||
|
||
|
||
CONFIG_THREAD_MONITOR=n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -280,4 +280,6 @@ rsource "Kconfig.rzt2m" | |
|
||
rsource "Kconfig.renesas_ra8" | ||
|
||
rsource "Kconfig.opensbi_console" | ||
|
||
endif # SERIAL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# openSBI Console UART driver configuration options | ||
|
||
# Copyright (c) 2024 sensry.io | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
|
||
if RISCV_OPENSBI | ||
|
||
config UART_OPENSBI_CONSOLE | ||
bool "openSBI console serial driver" | ||
default y | ||
select SERIAL_HAS_DRIVER | ||
help | ||
This option enables the console driver for openSBI based RISCV family of | ||
processors. | ||
|
||
endif # RISCV_OPENSBI |
Oops, something went wrong.