Commit f862bbf4 authored by Samuel Holland's avatar Samuel Holland Committed by Palmer Dabbelt

riscv: Allow NOMMU kernels to run in S-mode

For ease of testing, it is convenient to run NOMMU kernels in supervisor
mode. The only required change is to offset the kernel load address,
since the beginning of RAM is usually reserved for M-mode firmware.
Signed-off-by: default avatarSamuel Holland <samuel.holland@sifive.com>
Reviewed-by: default avatarConor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20240227003630.3634533-5-samuel.holland@sifive.comSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
parent 9c4319d6
...@@ -64,7 +64,7 @@ config RISCV ...@@ -64,7 +64,7 @@ config RISCV
select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE
select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU
select BUILDTIME_TABLE_SORT if MMU select BUILDTIME_TABLE_SORT if MMU
select CLINT_TIMER if !MMU select CLINT_TIMER if RISCV_M_MODE
select CLONE_BACKWARDS select CLONE_BACKWARDS
select COMMON_CLK select COMMON_CLK
select CPU_PM if CPU_IDLE || HIBERNATION || SUSPEND select CPU_PM if CPU_IDLE || HIBERNATION || SUSPEND
...@@ -220,8 +220,12 @@ config ARCH_MMAP_RND_COMPAT_BITS_MAX ...@@ -220,8 +220,12 @@ config ARCH_MMAP_RND_COMPAT_BITS_MAX
# set if we run in machine mode, cleared if we run in supervisor mode # set if we run in machine mode, cleared if we run in supervisor mode
config RISCV_M_MODE config RISCV_M_MODE
bool bool "Build a kernel that runs in machine mode"
default !MMU depends on !MMU
default y
help
Select this option if you want to run the kernel in M-mode,
without the assistance of any other firmware.
# set if we are running in S-mode and can use SBI calls # set if we are running in S-mode and can use SBI calls
config RISCV_SBI config RISCV_SBI
...@@ -238,8 +242,9 @@ config MMU ...@@ -238,8 +242,9 @@ config MMU
config PAGE_OFFSET config PAGE_OFFSET
hex hex
default 0xC0000000 if 32BIT && MMU default 0x80000000 if !MMU && RISCV_M_MODE
default 0x80000000 if !MMU default 0x80200000 if !MMU
default 0xc0000000 if 32BIT
default 0xff60000000000000 if 64BIT default 0xff60000000000000 if 64BIT
config KASAN_SHADOW_OFFSET config KASAN_SHADOW_OFFSET
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment